NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
NEM::DRV::AutoVerificationDriver Class Reference

This class drives the automatic verification (AV) in Nemosys. More...

Detailed Description

Three successively refined meshes of a given geometry are required to evaluate whether the coarsest mesh is within the asymptotic range. The grid convergence index (GCI) of each component of each selected field is evaluated: if they are all approximately equal to 1 then the coarse mesh is sufficiently refined for an accurate solution (and is within asymptotic range).

Definition at line 48 of file AutoVerificationDriver.H.

Classes

struct  Files
 
struct  Opts
 

Public Member Functions

 AutoVerificationDriver (Files files, Opts opts)
 
const FilesgetFiles () const
 
void setFiles (Files files)
 
const OptsgetOpts () const
 
void setOpts (Opts opts)
 
void execute () const override
 Run the workflow represented by the driver. More...
 

Static Public Member Functions

static std::unique_ptr< NemDriverreadJSON (const jsoncons::json &inputjson)
 Factory method for all drivers. More...
 

Private Member Functions

 AutoVerificationDriver ()
 
jsoncons::string_view getProgramType () const override
 

Private Attributes

Files files_
 
Opts opts_
 

Static Private Attributes

static constexpr const char * programType = "Verification"
 

Inherits NEM::DRV::NemDriver.

Constructor & Destructor Documentation

◆ AutoVerificationDriver() [1/2]

NEM::DRV::AutoVerificationDriver::AutoVerificationDriver ( Files  files,
Opts  opts 
)

Definition at line 51 of file AutoVerificationDriver.C.

◆ AutoVerificationDriver() [2/2]

NEM::DRV::AutoVerificationDriver::AutoVerificationDriver ( )
private

Definition at line 54 of file AutoVerificationDriver.C.

55  : AutoVerificationDriver({{}, {}, {}}, Opts{{}}) {}

Member Function Documentation

◆ execute()

void NEM::DRV::AutoVerificationDriver::execute ( ) const
overridevirtual

Implements NEM::DRV::NemDriver.

Definition at line 77 of file AutoVerificationDriver.C.

References NEM::DRV::AutoVerificationDriver::Opts::arrayIds, NEM::DRV::AutoVerificationDriver::Files::coarseMeshFile, meshBase::CreateShared(), files_, NEM::DRV::AutoVerificationDriver::Files::fineMeshFile, NEM::DRV::AutoVerificationDriver::Files::finerMeshFile, NEM::DRV::AutoVerificationDriver::Opts::numThreads, opts_, NEM::DRV::AutoVerificationDriver::Opts::targetGCI, and NEM::DRV::AutoVerificationDriver::Opts::transferType.

77  {
78  auto coarseMesh = meshBase::CreateShared(this->files_.coarseMeshFile);
79  auto fineMesh = meshBase::CreateShared(this->files_.fineMeshFile);
80  auto finerMesh = meshBase::CreateShared(this->files_.finerMeshFile);
81 #ifdef HAVE_OPENMP
82  auto threads = this->opts_.numThreads.value_or(omp_get_max_threads());
83  omp_set_num_threads(threads);
84  std::cout << "Number of threads set to : " << threads << std::endl;
85 #else
86  if (this->opts_.numThreads) {
87  std::cerr << "OpenMP is not enabled. Verification will continue in serial."
88  << std::endl;
89  }
90 #endif
91  std::cout << "Running verification." << std::endl;
92  auto oac = std::make_shared<OrderOfAccuracy>(
93  coarseMesh.get(), fineMesh.get(), finerMesh.get(), this->opts_.arrayIds,
94  this->opts_.transferType, this->opts_.targetGCI);
95  std::cout << "Checking if in asymptotic range." << std::endl;
96  std::cout << "Target GCI is set to : " << oac->getTargetGCI() << std::endl;
97  auto asymp = oac->checkAsymptoticRange();
98  bool inRange = true;
99  for (int i = 0; i < asymp.size(); ++i) {
100  for (int j = 0; j < asymp[0].size(); ++j) {
101  double gci = asymp[i][j];
102  if (gci > oac->getTargetGCI()) {
103  std::cout << "GCI of " << gci;
104  std::cout << " exceeds target GCI of " << oac->getTargetGCI()
105  << std::endl;
106  std::cout << "at array " << i << ", component " << j << std::endl;
107  inRange = false;
108  }
109  }
110  }
111  if (inRange) {
112  std::cout << "Grid is in target asymptotic range." << std::endl;
113  } else {
114  std::cout << "Grid is not in target asymptotic range." << std::endl;
115  }
116 }
std::vector< int > arrayIds
field ids for which we will evaluate the grid convergence index (GCI)
std::string transferType
default is &#39;Consistent Interpolation&#39;, alternatives include &#39;Conservative Surface Transfer&#39; (if enabl...
jsoncons::optional< int > numThreads
sets number of threads used in transfer (if OpenMP enabled); if unset and OpenMP enabled, omp_get_max_threads used
static std::shared_ptr< meshBase > CreateShared(const std::string &fname)
Create shared ptr from fname.
Definition: meshBase.C:171
double targetGCI
the target GCI value, set to 1.1 by default

◆ getFiles()

const AutoVerificationDriver::Files & NEM::DRV::AutoVerificationDriver::getFiles ( ) const

Definition at line 57 of file AutoVerificationDriver.C.

References files_.

57  {
58  return files_;
59 }

◆ getOpts()

const AutoVerificationDriver::Opts & NEM::DRV::AutoVerificationDriver::getOpts ( ) const

Definition at line 65 of file AutoVerificationDriver.C.

References opts_.

65  {
66  return opts_;
67 }

◆ getProgramType()

jsoncons::string_view NEM::DRV::AutoVerificationDriver::getProgramType ( ) const
overrideprivatevirtual

Implements NEM::DRV::NemDriver.

Definition at line 73 of file AutoVerificationDriver.C.

References programType.

73  {
74  return programType;
75 }
static constexpr const char * programType

◆ readJSON()

std::unique_ptr< NemDriver > NEM::DRV::NemDriver::readJSON ( const jsoncons::json &  inputjson)
staticinherited
Parameters
inputjsonjson input with "Program Type" key
Returns
pointer to base NemDriver class

Definition at line 37 of file NemDriver.C.

Referenced by NEM::DRV::MeshGenDriver::MeshGenDriver().

37  {
38  return inputjson.as<std::unique_ptr<NemDriver>>();
39 }

◆ setFiles()

void NEM::DRV::AutoVerificationDriver::setFiles ( Files  files)

Definition at line 61 of file AutoVerificationDriver.C.

References files_.

61  {
62  this->files_ = std::move(files);
63 }

◆ setOpts()

void NEM::DRV::AutoVerificationDriver::setOpts ( Opts  opts)

Definition at line 69 of file AutoVerificationDriver.C.

References opts_.

69  {
70  this->opts_ = std::move(opts);
71 }

Member Data Documentation

◆ files_

Files NEM::DRV::AutoVerificationDriver::files_
private

Definition at line 115 of file AutoVerificationDriver.H.

Referenced by execute(), getFiles(), and setFiles().

◆ opts_

Opts NEM::DRV::AutoVerificationDriver::opts_
private

Definition at line 116 of file AutoVerificationDriver.H.

Referenced by execute(), getOpts(), and setOpts().

◆ programType

constexpr const char* NEM::DRV::AutoVerificationDriver::programType = "Verification"
staticprivate

Definition at line 112 of file AutoVerificationDriver.H.

Referenced by getProgramType().


The documentation for this class was generated from the following files: