porepy.numerics.interface_laws.abstract_interface_law module

Mother class for all interface laws.

class AbstractInterfaceLaw(keyword)[source]

Bases: ABC

Partial implementation of an interface (between two grids) law. Any full interface law must implement the missing functions.

Parameters

keyword (str) –

keyword

Used to identify the right parameter dictionary from the full data dictionary of this grid.

Type

str

intf_coupling_via_high_dim

If True, assembly will allow for a direct coupling between different interfaces. The class must then implement the function assemble_intf_coupling_via_high_dim().

Type

boolean

intf_coupling_via_low_dim

If True, assembly will allow for a direct coupling between different interfaces. The class must then implement the function assemble_intf_coupling_via_low_dim().

Type

boolean

assemble_intf_coupling_via_high_dim(g_between, data_between, intf_primary, sd_pair_primary, data_intf_primary, intf_secondary, sd_pair_secondary, data_intf_secondary, matrix, assemble_matrix=True, assemble_rhs=True)[source]

Method to assemble the contribution from one interface to another one.

The method must be implemented for subclasses of AbstractInterfaceLaw which has the attribute intf_coupling_via_high_dim set to True. For classes where the variable is False, there is no need for action.

Note that the mixed-dimensional modeling framework does not allow for direct couplings between interfaces. However, there may be cases where an interface law is dependent on variables on the boundary between the higher dimensional grid and another interface. As we normally associate these boundary values with the variable on the secondary interface, this method is available as an alternative.

For more details on how this function is invoked see pp.Assembler. Note that the coupling currently only can be invoked if the variables on the primary and secondary interface have the same name.

Any discretization operation should be done as part of self.discretize().

Parameters
  • g_between (pp.Grid) – Grid of the higher dimensional neighbor to the main interface

  • data_between (dict) – Data dictionary of the intermediate grid.

  • intf_primary (tuple of grids) – The grids of the primary interface

  • data_intf_primary (dict) – Data dictionary of the primary interface.

  • intf_secondary (tuple of grids) – The grids of the secondary interface.

  • data_intf_secondary (dict) – Data dictionary of the secondary interface.

  • matrix (ndarray) – original discretization.

  • assemble_matrix (optional) – If True (defalut), contributions to local matrix are assembled.

  • assemble_rhs (optional) – If True (defalut), contributions to local rhs are assembled.

  • sd_pair_primary (Tuple[Grid, Grid]) –

  • sd_pair_secondary (Tuple[Grid, Grid]) –

Returns

Block matrix of size 3 x 3, whwere each block represents

coupling between variables on this interface. Index 0, 1 and 2 represent the primary grid, the primary and secondary interface, respectively.

np.array: Block matrix of size 3 x 1, representing the right hand

side of this coupling. Index 0, 1 and 2 represent the primary grid, the primary and secondary interface, respectively.

Return type

np.array

assemble_intf_coupling_via_low_dim(g_between, data_between, intf_primary, sd_pair_primary, data_intf_primary, intf_secondary, sd_pair_secondary, data_intf_secondary, matrix, assemble_matrix=True, assemble_rhs=True)[source]

Method to assemble the contribution from one interface to another one.

The method must be implemented for subclasses of AbstractInterfaceLaw which has the attribute intf_coupling_via_low_dim set to True. For classes where the variable is False, there is no need for action.

Note that the mixed-dimensional modeling framework does not allow for direct couplings between interfaces. However, there may be cases where an interface law is dependent on variables on the boundary between the lower-dimensional grid and another interface. As we normally associate these boundary values with the variable on the secondary interface, this method is available as an alternative.

For more details on how this function is invoked see pp.Assembler. Note that the coupling currently only can be invoked if the variables on the primary and secondary interface have the same name.

Any discretization operation should be done as part of self.discretize().

Parameters
  • g_between (pp.Grid) – Grid of the lower-dimensional neighbor to the main interface

  • data_between (dict) – Data dictionary of the intermediate grid.

  • intf_primary (tuple of grids) – The grids of the primary interface

  • data_intf_primary (dict) – Data dictionary of the primary interface.

  • intf_secondary (tuple of grids) – The grids of the secondary interface.

  • data_intf_secondary (dict) – Data dictionary of the secondary interface.

  • matrix (ndarray) – original discretization.

  • assemble_matrix (optional) – If True (defalut), contributions to local matrix are assembled.

  • assemble_rhs (optional) – If True (defalut), contributions to local rhs are assembled.

  • sd_pair_primary (Tuple[Grid, Grid]) –

  • sd_pair_secondary (Tuple[Grid, Grid]) –

Returns

Block matrix of size 3 x 3, whwere each block represents

coupling between variables on this interface. Index 0, 1 and 2 represent the primary, secondary and mortar variable, respectively.

np.array: Block matrix of size 3 x 1, representing the right hand

side of this coupling. Index 0, 1 and 2 represent the primary, secondary and mortar variable, respectively.

Return type

np.array

