porepy.models.verification_setups.manu_flow_comp_frac module
This module contains a code verification implementation for a manufactured solution for the two-dimensional, compressible, single phase flow with a single, fully embedded vertical fracture in the middle of the domain.
The exact solution was obtained by extending the solution from the incompressible case, see https://doi.org/10.1515/jnma-2022-0038
TODO: Explain what are the modifications w.r.t. the incompressible case. FIXME: There is significant code duplication with the incompressible verification.
Consider recycling classes.
- class ExactSolution[source]
Bases:
object
Parent class for the exact solution.
- fracture_darcy_flux(sd_frac, time)[source]
Evaluate exact fracture Darcy flux at the face centers.
- Parameters
- Returns
Array of
shape=(sd_frac.num_faces, )
containing the exact Darcy fluxes at the face centers at the giventime
.- Return type
Note
The returned fluxes are already scaled with
sd_face.face_normals
.
- interface_darcy_flux(intf, time)[source]
Compute exact mortar fluxes at the interface.
- Parameters
intf (MortarGrid) – Mortar grid.
time (float) – time in seconds.
- Returns
Array of
shape=(intf.num_cells, )
containing the exact mortar fluxes at the giventime
.- Return type
Note
The returned mortar fluxes are already scaled with
intf.cell_volumes
.
- interface_mass_flux(intf, time)[source]
- Parameters
intf (MortarGrid) –
time (float) –
- Return type
- rock_darcy_flux(sd_rock, time)[source]
Evaluate exact rock Darcy flux [m^3 * s^-1] at the face centers .
- Parameters
- Returns
Array of
shape=(sd_rock.num_faces, )
containing the exact Darcy fluxes at the face centers at the giventime
.- Return type
Note
The returned fluxes are already scaled with
sd_rock.face_normals
.
- rock_density(sd_rock, time)[source]
Evaluate exact fluid density [kg * m^-3] in the rock at the cell centers.
- rock_mass_flux(sd_rock, time)[source]
Evaluate exact mass flux [kg * s^-1] at the face centers.
- Parameters
- Returns
Array of
shape=(sd_rock.num_faces, )
containing the exact mass fluxes at the face centers for the giventime
.- Return type
Note
The returned mass fluxes are already scaled with
sd_rock.face_normals
.
- class ManufacturedCompFlow2d(params)[source]
Bases:
ModifiedGeometry
,ModifiedBoundaryConditions
,ModifiedBalanceEquation
,ModifiedSolutionStrategy
,SinglePhaseFlow
Mixer class for the verification setup.
Examples
# Import modules import porepy as pp from time import time # Run verification setup tic = time() params = {"plot_results": True} setup = ManufacturedCompFlow2d(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) –
- 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
- 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_values_darcy(subdomains)[source]
- Parameters
subdomains (list[porepy.grids.grid.Grid]) –
- Return type
- bc_values_mobrho(subdomains)[source]
- Parameters
subdomains (list[porepy.grids.grid.Grid]) –
- Return type
- 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.
- mdg: MixedDimensionalGrid
Mixed-dimensional grid object.
- time_manager: TimeManager
Properly initialized time manager object.
- class ModifiedGeometry[source]
Bases:
ModelGeometry
Generate fracture network and mixed-dimensional grid.
- 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
- class ModifiedSolutionStrategy(params)[source]
Bases:
SolutionStrategySinglePhaseFlow
- Parameters
params (dict) –
- after_nonlinear_convergence(solution, errors, iteration_counter)[source]
Method to be called after convergence
- before_nonlinear_loop()[source]
Update values of external sources and boundary conditions
- Return type
None
- exact_sol
Exact solution object
- fluid: pp.FluidConstants
Fluid constants. See also
set_materials()
.
- mdg: pp.MixedDimensionalGrid
Mixed-dimensional grid. Will normally be set by a mixin instance of
ModelGeometry
.
- results: list[StoreResults]
Object that stores exact and approximated solutions and L2 errors
- class StoreResults(setup)[source]
Bases:
VerificationUtils
Class to store results.