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 speficied 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 implicit feature capturing?
84  const bool implicitFeatures_;
85 
86  //- Number of layers at wall patches, default 0
87  const label layers_;
88 
89  //- insidePoint parameter
90  point insidePoint_;
91 
92  //- nCellsBetweenLevels parameter
93  const label nCellsBetweenLevels_;
94 
95 
96  // Private Member Functions
97 
98  //- Write switches
99  void writeSnappySwitches();
100 
101  //- Write surface entry for geometry sub-dictionary
102  void writeGeometrySurface(const label surfID);
103 
104  //- Write searchableBox entry for geometry sub-dictionary
105  void writeSearchableBox(const label i);
106 
107  //- Write geometry sub-dictionary
108  void writeSnappyGeometry();
109 
110  //- Write features list in castellatedMeshControls
111  void writeFeatures();
112 
113  //- Write refinementSurfaces level entry
114  void writeRefinementSurfacesLevel(const label rl);
115 
116  //- Write refinementSurfaces level entry using refinementLevel_
117  void writeRefinementSurfacesLevel();
118 
119  //- Write refinementSurfaces level entry for a surface with name
120  void writeRefinementSurfacesLevel(const word& name);
121 
122  //- Write refinementSurfaces wall patchInfo entry
123  void writePatchInfo(const word& type, const word& group="");
124 
125  //- Write refinementSurfaces
126  void writeRefinementSurfaces();
127 
128  //- Write a refinement surface region
129  void writeRefinementSurfacesRegion
130  (
131  const word regionName,
132  const List<word>& regions
133  );
134 
135  //- Write refinement surface region information
136  void writeRefinementSurfacesRegions
137  (
138  const wordList& inletRegions,
139  const wordList& outletRegions
140  );
141 
142  //- Write a refinement region
143  void writeRefinementRegion(const word& name, const label level);
144 
145  //- Write refinementRegions
146  void writeRefinementRegions();
147 
148  //- Write castellatedMeshControls
149  void writeCastellatedMeshControls();
150 
151  //- Write snapControls
152  void writeSnapControls();
153 
154  //- Write addLayersControls
155  void writeAddLayersControls();
156 
157  //- Write writeFlags
158  void writeWriteFlags();
159 
160 public:
161 
162  // Constructors
163 
164  //- Construct from components
166  (
167  const fileName& name,
168  const fileName& dir,
169  const Time& time,
170  const meshingSurfaceList& surfaces,
171  const label refinementLevel,
172  const List<Tuple2<word, label>>& surfaceLevels,
174  const List<Tuple3<vector, vector, label>>& refinementBoxes,
175  const List<Tuple3<word, scalar, label>>& refinementDists,
176  const bool implicitFeatures,
177  const label layers,
178  const point& insidePoint,
179  const label nCellsBetweenLevels
180  );
181 
182  //- Disallow default bitwise copy construction
184 
185 
186  //- Destructor
188 
189 
190  // Member Functions
191 
192  // Write the snappyHexMeshDict
193  void write();
194 
195 
196  // Member Operators
197 
198  //- Disallow default bitwise assignment
199  void operator=(const snappyHexMeshConfiguration&) = delete;
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
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:63
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...
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 implicitFeatures, const label layers, const point &insidePoint, const label nCellsBetweenLevels)
Construct from components.
void operator=(const snappyHexMeshConfiguration &)=delete
Disallow default bitwise assignment.
A class for handling words, derived from string.
Definition: word.H:62
Foam::word regionName
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
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488