porepy.models.mass_and_energy_balance module
Combine single-physics models into coupled mass and energy balance equations.
- class BoundaryConditionsFluidMassAndEnergy[source]
Bases:
BoundaryConditionsEnergyBalance
,BoundaryConditionsSinglePhaseFlow
Combine fluid mass and energy balance boundary conditions.
- domain_boundary_sides: Callable[[pp.Grid], tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]]
Boundary sides of the domain. Normally defined in a mixin instance of
ModelGeometry
.
- class ConstitutiveLawFluidMassAndEnergy[source]
Bases:
FluidDensityFromPressureAndTemperature
,ConstantSolidDensity
,EnthalpyFromTemperature
,FouriersLaw
,ThermalConductivityLTE
,DimensionReduction
,AdvectiveFlux
,DarcysLaw
,FluidMobility
,ConstantPorosity
,ConstantPermeability
,ConstantViscosity
Combine fluid mass and energy balance constitutive laws.
Fluid density dependends on pressure and temperature in the mass and energy class, respectively. Here, both dependencies are included.
- fluid: pp.FluidConstants
Fluid constant object that takes care of scaling of fluid-related quantities. Normally, this is set by a mixin of instance
SolutionStrategy
.
- class EquationsFluidMassAndEnergy[source]
Bases:
EnergyBalanceEquations
,MassBalanceEquations
Combine fluid mass and energy balance equations.
- set_equations()[source]
Set the equations for the fluid mass and energy balance problem.
Call both parent classes’ set_equations methods.
- 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_enthalpy_flux: Callable[[list[pp.Grid]], pp.ad.Array]
Boundary condition for enthalpy flux. Normally defined in a mixin instance of
BoundaryConditionsEnergyBalance
.
- enthalpy_keyword: str
Keyword used to identify the enthalpy flux discretization. Normally set by a mixin instance of
SolutionStrategyEnergyBalance
.
- 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.
- fluid_enthalpy: Callable[[list[pp.Grid]], pp.ad.Operator]
Fluid enthalpy. Defined in a mixin class with a suitable constitutive relation.
- fourier_flux: Callable[[list[pp.Grid]], pp.ad.Operator]
Fourier flux. Normally provided by a mixin instance of
FouriersLaw
.
- 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_enthalpy_flux: Callable[[list[pp.MortarGrid]], pp.ad.MixedDimensionalVariable]
Variable for interface enthalpy flux. Normally provided by a mixin instance of
VariablesEnergyBalance
.
- interface_fourier_flux: Callable[[list[pp.MortarGrid]], pp.ad.MixedDimensionalVariable]
Fourier flux variable on interfaces. Normally defined in a mixin instance of
VariablesEnergyBalance
.
- 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
.
- 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.
- pressure: Callable[[list[pp.Grid]], pp.ad.MixedDimensionalVariable]
Pressure variable. Normally defined in a mixin instance of
VariablesSinglePhaseFlow
.
- solid_density: Callable[[list[pp.Grid]], pp.ad.Scalar]
Solid density. Defined in a mixin class with a suitable constitutive relation.
- solid_enthalpy: Callable[[list[pp.Grid]], pp.ad.Operator]
Solid enthalpy. Defined in a mixin class with a suitable constitutive relation.
- 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 MassAndEnergyBalance(params=None)[source]
Bases:
EquationsFluidMassAndEnergy
,VariablesFluidMassAndEnergy
,ConstitutiveLawFluidMassAndEnergy
,BoundaryConditionsFluidMassAndEnergy
,SolutionStrategyFluidMassAndEnergy
,ModelGeometry
,DataSavingMixin
Combine fluid mass and energy balance models into a single class.
The equations assume single-phase flow and local thermal equilibrium.
- Parameters
params (Optional[dict]) –
- enthalpy_keyword: str
Keyword used to identify the enthalpy flux discretization. Normally set by a mixin instance of
SolutionStrategyEnergyBalance
.
- equation_system: pp.ad.EquationSystem
EquationSystem object for the current model. Normally defined in a mixin class defining the solution strategy.
- 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
.
- time_manager: pp.TimeManager
Time manager. Normally set by a mixin instance of
porepy.models.solution_strategy.SolutionStrategy
.
- class SolutionStrategyFluidMassAndEnergy(params=None)[source]
Bases:
SolutionStrategyEnergyBalance
,SolutionStrategySinglePhaseFlow
Combine fluid mass and energy balance solution strategies.
Solution strategies are proper classes (not mixins) and inherit from
SolutionStrategy
. Thus, overridden methods call super() by default and explicitly calling both parent classes’ methods is not necessary.- Parameters
params (Optional[dict]) –
- bc_type_enthalpy: Callable[[pp.Grid], pp.BoundaryCondition]
Function that returns the boundary condition type for the enthalpy flux. Normally defined in a mixin instance of
BoundaryConditionsEnergyBalance
.
- bc_type_fourier: Callable[[pp.Grid], pp.BoundaryCondition]
Function that returns the boundary condition type for the Fourier flux. Normally defined in a mixin instance of
BoundaryConditionsEnergyBalance
.
- create_variables: Callable[[], None]
Create variables. Normally provided by a mixin instance of a Variable class relevant to the model.
- domain_bounds: dict
Bounding box of the domain. Will normally be set by a mixin instance of
ModelGeometry
.
- enthalpy_keyword: str
Keyword for enthalpy flux term.
Used to access discretization parameters and store discretization matrices.
- equation_system: pp.ad.EquationSystem
Equation system manager. Will be set by
set_equation_system_manager()
.
- exporter: pp.Exporter
Exporter for visualization.
- finalize_data_saving: Callable[[], None]
Finalize data saving. Normally provided by a mixin instance of
DataSavingMixin
.
- fluid: pp.FluidConstants
Fluid constants. See also
set_materials()
.
- fourier_keyword: str
Keyword for Fourier flux term.
Used to access discretization parameters and store discretization matrices.
- initialize_data_saving: Callable[[], None]
Initialize data saving. Normally provided by a mixin instance of
DataSavingMixin
.
- interface_enthalpy_flux_variable: str
Name of the primary variable representing the enthalpy flux on the interface.
- interface_fourier_flux_variable: str
Name of the primary variable representing the Fourier flux on the interface.
- linear_system: tuple[sps.spmatrix, np.ndarray]
The linear system to be solved in each iteration of the non-linear solver. The tuple contains the sparse matrix and the right hand side residual vector.
- mdg: pp.MixedDimensionalGrid
Mixed-dimensional grid. Will normally be set by a mixin instance of
ModelGeometry
.
- nd: int
Ambient dimension of the problem. Normally set by a mixin instance of
porepy.models.geometry.ModelGeometry
.
- save_data_time_step: Callable[[], None]
Save data at a time step. Normally provided by a mixin instance of
DataSavingMixin
.
- set_equations: Callable[[], None]
Set the governing equations of the model. Normally provided by the solution strategy of a specific model (i.e. a subclass of this class).
- set_geometry: Callable[[], None]
Set the geometry of the model. Normally provided by a mixin instance of
ModelGeometry
.
- solid: pp.SolidConstants
Solid constants. See also
set_materials()
.
- 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
.
- thermal_conductivity: Callable[[list[pp.Grid]], np.ndarray]
Thermal conductivity. Normally defined in a mixin instance of
ThermalConductivityLTE
or a subclass.
- units: pp.Units
Units of the model. See also
set_units()
.
- class VariablesFluidMassAndEnergy[source]
Bases:
VariablesEnergyBalance
,VariablesSinglePhaseFlow
Combine fluid mass and energy balance variables.
- create_variables()[source]
Set the variables for the fluid mass and energy balance problem.
Call both parent classes’ set_variables methods.
- Return type
None
- equation_system: EquationSystem
EquationSystem object for the current model. Normally defined in a mixin class defining the solution strategy.
- fluid: FluidConstants
Fluid constant object that takes care of scaling of fluid-related quantities. Normally, this is set by a mixin of instance
SolutionStrategy
.
- interface_enthalpy_flux_variable: str
Name of the primary variable representing the enthalpy flux across an interface. Normally defined in a mixin of instance
SolutionStrategyEnergyBalance
.
- interface_fourier_flux_variable: str
Name of the primary variable representing the Fourier flux across an interface. Normally defined in a mixin of instance
SolutionStrategyEnergyBalance
.
- mdg: MixedDimensionalGrid
Mixed dimensional grid for the current model. Normally defined in a mixin instance of
ModelGeometry
.
- solid: SolidConstants
Solid constant object that takes care of scaling of solid-related quantities. Normally, this is set by a mixin of instance
SolutionStrategy
.
- temperature_variable: str
Name of the primary variable representing the temperature. Normally defined in a mixin of instance
SolutionStrategyEnergyBalance
.