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.
blockMeshParams.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 
30 #ifndef NEMOSYS_BLOCKMESHPARAMS_H_
31 #define NEMOSYS_BLOCKMESHPARAMS_H_
32 
33 #ifdef HAVE_CFMSH
34 
35 #include "nemosys_export.h"
37 
38 #include <string>
39 #include <vector>
40 #include <map>
41 #include <tuple>
42 #include <jsoncons/config/jsoncons_config.hpp> // for jsoncons::optional
43 
44 
45 //
46 // In Development
47 // struct bmshPatchDefine
48 // {
49 // bool _isPatch; // if given patch is a patch
50 // bool _isWall; // if given patch is a wall
51 // bool _isSymmPlane; // if given patch is a symmetric plane
52 // bool _isEmptyPtch; // if given patch is an empty patch
53 // std::string ptchName; // Patch Name
54 // };
55 //
56 
57 // --- All blockMesh parameters are accepted in meters
58 
59 // --- Base class for blockmesh shape options
60 
61 /** @brief bmshape desc.
62  *
63  * Longer description
64  */
65 
66 struct NEMOSYS_EXPORT bmShape {
67  virtual ~bmShape() = default;
68 
69  protected:
70  bmShape() = default;
71  bmShape(const bmShape &) = default;
72  bmShape(bmShape &&) = default;
73  bmShape &operator=(const bmShape &) = default;
74  bmShape &operator=(bmShape &&) = default;
75 };
76 
77 // --- Automatic Box Generation for Pack Mesh
78 struct NEMOSYS_EXPORT bmAutoGenBox {
79  /** @brief Input surface file for generating block automatically
80  surrounding whole geometry domain with 10% offset in all direction
81  **/
82  std::string packFileName;
83  /** @brief offset in X/Y/Z direction for auto box generation
84  **/
85  std::array<double, 3> offset{0.1, 0.1, 0.1};
86 };
87 
88 // --- Options for Box
89 struct NEMOSYS_EXPORT bmBox : public bmShape {
90  /** @brief location of initial point
91  **/
92  std::array<double, 3> init{0., 0., 0.}; // location of initial point
93 
94  /** @brief length in X/Y/Z direction
95  **/
96  std::array<double, 3> len{1., 1., 1.};
97 
98  /** @brief defines grading in hex block (Default 1)
99  **/
100  std::array<double, 3> smplGrading{1., 1., 1.};
101 
102  /** @brief Pair of min and max box locations for autogenerate
103  **/
104  std::pair<std::array<double, 3>, std::array<double, 3>> coordsBox{
105  {0., 0., 0.}, {0., 0., 0.}};
106 
107  jsoncons::optional<bmAutoGenBox> autoGenerate;
108 };
109 
110 // -- Options for sphere mesh
111 struct NEMOSYS_EXPORT bmSphere : public bmShape {
112  /** @brief Defines X/Y/Z coordinate of sphere center
113  **/
114  std::array<double, 3> center{0., 0., 0.}; // Sphere center
115 
116  /** @brief Defines radius of sphere
117  **/
118  double radius; // Radius of sphere
119 
120  /** @brief User defined grading in X/Y/Z direction (Default 1)
121  **/
122  std::array<double, 3> sphrGrading{1., 1., 1.};
123 };
124 
125 // -- Options for cylinder and tapered cone mesh
126 struct NEMOSYS_EXPORT bmCylTaperedCone : public bmShape {
127  /** @brief Vector for storing cylinder center coordinates
128  **/
129  std::array<double, 3> centerCyl{0., 0., 0.}; // Center location
130 
131  /** @brief Radius on one end of cylinder
132  **/
133  double radius1; // radius 1
134 
135  /** @brief Radius on the other end of cylinder; if not set, radius1 used
136  **/
137  jsoncons::optional<double> radius2; // radius 2
138 
139  /** @brief Height of cylinder
140  **/
141  double height; // height of cylinder
142 
143  /** @brief Vector of mesh grading in X, Y, and Z direction respectively
144  **/
145  std::array<double, 3> cylGrading{0., 0., 0.}; // defines grading
146 };
147 
148 /**
149  @brief blockMeshParams contains the parameters important for automatic
150  meshing using blockMeshGen class. These parameters are assigned a
151  value during user input pasing through JSON in MeshGenDriver.
152 **/
153 class NEMOSYS_EXPORT blockMeshParams : public meshingParams {
154  // --- access
155  public:
156  /** @brief blockMeshParams standard constructor
157  **/
158  blockMeshParams() = default; // constructor
159 
160  // --- Booleans for shape preferences
161  /** @brief Enables option to use user provided blockMeshDict
162  **/
163  // TODO: Unused
164  bool ownBlockMshDict{false}; // User provided blockMeshDict
165 
166  /** @brief 3D block, sphere, cylinder, or tapered cone
167  **/
168  std::shared_ptr<bmShape> shape{};
169 
170  // --- Some general options
171  /** @brief Defines mesh scale to meters
172  **/
173  double cnvrtToMeters{1}; // Scale to meters
174 
175  /** @brief Defines number of cells in X/Y/Z direction; unused if cellSize has
176  a value
177  **/
178  std::array<int, 3> nCells{40, 40, 40};
179 
180  /** @brief user can define mesh cell size here (if not set, nCells used
181  instead).
182  **/
183  jsoncons::optional<double> cellSize{}; // mesh density defined
184 
185  /** @brief Boolean for if the operation is packmesh
186  **/
187  bool isPackMesh{true};
188 };
189 
190 #endif
191 
192 #endif // NEMOSYS_BLOCKMESHPARAMS_H_
bmshape desc.
jsoncons::optional< double > radius2
Radius on the other end of cylinder; if not set, radius1 used.
double radius
Defines radius of sphere.
blockMeshParams contains the parameters important for automatic meshing using blockMeshGen class...
double radius1
Radius on one end of cylinder.
double height
Height of cylinder.
std::string packFileName
Input surface file for generating block automatically surrounding whole geometry domain with 10% offs...
jsoncons::optional< bmAutoGenBox > autoGenerate