Basic checks#
Class Check#
- class multipy.check.Check#
Supports performing basic checks of the computed quantities.
Check.sum_of_species_fractions#
- multipy.check.Check.sum_of_species_fractions(self, species_fractions, tolerance=1e-12, verbose=False)#
Checks if all species mole/mass/volume fractions sum to 1.0 for every observation within a specified tolerance.
For mole fractions:
\[\sum_{i=1}^{n} X_i = 1.0\]For mass fractions:
\[\sum_{i=1}^{n} Y_i = 1.0\]For volume fractions:
\[\sum_{i=1}^{n} V_i = 1.0\]where \(n\) is the number of species.
- Parameters
species_fractions – scalar
numpy.ndarrayspecifying all species mole/mass/volume fractions in \([-]\). It should be of size(n_species, n_observations)wheren_speciesis at least 2.tolerance – (optional)
floatspecifying the tolerance. It should be larger than 0.0 and smaller than 1.0.verbose – (optional)
boolfor printing verbose information.
- Returns
idx - indices of observations where species mole/mass/volume fractions do not sum to 1.0 within a specified tolerance.
Check.range_of_species_fractions#
- multipy.check.Check.range_of_species_fractions(self, species_fractions, tolerance=1e-12, verbose=False)#
Checks if all species mole/mass/volume fraction values are bounded between 0 and 1.
For mole fractions:
\[X_i \in \langle 0, 1 \rangle\]For mass fractions:
\[Y_i \in \langle 0, 1 \rangle\]For volume fractions:
\[V_i \in \langle 0, 1 \rangle\]- Parameters
species_fractions – scalar
numpy.ndarrayspecifying all species mole/mass/volume fractions in \([-]\). It should be of size(n_observations,n_species)wheren_speciesis at least 2.verbose – (optional)
boolfor printing verbose information.
- Returns
idx_below_zero - indices of observations where species mole/mass/volume fractions are less than 0.0 within a specified tolerance.
idx_above_one - indices of observations where species mole/mass/volume fractions are larger than 1.0 within a specified tolerance.
Check.sum_of_species_gradients#
- multipy.check.Check.sum_of_species_gradients(self, species_gradients, tolerance=1e-12, verbose=False)#
Checks if all species mole/mass/volume fraction gradients sum to 0.0 for every observation within a specified tolerance.
For mole fractions:
\[\sum_{i=1}^{n} \nabla X_i = 0.0\]For mass fractions:
\[\sum_{i=1}^{n} \nabla Y_i = 0.0\]For volume fractions:
\[\sum_{i=1}^{n} \nabla V_i = 0.0\]where \(n\) is the number of species.
- Parameters
species_gradients – scalar
numpy.ndarrayspecifying all species mole/mass/volume fraction gradients in \([-]\). It should be of size(n_species, n_observations)wheren_speciesis at least 2.tolerance – (optional)
floatspecifying the tolerance. It should be larger than 0.0 and smaller than 1.0.verbose – (optional)
boolfor printing verbose information.
- Returns
idx - indices of observations where species mole/mass/volume fraction gradients do not sum to 0.0 within a specified tolerance.
Check.sum_of_species_production_rates#
- multipy.check.Check.sum_of_species_production_rates(self, species_production_rates, tolerance=1e-12, verbose=False)#
Checks if all species production rates sum to 0.0 for every observation within a specified tolerance:
For net molar production rates:
\[\sum_{i=1}^{n} s_i = 0.0\]For net mass production rates:
\[\sum_{i=1}^{n} \omega_i = 0.0\]where \(n\) is the number of species.
- Parameters
species_production_rates – scalar
numpy.ndarrayspecifying all species production rates, \(s_i\) in \(mole/(m^3s)\) or \(\omega_i\) in \(kg/(m^3s)\). It should be of size(n_species,n_observations)wheren_speciesis at least 2.tolerance – (optional)
floatspecifying the tolerance. It should be larger than 0.0 and smaller than 1.0.verbose – (optional)
boolfor printing verbose information.
- Returns
idx - indices of observations where species source terms do not sum to 0.0 within a specified tolerance.