porepy.models.verification_setups.manu_flow_incomp_frac module

This module contains a code verification implementation for a manufactured solution for the two-dimensional, incompressible, single phase flow with a single, fully embedded vertical fracture in the middle of the domain.

For the details, we refer to https://doi.org/10.1515/jnma-2022-0038

TODO: The placement of this module is not ideal. It will be moved to a more appropriate location in the future.

class ExactSolution[source]

Bases: object

Parent class for the exact solution.

boundary_values(sd_rock)[source]

Exact pressure at the boundary faces.

Parameters

sd_rock (Grid) – Rock grid.

Returns

Array of shape=(sd_rock.num_faces, ) with the exact pressure values at the exterior boundary faces.

Return type

ndarray

fracture_flux(sd_frac)[source]

Evaluate exact fracture Darcy flux at the face centers.

Parameters

sd_frac (Grid) – Fracture grid.

Returns

Array of shape=(sd_frac.num_faces, ) containing the exact Darcy fluxes at the face centers.

Return type

ndarray

Note

The returned fluxes are already scaled with sd_face.face_normals.

fracture_pressure(sd_frac)[source]

Evaluate exact fracture pressure at the cell centers.

Parameters

sd_frac (Grid) – Fracture grid.

Returns

Array of shape=(sd_frac.num_cells, ) containing the exact pressures at the cell centers.

Return type

ndarray

fracture_source(sd_frac)[source]

Compute exact integrated fracture source.

Parameters

sd_frac (Grid) – Fracture grid.

Returns

Array of shape=(sd_frac.num_cells, ) containing the exact integrated sources.

Return type

ndarray

mortar_fluxes(intf)[source]

Compute exact mortar fluxes at the interface.

Parameters

intf (MortarGrid) – Mortar grid.

Returns

Array of shape=(intf.num_cells, ) containing the exact mortar fluxes.

Return type

ndarray

Note

The returned mortar fluxes are already scaled with intf.cell_volumes.

rock_flux(sd_rock)[source]

Evaluate exact rock Darcy flux at the face centers.

Parameters

sd_rock (Grid) – Rock grid.

Returns

Array of shape=(sd_rock.num_faces, ) containing the exact Darcy fluxes at the face centers.

Return type

ndarray

Note

The returned fluxes are already scaled with sd_rock.face_normals.

rock_pressure(sd_rock)[source]

Evaluate exact rock pressure at the cell centers.

Parameters

sd_rock (Grid) – Rock grid.

Returns

Array of shape=(sd_rock.num_cells, ) containing the exact pressures at the cell centers.

Return type

ndarray

rock_source(sd_rock)[source]

Compute exact integrated rock source.

Parameters

sd_rock (Grid) – Rock grid.

Returns

Array of shape=(sd_rock.num_cells, ) containing the exact integrated sources.

Return type

ndarray

class ManufacturedFlow2d(params)[source]

Bases: ModifiedGeometry, ModifiedBoundaryConditions, ModifiedBalanceEquation, ModifiedSolutionStrategy, SinglePhaseFlow

Mixer class for the manufactured solution with a single vertical fracture.

Examples

# Import modules
import porepy as pp
from time import time

# Run verification setup
tic = time()
params = {"plot_results": True}
setup = ManufacturedFlow2d(params)
print("Simulation started...")
pp.run_stationary_model(setup, params)
toc = time()
print(f"Simulation finished in {round(toc - tic)} seconds.")
Parameters

params (dict) –

fracture_network: pp.FractureNetwork2d

Fracture network. Set in set_fracture_network().

params: dict

Simulation model parameters

class ModifiedBalanceEquation[source]

Bases: MassBalanceEquations

Modify balance equation to account for external sources.

fluid_source(subdomains)[source]
Parameters

subdomains (list[porepy.grids.grid.Grid]) –

Return type

Operator

advective_flux: Callable[[list[pp.Grid], pp.ad.Operator, pp.ad.UpwindAd, pp.ad.Operator, Callable[[list[pp.MortarGrid]], pp.ad.Operator]], pp.ad.Operator]

Ad operator representing the advective flux. Normally provided by a mixin instance of AdvectiveFlux.

basis: Callable[[Sequence[pp.GridLike], int], list[pp.ad.Matrix]]

Basis for the local coordinate system. Normally set by a mixin instance of porepy.models.geometry.ModelGeometry.

bc_values_mobrho: Callable[[list[pp.Grid]], pp.ad.Array]

Mobility times density boundary conditions. Normally defined in a mixin instance of BoundaryConditionsSinglePhaseFlow.

equation_system: pp.ad.EquationSystem

EquationSystem object for the current model. Normally defined in a mixin class defining the solution strategy.

