pygeon.discretizations.fvm.fvm_disc module
Module for base finite volume discretization classes.
- class pygeon.discretizations.fvm.fvm_disc.FiniteVolumeDiscretization(keyword='unitary_data')[source]
Bases:
ABCAbstract class for PyGeoN finite volume discretization methods.
- __init__(keyword='unitary_data')[source]
Initialize the FiniteVolumeDiscretization object.
- Parameters:
keyword (str) – The keyword used to identify the discretization method. Default is pg.UNITARY_DATA.
- Returns:
None
- ndof(sd)[source]
Returns the number of degrees of freedom on a given grid.
- Parameters:
sd (pg.Grid) – The grid object.
- Returns:
The number of degrees of freedom.
- Return type:
- assemble_system_matrix(sd, data=None)[source]
Assemble the system matrix, using the material parameters in the data dictionary
- Parameters:
sd (pg.Grid) – Grid, or a subclass.
data (dict) – The data dictionary.
- Returns:
The discretization matrix.
- Return type:
sps.csc_array
- div(sd)[source]
Assembles the block-diagonal divergence operator acting on all the face-based dual variables.
- Parameters:
sd (pg.Grid) – The grid object.
- Returns:
The divergence operator
- Return type:
sps.csc_array
- face_area_scaling(sd)[source]
Assembles the scaling vector with the face areas, for the face-based dual variables.
- Parameters:
sd (pg.Grid) – The grid object.
- Returns:
The scaling vector
- Return type:
np.ndarray
- check_nonnegative_weights(weight)[source]
Check whether all weighted distances are nonnegative.
- Parameters:
weight (np.ndarray) – The physical parameter weights.
- compute_harmonic_avg(faces, dists)[source]
Compute $(1 / delta_i + 1 / delta_j)^{-1}$ at each face, between cells i and j. This is used to compute the effective permeability at the face.
- Parameters:
faces (np.ndarray) – The extended array of faces.
dists (np.ndarray) – The extended array of weighted distances.
- Returns:
The face-wise harmonic averages.
- Return type:
np.ndarray
- get_bcs_from_data(sd, data)[source]
Extracts the FiniteVolumeBC object from the data dictionary, if it exists. Else, it creates a new one and inserts it in data.
- Parameters:
sd (pg.Grid) – The grid object.
data (dict) – The data dictionary
- Returns:
The boundary condition object
- Return type:
pg.FiniteVolumeBC
- assemble_rhs_boundary_vector(sd, data=None)[source]
Assembles the right-hand side vector related to the boundary conditions.
- Parameters:
sd (pg.Grid) – The grid object.
data (dict) – The data dictionary
- Returns:
The right-hand side vector
- Return type:
np.ndarray
- abstractmethod ndof_per_cell(sd)[source]
Returns the number of degrees of freedom per cell.
- Parameters:
sd (pg.Grid) – The grid object.
- Returns:
The number of degrees of freedom per cell.
- Return type:
- abstractmethod assemble_dual_var_map(sd, data)[source]
Assemble the mapping from cell-based primary variables to face-based dual variables.
- Parameters:
sd (pg.Grid) – Grid, or a subclass.
data (dict) – The data dictionary
- Returns:
The matrix mapping primary to dual variables
- Return type:
sps.csc_array
- abstractmethod assemble_accumulation_terms(sd, data)[source]
Assemble the zeroth-order terms for the primary variables.
- Parameters:
sd (pg.Grid) – Grid, or a subclass.
data (dict) – The data dictionary
- Returns:
The diagonal mass matrix
- Return type:
sps.csc_array
- abstractmethod assemble_bdry_dual_var_map(sd, data)[source]
Assembles the matrix that maps from the boundary condition values to the dual variables on the boundary faces.
- Parameters:
sd (pg.Grid) – Grid, or a subclass.
data (dict) – The data dictionary
- Returns:
The matrix to be multiplied with the boundary data g.
- Return type:
sps.csc_array