porepy.numerics.ad.discretizations module
For any discretization class compatible with PorePy, wrap_discretization associates a discretization with all attributes of the class’ attributes that end with ‘_matrix_key’.
Example
# Generate grid >>> g = pp.CartGrid([2, 2]) # Associate an Ad representation of an Mpfa method, aimed this grid >>> discr = MpfaAd(keyword=’flow’, grids=[g]) # The flux discretization of Mpfa can now be accesed by >>> discr.flux # While the discretization of boundary conditions is available by >>> discr.bound_flux.
The representation of different discretization objects can be combined with other Ad objects into an operator tree, using lazy evaluation.
It is assumed that the actual action of discretization (creation of the discretization matrices) is performed before the operator tree is parsed.
- class BiotAd(keyword, subdomains, flow_keyword='flow')[source]
Bases:
Discretization
Ad wrapper around the Biot discretization class.
For description of the method, we refer to the standard Biot class.
- class BiotStabilizationAd(keyword, subdomains)[source]
Bases:
Discretization
- Parameters
keyword (str) –
subdomains (List[pp.Grid]) –
- class ColoumbContactAd(keyword, interfaces)[source]
Bases:
Discretization
- Parameters
keyword (str) –
interfaces (List[pp.MortarGrid]) –
- class ContactTractionAd(keyword, interfaces, low_dim_subdomains)[source]
Bases:
Discretization
- Parameters
keyword (str) –
interfaces (List[pp.MortarGrid]) –
low_dim_subdomains (List[pp.Grid]) –
- class DifferentiableFVAd(subdomains, mdg, base_discr, system_manager, permeability_function, permeability_argument, potential, keyword)[source]
Bases:
object
This class represents the application of the product and chain rule of the flux expression
q = T(k(u)) * p
Where the transmissibility matrix T is a function of the cell permeability k, which again is a function of a primary variable u, while p is the potential (pressure). The chain rule applied to this expression reads
dq = p * dT/dk * dk/du * du + T * dp
The transmissibility matrix can be computed from a Tpfa or Mpfa discretization, or (in principle) any other finite volume method. The derivative of the transmissibilities, dT/dk, is approximated with a two-point flux stencil.
If vector sources are included, p should be replaced by (p - dist * vector_source), with dist the distance roughly corresponding to the inverse of the gradient.
- Parameters
subdomains (List[pp.Grid]) –
mdg (pp.MixedDimensionalGrid) –
base_discr (Union[pp.ad.MpfaAd, pp.ad.TpfaAd]) –
system_manager (pp.ad.EquationSystem) –
permeability_function (Callable[[pp.ad.Variable], pp.ad.Ad_array]) –
permeability_argument (pp.ad.Variable) –
potential (pp.ad.Variable) –
keyword (str) –
- class Discretization[source]
Bases:
ABC
General/utility methods for AD discretization classes.
The init of the children classes below typically calls wrap_discretization and has arguments including subdomains or interfaces and keywords for parameter and possibly matrix storage.
- class DivUAd(keyword, subdomains, mat_dict_keyword)[source]
Bases:
Discretization
- class GradPAd(keyword, subdomains)[source]
Bases:
Discretization
- Parameters
keyword (str) –
subdomains (List[pp.Grid]) –
- class MassMatrixAd(keyword, subdomains)[source]
Bases:
Discretization
- Parameters
keyword (str) –
subdomains (List[pp.Grid]) –
- class MpfaAd(keyword, subdomains)[source]
Bases:
Discretization
- Parameters
keyword (str) –
subdomains (List[pp.Grid]) –
- class MpsaAd(keyword, subdomains)[source]
Bases:
Discretization
- Parameters
keyword (str) –
subdomains (List[pp.Grid]) –
- class RobinCouplingAd(keyword, interfaces)[source]
Bases:
Discretization
- Parameters
keyword (str) –
interfaces (List[pp.MortarGrid]) –
- class TpfaAd(keyword, subdomains)[source]
Bases:
Discretization
- Parameters
keyword (str) –
subdomains (List[pp.Grid]) –
- class UpwindAd(keyword, subdomains)[source]
Bases:
Discretization
- Parameters
keyword (str) –
subdomains (List[pp.Grid]) –
- class UpwindCouplingAd(keyword, interfaces)[source]
Bases:
Discretization
- Parameters
keyword (str) –
interfaces (List[pp.MortarGrid]) –
- class WellCouplingAd(keyword, interfaces)[source]
Bases:
Discretization
- Parameters
keyword (str) –
interfaces (List[pp.MortarGrid]) –