UncertaintyModel
UncertaintyModel is the abstract base class for computing the uncertainty estimate for a given discretization level. Below is the description of the abstract base class followed by the concrete classes.
- class cfdverify.discretization.UncertaintyModel(parent: DiscretizationError)
Abstract base class for uncertainty models
- abstract uncertainty(key: str, index: int | None = None, **kwargs) floating | Series
Uncertainty method
- Parameters:
key (str) – Key of system response quantity of interest
index (int | None) – Index of discretization level of interest or None for all levels
- Returns:
Uncertainty of requested values
- Return type:
np.floating | pd.Series
- class cfdverify.discretization.GCI(parent: DiscretizationError)
Bases:
UncertaintyModelComputes uncertainty using the Grid Convergence Index
- uncertainty(key: str, index: int | None = None, fs: int | float = 1.25, normalize: bool = False) floating | Series
Compute Grid Convergence Index (GCI) for requested values
The GCI method was proposed by Patrick Roache as a way to uniformly report discretization uncertainty in computational fluid dynamics simulation results in 1994. By default values are not normalized as suggested by Roache and the factor of safety is 1.25. Roache provided the equation
\[GCI_1 = \frac{Fs * |\epsilon_{21}|}{r_{21}^p - 1},\]for estimating the uncertainty of the finer mesh for any two mesh pairs, and the equation
\[GCI_2 = r_{21}^p * \frac{Fs * |\epsilon_{21}|}{r_{21}^p - 1},\]for the coarser mesh of any mesh pair. These equations use the absolute relative error measure \(|\epsilon_{21}|\) corrected for the distance to the infinitely fine mesh; this is equivalent to the absolute estimated error \(|\epsilon_{\mathrm{est}}|\) for exact fits. However, for regression fits of data they are not equivalent; therefore, this code implements the GCI uncertainty measure as
\[GCI = Fs * |\epsilon_{\mathrm{est}}|,\]so that it is valid for both exact and regression fits.
- Parameters:
key (str) – Key of system response quantity of interest
index (int | None) – Index of discretization level of interest or None for all levels
fs (int | float) – Factor of safety for computation. Defaults to 1.25
normalize (bool) – Whether output GCI value should be normalized or not
- Returns:
gci – GCI of requested values
- Return type:
np.floating | pd.Series
References
Patrick J. Roache, 1994, Perspective: A Method for Uniform Reporting of Grid Refinement Studies, Journal of Fluids Engineering, 116(3): 405-413. https://doi.org/10.1115/1.2910291.
- class cfdverify.discretization.StudentsTDistribution(parent: DiscretizationError)
Bases:
UncertaintyModelComputes uncertainty using student’s t distribution
- uncertainty(key: str, index: int | None = None, significance: float = 0.05) floating | Series
Compute uncertainty using Student’s t distribution
Student’s t distribution is a generalization of the normal probability distribution with fatter tails to account for low sample counts from a population.
- Parameters:
key (str) – Key of system response quantity of interest
index (int | None) – Not used for class but included for uniform interface
significance (float) – Double-sided significance for Student’s-t distribution
- Returns:
u – Uncertainty of requested values using Student’s t distribution
- Return type:
np.floating | pd.Series
- class cfdverify.discretization.FactorOfSafety(parent: DiscretizationError)
Bases:
UncertaintyModelComputes uncertainty by a constant factor of safety
- uncertainty(key: str, index: int | None = None, factor: int | float = 3) floating | Series
Compute uncertainty as a constant factor of the error estimate
- Parameters:
key (str) – Key of system response quantity of interest
index (int | None) – Index of discretization level of interest or None for all levels
factor (int | float) – Factor of safety to apply to error estimate
- Returns:
Uncertainty of requested values using supplied factor of safety
- Return type:
np.floating | pd.Series