porepy.models.verification_setups.manu_poromech_nofrac module
This module contains an implementation of a verification setup for a poromechanical system (without fractures) using a two-dimensional manufactured solution.
For the exact solution, we refer to https://doi.org/10.1137/15M1014280.
- class ExactSolution(setup)[source]
Bases:
object
Parent class for the manufactured poromechanical solution.
- darcy_flux(sd, time)[source]
Evaluate exact Darcy flux [m^3 * s^-1] at the face centers.
- Parameters
- Returns
Array of
shape=(sd.num_faces, )
containing the exact Darcy fluxes at the face centers for the giventime
.- Return type
Note
The returned fluxes are already scaled with
sd.face_normals
.
- displacement(sd, time)[source]
Evaluate exact displacement [m] at the cell centers.
- Parameters
- Returns
Array of
shape=(2 * sd.num_cells, )
containing the exact displacements at the cell centers for the giventime
.- Return type
Notes
The returned displacement is given in PorePy’s flattened vector format.
- mechanics_source(sd, time)[source]
Compute exact source term for the momentum balance equation.
- Parameters
- Returns
Exact right hand side of the momentum balance equation with
shape=( 2 * sd.num_cells, )
.- Return type
Notes
The returned array is given in PorePy’s flattened vector format.
- poroelastic_force(sd, time)[source]
Evaluate exact poroelastic force [N] at the face centers.
- Parameters
- Returns
Array of
shape=(2 * sd.num_faces, )
containing the exact poroealstic force at the face centers for the giventime
.- Return type
Notes
The returned poroelastic force is given in PorePy’s flattened vector format.
Recall that force = (stress dot unit_normal) * face_area.
- class ManuPoromechanics2d(params)[source]
Bases:
UnitSquare
,ModifiedEquationsPoromechanics
,ModifiedSolutionStrategy
,Poromechanics
Mixer class for the verification setup.
Examples
from time import time
tic = time() fluid = pp.FluidConstants({“compressibility”: 0.02}) solid = pp.SolidConstants({“biot_coefficient”: 0.50}) material_constants = {“fluid”: fluid, “solid”: solid} params = {
“plot_results”: True, “time_manager”: pp.TimeManager([0, 0.2, 0.4, 0.6, 0.8, 1], 0.2, True), “material_constants”: material_constants, “manufactured_solution”: “nordbotten_2016”
} setup = ManuPoromechanics2d(params) print(“Simulation started…”) pp.run_time_dependent_model(setup, params) toc = time() print(f”Simulation finished in {round(toc - tic)} seconds.”)
- Parameters
params (dict) –
- fracture_network: pp.FractureNetwork2d
Fracture network. Empty in this case.
- class ModifiedEquationsPoromechanics[source]
Bases:
ModifiedMassBalance
,ModifiedMomentumBalance
- 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 ModifiedMassBalance[source]
Bases:
MassBalanceEquations
Modify balance equation to account for external sources.
- fluid_source(subdomains)[source]
Fluid source.
- Parameters
subdomains (list[porepy.grids.grid.Grid]) –
- Return type
- 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 ModifiedMomentumBalance[source]
Bases:
MomentumBalanceEquations
- body_force(subdomains)[source]
Mechanics source term.
- Parameters
subdomains (list[porepy.grids.grid.Grid]) –
- Return type
- 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
.
- contact_mechanics_numerical_constant: Callable[[list[pp.Grid]], pp.ad.Scalar]
Numerical constant for contact mechanics. Normally provided by a mixin instance of
SolutionStrategyMomentumBalance
.
- contact_traction: Callable[[list[pp.Grid]], pp.ad.MixedDimensionalVariable]
Contact traction variable. Normally defined in a mixin instance of
VariablesMomentumBalance
.
- displacement_jump: Callable[[list[pp.Grid]], pp.ad.Operator]
Operator giving the displacement jump on fracture grids. Normally defined in a mixin instance of
ModelGeometry
.
- fracture_stress: Callable[[list[pp.MortarGrid]], pp.ad.Operator]
Stress on the fracture faces. Provided by a suitable mixin class that specifies the physical laws governing the stress, see for instance
LinearElasticMechanicalStress
orPressureStress
.
- friction_bound: Callable[[list[pp.Grid]], pp.ad.Operator]
Friction bound of a fracture. Normally provided by a mixin instance of
FrictionBound
.
- gap: Callable[[list[pp.Grid]], pp.ad.Operator]
Gap of a fracture. Normally provided by a mixin instance of
FracturedSolid
.
- 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
.
- internal_boundary_normal_to_outwards: Callable[[list[pp.Grid], int], pp.ad.Matrix]
Switch interface normal vectors to point outwards from the subdomain. Normally set by a mixin instance of
porepy.models.geometry.ModelGeometry
.
- mdg: pp.MixedDimensionalGrid
Mixed dimensional grid for the current model. Normally defined in a mixin instance of
ModelGeometry
.
- nd: int
Ambient dimension of the problem. Normally set by a mixin instance of
porepy.models.geometry.ModelGeometry
.
- normal_component: Callable[[list[pp.Grid]], pp.ad.Matrix]
Operator giving the normal component of vectors. Normally defined in a mixin instance of
ModelGeometry
.
- 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
.
- stress: Callable[[list[pp.Grid]], pp.ad.Operator]
Stress on the grid faces. Provided by a suitable mixin class that specifies the physical laws governing the stress.
- tangential_component: Callable[[list[pp.Grid]], pp.ad.Matrix]
Operator giving the tangential component of vectors. 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 ModifiedSolutionStrategy(params)[source]
Bases:
SolutionStrategyPoromechanics
Solution strategy for the verification setup.
- Parameters
params (dict) –
- after_nonlinear_convergence(solution, errors, iteration_counter)[source]
Method to be called after the non-linear solver has converged.
- set_materials()[source]
Set material parameters.
Add exact solution object to the simulation model after materials have been set.
- exact_sol: ExactSolution
Exact solution object
- fluid: pp.FluidConstants
Fluid constants. See also
set_materials()
.
- mdg: pp.MixedDimensionalGrid
Mixed dimensional grid.
- results: list[StoreResults]
Object that stores exact and approximated solutions and L2 errors
- class StoreResults(setup)[source]
Bases:
VerificationUtils
Class for storing results.
- class UnitSquare[source]
Bases:
ModelGeometry
Class for setting up the geometry of the unit square domain.
- fracture_network: FractureNetwork2d
Fracture network. Empty in this case.