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-2025 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 protected:
58 
59  // Protected Typedefs
60 
61  //- The surface type
63 
64 
65  // Protected Data
66 
67  //- List of surfaces used for meshing
69 
70  //- Refinement level applied across the snappyHexMeshDict file
71  const label refinementLevel_;
72 
73  //- Level of refinement on specified surfaces
75 
76  //- Refinement regions specified by surface and level
78 
79  //- Refinement boxes with level of refinement
81 
82  //- Refinement distances with level of refinement
84 
85  //- Using explicit feature capturing?
86  const bool explicitFeatures_;
87 
88  //- Number of layers on specified surfaces
90 
91  //- Thickness of the near wall cells with layer addition
92  const scalar firstLayerThickness_;
93 
94  //- Expansion ratio used with layer addition
95  const scalar layerExpansionRatio_;
96 
97  //- insidePoints option (true when '-insidePoints' selected)
98  const bool insidePointsOpt_;
99 
100  //- insidePoints
102 
103  //- nCellsBetweenLevels parameter
105 
106 
107  // Protected Member Functions
108 
109  //- Write switches
110  void writeSnappySwitches();
111 
112  //- Write surface entry for geometry sub-dictionary
113  void writeGeometrySurface(const label surfID);
114 
115  //- Write searchableBox entry for geometry sub-dictionary
116  void writeSearchableBox(const label i);
117 
118  //- Write geometry sub-dictionary
119  void writeSnappyGeometry();
120 
121  //- Write features list in castellatedMeshControls
122  void writeFeatures();
123 
124  //- Write refinementSurfaces level entry
125  void writeRefinementSurfacesLevel(const label rl);
126 
127  //- Write refinementSurfaces level entry using refinementLevel_
129 
130  //- Write refinementSurfaces level entry for a surface with name
132 
133  //- Write refinementSurfaces wall patchInfo entry
134  void writePatchInfo(const word& type, const word& group="");
135 
136  //- Write refinementSurfaces
138 
139  //- Write a refinement surface region
141  (
142  const word regionName,
143  const List<word>& regions
144  );
145 
146  //- Write refinement surface region information
148  (
149  const wordList& inletRegions,
150  const wordList& outletRegions
151  );
152 
153  //- Write a refinement region
154  void writeRefinementRegion(const word& name, const label level);
155 
156  //- Write refinementRegions
157  void writeRefinementRegions();
158 
159  //- Write castellatedMeshControls
161 
162  //- Write snapControls
163  void writeSnapControls();
164 
165  //- Write addLayersControls
166  void writeAddLayersControls();
167 
168  //- Write writeFlags
169  void writeWriteFlags();
170 
171 public:
172 
173  // Constructors
174 
175  //- Construct from components
177  (
178  const fileName& name,
179  const fileName& dir,
180  const Time& time,
181  const meshingSurfaceList& surfaces,
182  const label refinementLevel,
183  const List<Tuple2<word, label>>& surfaceLevels,
185  const List<Tuple3<vector, vector, label>>& refinementBoxes,
186  const List<Tuple3<word, scalar, label>>& refinementDists,
187  const bool explicitFeatures,
188  const List<Tuple2<word, label>>& layers,
189  const scalar firstLayerThickness,
190  const scalar layerExpansionRatio,
191  const bool insidePointsOpt,
192  const List<point>& insidePoints,
193  const label nCellsBetweenLevels
194  );
195 
196  //- Disallow default bitwise copy construction
198 
199 
200  //- Destructor
202 
203 
204  // Member Functions
205 
206  // Write the snappyHexMeshDict
207  void write();
208 
209 
210  // Member Operators
211 
212  //- Disallow default bitwise assignment
213  void operator=(const snappyHexMeshConfiguration&) = delete;
214 };
215 
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 } // End namespace Foam
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #endif
224 
225 // ************************************************************************* //
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...
const bool explicitFeatures_
Using explicit feature capturing?
void writeFeatures()
Write features list in castellatedMeshControls.
void writePatchInfo(const word &type, const word &group="")
Write refinementSurfaces wall patchInfo entry.
void writeRefinementSurfacesLevel()
Write refinementSurfaces level entry using refinementLevel_.
void writeSnappySwitches()
Write switches.
void writeRefinementSurfacesRegion(const word regionName, const List< word > &regions)
Write a refinement surface region.
void writeRefinementRegions()
Write refinementRegions.
void writeSearchableBox(const label i)
Write searchableBox entry for geometry sub-dictionary.
void writeRefinementSurfaces()
Write refinementSurfaces.
const List< Tuple2< word, label > > layers_
Number of layers on specified surfaces.
const List< Tuple3< word, scalar, label > > & refinementDists_
Refinement distances with level of refinement.
const label nCellsBetweenLevels_
nCellsBetweenLevels parameter
void writeRefinementSurfacesRegions(const wordList &inletRegions, const wordList &outletRegions)
Write refinement surface region information.
const scalar layerExpansionRatio_
Expansion ratio used with layer addition.
void operator=(const snappyHexMeshConfiguration &)=delete
Disallow default bitwise assignment.
void writeSnapControls()
Write snapControls.
void writeSnappyGeometry()
Write geometry sub-dictionary.
const meshingSurfaceList & surfaces_
List of surfaces used for meshing.
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 bool insidePointsOpt, const List< point > &insidePoints, const label nCellsBetweenLevels)
Construct from components.
const bool insidePointsOpt_
insidePoints option (true when '-insidePoints' selected)
void writeRefinementRegion(const word &name, const label level)
Write a refinement region.
void writeWriteFlags()
Write writeFlags.
void writeAddLayersControls()
Write addLayersControls.
const List< point > insidePoints_
insidePoints
void writeGeometrySurface(const label surfID)
Write surface entry for geometry sub-dictionary.
const label refinementLevel_
Refinement level applied across the snappyHexMeshDict file.
const scalar firstLayerThickness_
Thickness of the near wall cells with layer addition.
const List< Tuple2< word, label > > & refinementRegions_
Refinement regions specified by surface and level.
const List< Tuple3< vector, vector, label > > & refinementBoxes_
Refinement boxes with level of refinement.
void writeCastellatedMeshControls()
Write castellatedMeshControls.
meshingSurface::surfaceType surfaceType
The surface type.
const List< Tuple2< word, label > > & surfaceLevels_
Level of refinement on specified surfaces.
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
const word & regionName(const solver &region)
Definition: solver.H:218
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
insidePoints((1 2 3))