porepy.models.thm_model module

This is a setup class for solving the THM equations with contact mechanics at the fractures, if present.

We build on two other model classes: The class ContactMechanicsBiot inherits from ContactMechanics, which is a model for the purely mechanical problem with contact conditions on the fractures, and ContactMechanicsBiot, where the displacement solution is coupled to a scalar variable, e.g. pressure (Biot equations) or temperature.

Here, we expand to two scalar variables. The “scalar_variable” used in ContactMechanicsBiot is assumed to be the pressure, and the Biot discretization is applied to this. Then the discretizations are copied for the TM coupling, and TH coupling discretizations are provided. Note that the energy balance equation is divided by T_0 (in Kelvin!) to make the HM and TM coupling terms as similar as possible. Parameters, variables and discretizations are set in the model class, and the problem may be solved using run_biot.

In addition, the discretization yields a stabilization term for each of the scalar equations.

Equation scaling: For monolithic solution of coupled systems, the condition number of the global matrix may become a severe restriction. To alleviate this, the model is set up with three scaling parameters. length_scaling allows solving on a unit size domain, and result interpretation on e.g. a kilometer scale. pressure_scale and temperature_scale may be used to solve for scaled pressure (p_scaled = p_physical/pressure_scale) and temperature. For typical reservoir conditions, choosing a large (e.g. 1e6) pressure_scale is a good place to start.

class THM(params=None)[source]

Bases: ContactMechanicsBiot

This is a shell class for poroelastic contact mechanics problems.

Setting up such problems requires a lot of boilerplate definitions of variables, parameters and discretizations. This class is intended to provide a standardized setup, with all discretizations in place and reasonable parameter and boundary values. The intended use is to inherit from this class, and do the necessary modifications and specifications for the problem to be fully defined. The minimal adjustment needed is to specify the method create_grid().

Parameters

params (Optional[Dict]) –

time_manager

Time-stepping control manager.

displacement_variable

Name assigned to the displacement variable in the highest-dimensional subdomain. Will be used throughout the simulations, including in ParaView export.

Type

str

mortar_displacement_variable

Name assigned to the displacement variable on the fracture walls. Will be used throughout the simulations, including in ParaView export.

Type

str

contact_traction_variable

Name assigned to the variable for contact forces in the fracture. Will be used throughout the simulations, including in ParaView export.

Type

str

scalar_variable

Name assigned to the pressure variable. Will be used throughout the simulations, including in ParaView export.

Type

str

temperature_variable

Name assigned to the temperature variable. Will be used throughout the simulations, including in ParaView export.

Type

str

mortar scalar_variable

Name assigned to the interface scalar variable representing flux between subdomains. Will be used throughout the simulations, including in ParaView export.

Type

str

mechanics_parameter_key

Keyword used to define parameters and discretizations for the mechanics problem.

Type

str

scalar_parameter_key

Keyword used to define parameters and discretizations for the flow problem.

Type

str

temperature_parameter_key

Keyword used to define parameters and discretizations for the temperature problem.

Type

str

mechanics_temperature_parameter_key

Keyword used to define parameters and discretizations for the coupling between temperature and mechanics.

Type

str

params

Dictionary of parameters used to control the solution procedure.

Type

dict

viz_folder_name

Folder for visualization export.

Type

str

mdg

Mixed-dimensional grid. Should be set by a method create_grid which should be provided by the user.

Type

pp.MixedDimensionalGrid

convergence_status

Whether the non-linear iterations have converged.

Type

bool

linear_solver

Specification of linear solver. Only known permissible value is ‘direct’

Type

str

scalar_scale

Scaling coefficient for the pressure variable. Can be used to get comparable size of the mechanical and flow problem.

Type

float

scalar_scale

Scaling coefficient for the vector variable. Can be used to get comparable size of the mechanical and flow problem.

Type

float

temperature_scale

Scaling coefficient for the temperature variable. Can be used to get comparable size of the mechanical and flow problem. NOTE: This has not been properly tested, assign unit value to stay safe.

Type

float

Except from the grid, all attributes are given natural values at initialization of the class.

before_newton_iteration()[source]

Re-discretize the nonlinear terms

Return type

None

compute_fluxes()[source]

Compute the fluxes in the mixed-dimensional grid from the current state of the pressure variables.

Return type

None

reconstruct_stress(previous_iterate=False)[source]

Compute the stress in the highest-dimensional grid based on the displacement pressure and temperature states in that grid, adjacent interfaces and global boundary conditions.

The stress is stored in the data dictionary of the highest dimensional grid, in [pp.STATE][‘stress’].

Parameters

previous_iterate (boolean, optional) – If True, use values from previous iteration to compute the stress. Defaults to False.

Return type

None

class THMAdObjects[source]

Bases: ContactMechanicsBiotAdObjects

Storage class for ad related objects.

Stored objects include variables, compound ad operators and projections.

advective_interface_flux: Variable
conductive_interface_flux: Variable
heat_conduction_discretization: Union[MpfaAd, TpfaAd]
temperature: Variable