assemble_matrix(sd_primary, sd_secondary, intf, data_primary, data_secondary, data_intf, matrix)[source]

Assemble the dicretization of the interface law, and its impact on the neighboring domains.

The default implementation will assemble both the discretization matrix and the right hand side vector, and return only the former. This behavior is overridden by some discretization methods.

Parameters
  • sd_primary (Grid) – Grid on one neighboring subdomain.

  • sd_secondary (Grid) – Grid on the other neighboring subdomain.

  • data_primary (Dict) – Data dictionary for the primary suddomain

  • data_secondary (Dict) – Data dictionary for the secondary subdomain.

  • data_intf (Dict) – Data dictionary for the interface between the subdomains

  • matrix_primary – original discretization for the primary subdomain

  • intf (MortarGrid) –

  • matrix (ndarray) –

Returns

Block matrix of size 3 x 3, whwere each block represents

coupling between variables on this interface. Index 0, 1 and 2 represent the primary, secondary and mortar variable, respectively.

Return type

np.array

abstract assemble_matrix_rhs(sd_primary, sd_secondary, intf, data_primary, data_secondary, data_intf, matrix)[source]

Assemble the dicretization of the interface law, and its impact on the neighboring domains.

The matrix will be

Parameters
  • sd_primary (Grid) – Grid on one neighboring subdomain.

  • sd_secondary (Grid) – Grid on the other neighboring subdomain.

  • data_primary (Dict) – Data dictionary for the primary suddomain

  • data_secondary (Dict) – Data dictionary for the secondary subdomain.

  • data_intf (Dict) – Data dictionary for the interface between the subdomains

  • matrix_primary – original discretization for the primary subdomain

  • intf (MortarGrid) –

  • matrix (ndarray) –

Returns

Block matrix of size 3 x 3, whwere each block represents

coupling between variables on this interface. Index 0, 1 and 2 represent the primary, secondary and mortar variable, respectively.

np.array: Block matrix of size 3 x 1, representing the right hand

side of this coupling. Index 0, 1 and 2 represent the primary, secondary and mortar variable, respectively.

Return type

np.array

assemble_rhs(sd_primary, sd_secondary, intf, data_primary, data_secondary, data_intf, matrix)[source]

Assemble the dicretization of the interface law, and its impact on the neighboring domains.

The default implementation will assemble both the discretization matrix and the right hand side vector, and return only the latter. This behavior is overridden by some discretization methods.

Parameters
  • sd_primary (Grid) – Grid on one neighboring subdomain.

  • sd_secondary (Grid) – Grid on the other neighboring subdomain.

  • data_primary (Dict) – Data dictionary for the primary suddomain

  • data_secondary (Dict) – Data dictionary for the secondary subdomain.

  • data_intf (Dict) – Data dictionary for the interface between the subdomains

  • matrix_primary – original discretization for the primary subdomain

  • intf (MortarGrid) –

  • matrix (ndarray) –

Returns

Block matrix of size 3 x 3, whwere each block represents

coupling between variables on this interface. Index 0, 1 and 2 represent the primary, secondary and mortar variable, respectively.

Return type

np.array

abstract discretize(sd_primary, sd_secondary, intf, data_primary, data_secondary, data_intf)[source]

Discretize the interface law and store the discretization in the interface data.

The discretization matrix will be stored in the data dictionary of this interface.

Parameters
  • sd_primary (Grid) – Grid of the primary domanin.

  • sd_secondary (Grid) – Grid of the secondary domain.

  • data_primary (Dict) – Data dictionary for the primary domain.

  • data_secondary (Dict) – Data dictionary for the secondary domain.

  • data_intf (Dict) – Data dictionary for the interface between the domains.

  • intf (MortarGrid) –

Return type

None

abstract ndof(mg)[source]

Get the number of degrees of freedom of this interface law for a given mortar grid.

Parameters

mg (pp.MortarGrid) – Mortar grid of an interface.

Returns

Number of degrees of freedom.

Return type

int

update_discretization(sd_primary, sd_secondary, intf, data_primary, data_secondary, data_intf)[source]

Partial update of discretization.

Intended use is when the discretization should be updated, e.g. because of changes in parameters, grid geometry or grid topology, and it is not desirable to recompute the discretization on the entire grid. A typical case will be when the discretization operation is costly, and only a minor update is necessary.

The updates can generally come as a combination of two forms:
  1. The discretization on part of the grid should be recomputed.

  2. The old discretization can be used (in parts of the grid), but the numbering of unknowns has changed, and the discretization should be reorder accordingly.

By default, this method will simply forward the call to the standard discretize method. Discretization methods that wants a tailored approach should override the standard implementation.

Parameters
  • sd_primary (Grid) – Grid of the primary domanin.

  • sd_secondary (Grid) – Grid of the secondary domain.

  • data_primary (Dict) – Data dictionary for the primary domain.

  • data_secondary (Dict) – Data dictionary for the secondary domain.

  • data_intf (Dict) – Data dictionary for the interface between the domains.

  • intf (MortarGrid) –

Return type

None