snappyHexMeshConfiguration.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::snappyHexMeshConfiguration
26 
27 Description
28  From a set of input surface geometry files and some configuration
29  parameters, writes out a snappyHexMeshDict configuration file.
30 
31 SourceFiles
32  snappyHexMeshConfigurationI.H
33  snappyHexMeshConfiguration.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef snappyHexMeshConfiguration_H
38 #define snappyHexMeshConfiguration_H
39 
40 #include "caseFileConfiguration.H"
41 #include "meshingSurfaceList.H"
42 #include "Tuple3.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class snappyHexMeshConfiguration Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
56 {
57  // Private Typedefs
58 
59  //- The surface type
61 
62 
63  // Private Data
64 
65  //- List of surfaces used for meshing
66  const meshingSurfaceList& surfaces_;
67 
68  //- Refinement level applied across the snappyHexMeshDict file
69  const label refinementLevel_;
70 
71  //- Level of refinement on specified surfaces
72  const List<Tuple2<word, label>>& surfaceLevels_;
73 
74  //- Refinement regions specified by surface and level
75  const List<Tuple2<word, label>>& refinementRegions_;
76 
77  //- Refinement boxes with level of refinement
78  const List<Tuple3<vector, vector, label>>& refinementBoxes_;
79 
80  //- Refinement distances with level of refinement
81  const List<Tuple3<word, scalar, label>>& refinementDists_;
82 
83  //- Using explicit feature capturing?
84  const bool explicitFeatures_;
85 
86  //- Number of layers on specified surfaces
87  const List<Tuple2<word, label>> layers_;
88 
89  //- Thickness of the near wall cells with layer addition
90  const scalar firstLayerThickness_;
91 
92  //- Expansion ratio used with layer addition
93  const scalar layerExpansionRatio_;
94 
95  //- insidePoint parameter
96  point insidePoint_;
97 
98  //- nCellsBetweenLevels parameter
99  const label nCellsBetweenLevels_;
100 
101 
102  // Private Member Functions
103 
104  //- Write switches
105  void writeSnappySwitches();
106 
107  //- Write surface entry for geometry sub-dictionary
108  void writeGeometrySurface(const label surfID);
109 
110  //- Write searchableBox entry for geometry sub-dictionary
111  void writeSearchableBox(const label i);
112 
113  //- Write geometry sub-dictionary
114  void writeSnappyGeometry();
115 
116  //- Write features list in castellatedMeshControls
117  void writeFeatures();
118 
119  //- Write refinementSurfaces level entry
120  void writeRefinementSurfacesLevel(const label rl);
121 
122  //- Write refinementSurfaces level entry using refinementLevel_
123  void writeRefinementSurfacesLevel();
124 
125  //- Write refinementSurfaces level entry for a surface with name
126  void writeRefinementSurfacesLevel(const word& name);
127 
128  //- Write refinementSurfaces wall patchInfo entry
129  void writePatchInfo(const word& type, const word& group="");
130 
131  //- Write refinementSurfaces
132  void writeRefinementSurfaces();
133 
134  //- Write a refinement surface region
135  void writeRefinementSurfacesRegion
136  (
137  const word regionName,
138  const List<word>& regions
139  );
140 
141  //- Write refinement surface region information
142  void writeRefinementSurfacesRegions
143  (
144  const wordList& inletRegions,
145  const wordList& outletRegions
146  );
147 
148  //- Write a refinement region
149  void writeRefinementRegion(const word& name, const label level);
150 
151  //- Write refinementRegions
152  void writeRefinementRegions();
153 
154  //- Write castellatedMeshControls
155  void writeCastellatedMeshControls();
156 
157  //- Write snapControls
158  void writeSnapControls();
159 
160  //- Write addLayersControls
161  void writeAddLayersControls();
162 
163  //- Write writeFlags
164  void writeWriteFlags();
165 
166 public:
167 
168  // Constructors
169 
170  //- Construct from components
172  (
173  const fileName& name,
174  const fileName& dir,
175  const Time& time,
176  const meshingSurfaceList& surfaces,
177  const label refinementLevel,
178  const List<Tuple2<word, label>>& surfaceLevels,
180  const List<Tuple3<vector, vector, label>>& refinementBoxes,
181  const List<Tuple3<word, scalar, label>>& refinementDists,
182  const bool explicitFeatures,
183  const List<Tuple2<word, label>>& layers,
184  const scalar firstLayerThickness,
185  const scalar layerExpansionRatio,
186  const point& insidePoint,
187  const label nCellsBetweenLevels
188  );
189 
190  //- Disallow default bitwise copy construction
192 
193 
194  //- Destructor
196 
197 
198  // Member Functions
199 
200  // Write the snappyHexMeshDict
201  void write();
202 
203 
204  // Member Operators
205 
206  //- Disallow default bitwise assignment
207  void operator=(const snappyHexMeshConfiguration&) = delete;
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A 2-tuple for storing two objects of different types.
Definition: Tuple2.H:66
A 3-tuple for storing three objects of different types.
Definition: Tuple3.H:60
Base class for writing case files.
A class for handling file names.
Definition: fileName.H:82
List of meshingSurfaces which stores the overall bounding box of all the meshingSurfaces.
surfaceType
Type of surface.
Encapsulates queries for volume refinement ('refine all cells within shell').
From a set of input surface geometry files and some configuration parameters, writes out a snappyHexM...
void operator=(const snappyHexMeshConfiguration &)=delete
Disallow default bitwise assignment.
snappyHexMeshConfiguration(const fileName &name, const fileName &dir, const Time &time, const meshingSurfaceList &surfaces, const label refinementLevel, const List< Tuple2< word, label >> &surfaceLevels, const List< Tuple2< word, label >> &refinementRegions, const List< Tuple3< vector, vector, label >> &refinementBoxes, const List< Tuple3< word, scalar, label >> &refinementDists, const bool explicitFeatures, const List< Tuple2< word, label >> &layers, const scalar firstLayerThickness, const scalar layerExpansionRatio, const point &insidePoint, const label nCellsBetweenLevels)
Construct from components.
A class for handling words, derived from string.
Definition: word.H:62
const char *const group
Group name for atomic constants.
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
const word & regionName(const solver &region)
Definition: solver.H:209
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488