fluid_density: Callable[[list[pp.Grid]], pp.ad.Operator]

Fluid density. Defined in a mixin class with a suitable constitutive relation.

interface_advective_flux: Callable[[list[pp.MortarGrid], pp.ad.Operator, pp.ad.UpwindCouplingAd], pp.ad.Operator]

Ad operator representing the advective flux on internal boundaries. Normally provided by a mixin instance of AdvectiveFlux.

interface_darcy_flux: Callable[[list[pp.MortarGrid]], pp.ad.MixedDimensionalVariable]

Darcy flux variable on interfaces. Normally defined in a mixin instance of VariablesSinglePhaseFlow.

interface_darcy_flux_equation: Callable[[list[pp.MortarGrid]], pp.ad.Operator]

Interface Darcy flux equation. Normally provided by a mixin instance of DarcysLaw.

interface_mobility_discretization: Callable[[list[pp.MortarGrid]], pp.ad.UpwindCouplingAd]

Discretization of the fluid mobility on internal boundaries. Normally provided by a mixin instance of FluidMobility.

interfaces_to_subdomains: Callable[[list[pp.MortarGrid]], list[pp.Grid]]

Map from interfaces to the adjacent subdomains. Normally defined in a mixin instance of ModelGeometry.

mdg: pp.MixedDimensionalGrid

Mixed dimensional grid for the current model. Normally defined in a mixin instance of ModelGeometry.

mobility: Callable[[list[pp.Grid]], pp.ad.Operator]

Fluid mobility. Normally provided by a mixin instance of FluidMobility.

mobility_discretization: Callable[[list[pp.Grid]], pp.ad.UpwindAd]

Discretization of the fluid mobility. Normally provided by a mixin instance of FluidMobility.

nd: int

Ambient dimension of the problem. Normally set by a mixin instance of porepy.models.geometry.ModelGeometry.

porosity: Callable[[list[pp.Grid]], pp.ad.Operator]

Porosity of the rock. Normally provided by a mixin instance of ConstantPorosity or a subclass thereof.

specific_volume: Callable[[list[pp.Grid]], pp.ad.Operator]

Function that returns the specific volume of a subdomain. Normally provided by a mixin of instance DimensionReduction.

subdomains_to_interfaces: Callable[[list[pp.Grid], list[int]], list[pp.MortarGrid]]

Map from subdomains to the adjacent interfaces. Normally defined in a mixin instance of ModelGeometry.

time_manager: pp.TimeManager

Time manager. Normally set by a mixin instance of porepy.models.solution_strategy.SolutionStrategy.

wrap_grid_attribute: Callable[[Sequence[pp.GridLike], str, int, bool], pp.ad.Matrix]

Wrap grid attributes as Ad operators. Normally set by a mixin instance of porepy.models.geometry.ModelGeometry.

class ModifiedBoundaryConditions[source]

Bases: object

Set boundary conditions for the simulation model.

bc_type_darcy(sd)[source]
Parameters

sd (Grid) –

Return type

BoundaryCondition

bc_values_darcy(subdomains)[source]
Parameters

subdomains (list[porepy.grids.grid.Grid]) –

Return type

Array

domain_boundary_sides: Callable[[Grid], tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]]

Utility function to access the domain boundary sides.

class ModifiedGeometry[source]

Bases: ModelGeometry

Generate fracture network and mixed-dimensional grid.

mesh_arguments()[source]

Define mesh arguments for meshing.

Return type

dict

set_fracture_network()[source]

Create fracture network.

Note

Two horizontal fractures at y = 0.25 and y = 0.75 are included in the fracture network to force the grid to conform to certain regions of the domain. Note, however, that these fractures will not be part of the mixed-dimensional grid.

Return type

None

set_md_grid()[source]

Create mixed-dimensional grid. Ignore fractures 1 and 2.

Return type

None

fracture_network: FractureNetwork2d

Fracture network. Set in set_fracture_network().

params: dict

Simulation model parameters

class ModifiedSolutionStrategy(params)[source]

Bases: SolutionStrategySinglePhaseFlow

Parameters

params (dict) –

after_simulation()[source]

Method to be called after the simulation has finished

Return type

None

plot_results()[source]

Plotting results

Return type

None

darcy_flux: Callable[[list[pp.Grid]], pp.ad.Operator]
mdg: pp.MixedDimensionalGrid

Mixed-dimensional grid. Will normally be set by a mixin instance of ModelGeometry.

sol: StoreResults
solution: StoreResults

Solution object that stores exact and approximated solutions and errors

class StoreResults(setup)[source]

Bases: VerificationUtils

Class to store results.