porepy.numerics.fv.mpfa module
Implementation of the multi-point flux approximation O-method.
- class Mpfa(keyword)[source]
Bases:
FVElliptic
- Parameters
keyword (str) –
- discretize(sd, data)[source]
Discretize the second order elliptic equation using multi-point flux approximation.
The method computes fluxes over faces in terms of pressures defined at the cell centers.
We assume the following two sub-dictionaries to be present in the data dictionary:
- parameter_dictionary, storing all parameters.
Stored in data[pp.PARAMETERS][self.keyword].
- matrix_dictionary, for storage of discretization matrices.
Stored in data[pp.DISCRETIZATION_MATRICES][self.keyword]
- parameter_dictionary contains the entries:
- second_order_tensor: (SecondOrderTensor) Permeability defined
cell-wise. This is the effective permeability; any scaling of the permeability (such as with fracture apertures) should be included in the permeability.
bc: (BoundaryCondition) boundary conditions ambient_dimension: (int) Optional. Ambient dimension, used in the
discretization of vector source terms. Defaults to the dimension of the grid.
- mpfa_eta: (float/np.ndarray) Optional. Range [0, 1). Location of
pressure continuity point. If not given, porepy tries to set an optimal value.
- mpfa_inverter (str): Optional. Inverter to apply for local problems.
Can take values ‘numba’ (default), ‘cython’ or ‘python’.
- matrix_dictionary will be updated with the following entries:
- flux: sps.csc_matrix (sd.num_faces, sd.num_cells)
flux discretization, cell center contribution
- bound_flux: sps.csc_matrix (sd.num_faces, sd.num_faces)
flux discretization, face contribution
- bound_pressure_cell: sps.csc_matrix (sd.num_faces, sd.num_cells)
Operator for reconstructing the pressure trace. Cell center contribution
- bound_pressure_face: sps.csc_matrix (sd.num_faces, sd.num_faces)
Operator for reconstructing the pressure trace. Face contribution
- vector_source: sps.csc_matrix (sd.num_faces, sd.num_cells*dim)
Discretization of the flux due to vector source term, cell center contribution.
- ndof(sd)[source]
Return the number of degrees of freedom associated to the method. In this case number of cells (pressure dof).
- Parameters
sd (
pp.Grid
) – A grid.- Returns
the number of degrees of freedom.
- Return type
- update_discretization(sd, data)[source]
Update discretization.
- The updates can generally come as a combination of two forms:
The discretization on part of the grid should be recomputed.
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.
Information on the basis for the update should be stored in a field
data[‘update_discretization’]
This should be a dictionary which could contain keys:
modified_cells, modified_faces
define cells, faces and nodes that have been modified (either parameters, geometry or topology), and should be rediscretized. It is up to the discretization method to implement the change necessary by this modification. Note that depending on the computational stencil of the discretization method, a grid quantity may be rediscretized even if it is not marked as modified.
The dictionary data[‘update_discretization’] should further have keys:
cell_index_map, face_index_map
these should specify sparse matrices that maps old to new indices. If not provided, the cell and face bookkeeping will be assumed constant.
It is up to the caller to specify which parts of the grid to recompute, and how to update the numbering of degrees of freedom. If the discretization method does not provide a tailored implementation for update, it is not necessary to provide this information.
- Parameters
g (
pp.Grid
) – Grid to be rediscretized.data (
dictionary
) – With discretization parameters.sd (Grid) –
- Return type
None
- reconstruct_presssure(sd, subcell_topology, eta)[source]
Function for reconstructing the pressure at the half faces given the local gradients. For a subcell Ks associated with cell K and node s, the pressure at a point x is given by p_Ks + G_Ks (x - x_k), x_K is the cell center of cell k. The point at which we evaluate the pressure is given by eta, which is equivalent to the continuity points in mpfa. For an internal subface we will obtain two values for the pressure, one for each of the cells associated with the subface. The pressure given here is the average of the two. Note that at the continuity points the two pressures will by construction be equal.
- Parameters
sd (Grid) – Grid
subcell_topology – Wrapper class for numbering of subcell faces, cells etc.
eta (
float or ndarray, range=[0,1)
) – Optional. Parameter determining the point at which the pressures is evaluated. If eta is a nd-array it should be on the size of subcell_topology.num_subfno. If eta is not given the method will call fvutils.determine_eta(g) to set it.
- Returns
- pressure reconstruction for the displacement at the half faces. This is
the contribution from the cell-center pressures.
- scipy.sparse.csr_matrix (num_sub_faces, num_faces):
Pressure reconstruction for the pressures at the half faces. This is the contribution from the boundary conditions.
- Return type
scipy.sparse.csr_matrix (num_sub_faces, num_cells)