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.
AutoVerificationDriver.H
Go to the documentation of this file.
1 /*******************************************************************************
2 * Promesh *
3 * Copyright (C) 2022, IllinoisRocstar LLC. All rights reserved. *
4 * *
5 * Promesh is the property of IllinoisRocstar LLC. *
6 * *
7 * IllinoisRocstar LLC *
8 * Champaign, IL *
9 * www.illinoisrocstar.com *
10 * promesh@illinoisrocstar.com *
11 *******************************************************************************/
12 /*******************************************************************************
13 * This file is part of Promesh *
14 * *
15 * This version of Promesh is free software: you can redistribute it and/or *
16 * modify it under the terms of the GNU Lesser General Public License as *
17 * published by the Free Software Foundation, either version 3 of the License, *
18 * or (at your option) any later version. *
19 * *
20 * Promesh is distributed in the hope that it will be useful, but WITHOUT ANY *
21 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more *
23 * details. *
24 * *
25 * You should have received a copy of the GNU Lesser General Public License *
26 * along with this program. If not, see <https://www.gnu.org/licenses/>. *
27 * *
28 *******************************************************************************/
29 #ifndef NEMOSYS_AUTOVERIFICATIONDRIVER_H_
30 #define NEMOSYS_AUTOVERIFICATIONDRIVER_H_
31 
32 #include "nemosys_export.h"
33 
34 #include "Drivers/NemDriver.H"
35 
36 namespace NEM {
37 namespace DRV {
38 
39 /**
40  * This class drives the automatic verification (AV) in Nemosys. Three
41  * successively refined meshes of a given geometry are required to evaluate
42  * whether the coarsest mesh is within the asymptotic range. The grid
43  * convergence index (GCI) of each component of each selected field is
44  * evaluated: if they are all approximately equal to 1 then the coarse mesh is
45  * sufficiently refined for an accurate solution (and is within asymptotic
46  * range).
47  */
48 class NEMOSYS_EXPORT AutoVerificationDriver : public NemDriver {
49  public:
50  struct NEMOSYS_EXPORT Files {
51  public:
52  /**
53  * @brief Set AV driver files
54  * @param coarseMesh coarsest mesh
55  * @param fineMesh fine mesh
56  * @param finerMesh finest mesh
57  */
58  Files(std::string coarseMesh, std::string fineMesh,
59  std::string finerMesh);
60  std::string coarseMeshFile{};
61  std::string fineMeshFile{};
62  std::string finerMeshFile{};
63  JSONCONS_TYPE_TRAITS_FRIEND
64  private:
65  Files() = default;
66  };
67 
68  struct NEMOSYS_EXPORT Opts {
69  public:
70  /**
71  * @brief Set AV driver options
72  * @param arrayIDs Set @c arrayIds member
73  */
74  explicit Opts(std::vector<int> arrayIds);
75  /**
76  * @brief field ids for which we will evaluate the grid convergence index
77  * (GCI)
78  */
79  std::vector<int> arrayIds;
80  /**
81  * @brief default is 'Consistent Interpolation',
82  * alternatives include 'Conservative Surface Transfer' (if enabled,
83  * requires IMPACT) and 'Conservative Volume Transfer' (if enabled)
84  */
85  std::string transferType{"Consistent Interpolation"};
86  /**
87  * @brief the target GCI value, set to 1.1 by default
88  */
89  double targetGCI{1.1};
90  /**
91  * @brief sets number of threads used in transfer (if OpenMP enabled); if
92  * unset and OpenMP enabled, @c omp_get_max_threads used
93  */
94  jsoncons::optional<int> numThreads{};
95  JSONCONS_TYPE_TRAITS_FRIEND
96  private:
97  Opts() = default;
98  };
99 
100  AutoVerificationDriver(Files files, Opts opts);
101 
102  const Files &getFiles() const;
103  void setFiles(Files files);
104  const Opts &getOpts() const;
105  void setOpts(Opts opts);
106  void execute() const override;
107 
108  JSONCONS_TYPE_TRAITS_FRIEND
109 
110  private:
112  static constexpr const char *programType = "Verification";
113  jsoncons::string_view getProgramType() const override;
114 
117 };
118 
119 } // namespace DRV
120 } // namespace NEM
121 
122 #endif // NEMOSYS_AUTOVERIFICATIONDRIVER_H_
base class for drivers
Definition: NemDriver.H:46
std::vector< int > arrayIds
field ids for which we will evaluate the grid convergence index (GCI)
This class drives the automatic verification (AV) in Nemosys.
static constexpr auto programType