porepy.models.verification_setups.verifications_utils module
This module contains utility functions for verification setups.
- class VerificationUtils[source]
Bases:
object
This class collects utility methods commonly used in verification setups.
Note
The class is intended to be used as a Mixin, such as the capabilities of another class (typically setup or solution storage classes) can be extended.
- relative_l2_error(grid, true_array, approx_array, is_scalar, is_cc)[source]
Compute discrete L2-error.
- Parameters
grid (Union[Grid, MortarGrid]) – Either a subdomain grid or a mortar grid.
true_array (ndarray) – Array containing the true values of a given variable.
approx_array (ndarray) – Array containing the approximate values of a given variable.
is_scalar (bool) – Whether the variable is a scalar quantity. Use
False
for vector quantities. For example,is_scalar=True
for pressure, whereasis_scalar=False
for displacement.is_cc (bool) – Whether the variable is associated to cell centers. Use
False
for variables associated to face centers. For example,is_cc=True
for pressures, whereasis_scalar=False
for subdomain fluxes.
- Returns
Discrete relative L2-error between the true and approximated arrays.
- Raises
ValueError if a mortar grid is given and is_cc=False. –
- Return type