The OrderOfAccuracy class computes the grid convergence index (GCI) given three successively refined meshes. More...
The GCI is particularly robust since it accounts for the order of convergence as well as the grid refinement ratio.
If a vector field is being analyzed, a GCI will be generated for each component.
For more information see: Roache, P.J. Verification and Validation in Compuational Science and Engineering, Hermosa Publishers, Albuquerque, New Mexico, 1998
Definition at line 54 of file OrderOfAccuracy.H.
Public Member Functions | |
OrderOfAccuracy (meshBase *_f3, meshBase *_f2, meshBase *_f1, std::vector< int > _arrayIDs, std::string transferType="Consistent Interpolation", double targetGCI=1.1) | |
~OrderOfAccuracy ()=default | |
std::vector< std::vector< double > > | computeOrderOfAccuracy () |
Compute order of accuracy. More... | |
std::vector< std::vector< double > > | computeGCI_21 () |
Compute the GCI with respect to the finer and finest grids. More... | |
std::vector< std::vector< double > > | computeGCI_32 () |
Compute the GCI with respect to the coarsest and finer grids. More... | |
std::vector< std::vector< double > > | computeResolution (double gciStar) |
Compute the grid resolution required to obtain the desired gci/level of accuracy for each component across all mesh fields. More... | |
void | computeRichardsonExtrapolation () |
std::vector< std::vector< double > > | getOrderOfAccuracy () const |
Returns order of accuracy for each component of each field. More... | |
std::vector< std::vector< double > > | checkAsymptoticRange () |
Check if grids are in asymptotic range of convergence based on the computed GCIs (GCI_32 and GCI_21). More... | |
void | computeMeshWithResolution (double gciStar, const std::string &ofname) |
Refine the coarsest mesh based on the target GCI, write to file with name ofname. More... | |
std::vector< std::vector< double > > | computeDiff (meshBase *mesh, const std::vector< std::string > &newArrNames) |
std::vector< std::vector< double > > | getDiffF2F1 () const |
double | getTargetGCI () const |
Private Attributes | |
meshBase * | f3 |
meshBase * | f2 |
meshBase * | f1 |
meshes from least to most refined (f3 - coarsest, f2 - finer, f1 - finest) More... | |
const std::vector< int > | arrayIDs |
array ids for arrays to be considered in analysis More... | |
std::vector< int > | diffIDs |
array ids for differences^2 in solutions between meshes More... | |
std::vector< int > | relEIDs |
array ids for integral of solutions on the most refined mesh, used in computing relative discretization error More... | |
std::vector< int > | realDiffIDs |
array ids for actual difference data More... | |
std::vector< std::string > | f3ArrNames |
std::vector< std::string > | f2ArrNames |
names of data arrays transferred from f3 to f2 and from f2 to f1 More... | |
double | r21 |
double | r32 |
effective grid refinement ratios More... | |
std::vector< std::vector< double > > | diffF3F2 |
L2 norm of the difference in solution between f3 and f2. More... | |
std::vector< std::vector< double > > | diffF2F1 |
L2 norm of the difference in solution between f2 and f1. More... | |
std::vector< std::vector< double > > | GCI_32 |
GCIs with respect to the coarse mesh (f3) More... | |
std::vector< std::vector< double > > | GCI_21 |
GCIs with respect to the finer mesh (f2) More... | |
std::vector< std::vector< double > > | orderOfAccuracy |
Order of accuracy (p) with respect to refinements f3-f2-f1. More... | |
double | targetGCI |
OrderOfAccuracy::OrderOfAccuracy | ( | meshBase * | _f3, |
meshBase * | _f2, | ||
meshBase * | _f1, | ||
std::vector< int > | _arrayIDs, | ||
std::string | transferType = "Consistent Interpolation" , |
||
double | targetGCI = 1.1 |
||
) |
Definition at line 36 of file OrderOfAccuracy.C.
References arrayIDs, computeDiff(), NEM::DRV::TransferDriver::CreateTransferObject(), diffF2F1, diffF3F2, diffIDs, f1, f2, f2ArrNames, f3, f3ArrNames, meshBase::getDataSet(), meshBase::getNumberOfPoints(), r21, r32, realDiffIDs, and relEIDs.
|
default |
std::vector< std::vector< double > > OrderOfAccuracy::checkAsymptoticRange | ( | ) |
We are within asymptotic range if all values are close to 1
Definition at line 185 of file OrderOfAccuracy.C.
References computeGCI_21(), computeGCI_32(), GCI_21, GCI_32, orderOfAccuracy, and r21.
Referenced by computeMeshWithResolution().
std::vector< std::vector< double > > OrderOfAccuracy::computeDiff | ( | meshBase * | mesh, |
const std::vector< std::string > & | newArrNames | ||
) |
Definition at line 263 of file OrderOfAccuracy.C.
References arrayIDs, diffIDs, meshBase::getDataSet(), meshBase::getNumberOfPoints(), id, meshBase::integrateOverMesh(), NEM::MSH::New(), realDiffIDs, and relEIDs.
Referenced by OrderOfAccuracy().
std::vector< std::vector< double > > OrderOfAccuracy::computeGCI_21 | ( | ) |
Definition at line 105 of file OrderOfAccuracy.C.
References computeOrderOfAccuracy(), diffF2F1, f1, GCI_21, meshBase::integrateOverMesh(), orderOfAccuracy, r21, and relEIDs.
Referenced by checkAsymptoticRange().
std::vector< std::vector< double > > OrderOfAccuracy::computeGCI_32 | ( | ) |
Definition at line 124 of file OrderOfAccuracy.C.
References computeOrderOfAccuracy(), diffF3F2, f2, GCI_32, meshBase::integrateOverMesh(), orderOfAccuracy, r32, and relEIDs.
Referenced by checkAsymptoticRange(), and computeResolution().
void OrderOfAccuracy::computeMeshWithResolution | ( | double | gciStar, |
const std::string & | ofname | ||
) |
gciStar | target GCI |
ofname | refined mesh filename |
Definition at line 156 of file OrderOfAccuracy.C.
References arrayIDs, checkAsymptoticRange(), computeResolution(), computeRichardsonExtrapolation(), meshBase::Create(), NEM::DRV::TransferDriver::CreateTransferObject(), f3, nemAux::flatten(), meshBase::refineMesh(), and meshBase::write().
std::vector< std::vector< double > > OrderOfAccuracy::computeOrderOfAccuracy | ( | ) |
Definition at line 80 of file OrderOfAccuracy.C.
References diffF2F1, diffF3F2, orderOfAccuracy, r21, and r32.
Referenced by computeGCI_21(), computeGCI_32(), and computeRichardsonExtrapolation().
std::vector< std::vector< double > > OrderOfAccuracy::computeResolution | ( | double | gciStar | ) |
Given a vector field, select the maximum refinement ratio in the components to ensure the desired GCI is met across all components.
Definition at line 143 of file OrderOfAccuracy.C.
References computeGCI_32(), GCI_32, and orderOfAccuracy.
Referenced by computeMeshWithResolution().
void OrderOfAccuracy::computeRichardsonExtrapolation | ( | ) |
Definition at line 199 of file OrderOfAccuracy.C.
References arrayIDs, computeOrderOfAccuracy(), NEM::DRV::TransferDriver::CreateTransferObject(), f1, f3, meshBase::getDataSet(), meshBase::getNewArrayNames(), meshBase::getNumberOfPoints(), id, NEM::MSH::New(), orderOfAccuracy, r21, and realDiffIDs.
Referenced by computeMeshWithResolution().
|
inline |
Definition at line 126 of file OrderOfAccuracy.H.
|
inline |
Definition at line 103 of file OrderOfAccuracy.H.
References mesh.
|
inline |
Definition at line 128 of file OrderOfAccuracy.H.
|
private |
Definition at line 134 of file OrderOfAccuracy.H.
Referenced by computeDiff(), computeMeshWithResolution(), computeRichardsonExtrapolation(), and OrderOfAccuracy().
|
private |
Definition at line 148 of file OrderOfAccuracy.H.
Referenced by computeGCI_21(), computeOrderOfAccuracy(), and OrderOfAccuracy().
|
private |
Definition at line 146 of file OrderOfAccuracy.H.
Referenced by computeGCI_32(), computeOrderOfAccuracy(), and OrderOfAccuracy().
|
private |
Definition at line 136 of file OrderOfAccuracy.H.
Referenced by computeDiff(), and OrderOfAccuracy().
|
private |
Definition at line 131 of file OrderOfAccuracy.H.
Referenced by computeGCI_21(), computeRichardsonExtrapolation(), and OrderOfAccuracy().
|
private |
Definition at line 131 of file OrderOfAccuracy.H.
Referenced by computeGCI_32(), and OrderOfAccuracy().
|
private |
Definition at line 141 of file OrderOfAccuracy.H.
Referenced by OrderOfAccuracy().
|
private |
Definition at line 131 of file OrderOfAccuracy.H.
Referenced by computeMeshWithResolution(), computeRichardsonExtrapolation(), and OrderOfAccuracy().
|
private |
Definition at line 141 of file OrderOfAccuracy.H.
Referenced by OrderOfAccuracy().
|
private |
Definition at line 152 of file OrderOfAccuracy.H.
Referenced by checkAsymptoticRange(), and computeGCI_21().
|
private |
Definition at line 150 of file OrderOfAccuracy.H.
Referenced by checkAsymptoticRange(), computeGCI_32(), and computeResolution().
|
private |
Definition at line 154 of file OrderOfAccuracy.H.
Referenced by checkAsymptoticRange(), computeGCI_21(), computeGCI_32(), computeOrderOfAccuracy(), computeResolution(), and computeRichardsonExtrapolation().
|
private |
Definition at line 144 of file OrderOfAccuracy.H.
Referenced by checkAsymptoticRange(), computeGCI_21(), computeOrderOfAccuracy(), computeRichardsonExtrapolation(), and OrderOfAccuracy().
|
private |
Definition at line 144 of file OrderOfAccuracy.H.
Referenced by computeGCI_32(), computeOrderOfAccuracy(), and OrderOfAccuracy().
|
private |
Definition at line 140 of file OrderOfAccuracy.H.
Referenced by computeDiff(), computeRichardsonExtrapolation(), and OrderOfAccuracy().
|
private |
Definition at line 138 of file OrderOfAccuracy.H.
Referenced by computeDiff(), computeGCI_21(), computeGCI_32(), and OrderOfAccuracy().
|
private |
Definition at line 156 of file OrderOfAccuracy.H.