blockMeshCylindricalConfiguration.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::blockMeshCylindricalConfiguration
26 
27 Description
28  From a set of input surface geometry files and a set of configuration
29  parameters, writes out a blockMeshDict configuration file. The mesh
30  consists of a single block, aligned with cylindrical coordinates about
31  the z-axis.
32 
33 SourceFiles
34  blockMeshCylindricalConfiguration.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef blockMeshCylindricalConfiguration_H
39 #define blockMeshCylindricalConfiguration_H
40 
42 #include "meshingSurfaceList.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class blockMeshCylindricalConfiguration Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
56 {
57  // Private Data
58 
59  //- Bounding box for the rotatingZone surfaces
60  boundBox rzbb_;
61 
62  //- Half width of the core box
63  scalar radBox_;
64 
65  //- Number of cells in background mesh = (boxCells radialCells zCells)
66  Vector<label> nCells_;
67 
68  //- Refinement factor used to scale nCells
69  label refineFactor_;
70 
71  //- Clear the default patch entries for the background mesh
72  bool clearBoundary_;
73 
74 
75  // Private Member Functions
76 
77  //- Inflate a bounding box by a scaling vector
78  void bbInflate(boundBox& bb, const vector& s);
79 
80  //- Are the geometry bounds aligned with the z-axis
81  bool isBoundBoxOnZaxis();
82 
83  //- Calculate the parameters for the blockMeshDict file
84  void calcBlockMeshDict();
85 
86  //- Write backgroundMesh sub-dictionary
87  void writeBackgroundMesh();
88 
89  //- Write the defaultPatch entry
90  void writeDefaultPatch();
91 
92  //- Write a patch in the boundary sub-dictionary
93  void writePatch
94  (
95  const word& name,
96  const word& type,
97  const string& face
98  );
99 
100  //- Write the boundary sub-dictionary
101  void writeBoundary();
102 
103  //- Write the geometry sub-dictionary
104  void writeGeometry();
105 
106  //- Write a projected vertex entry in the vertices list
107  void writeProjectedVertex
108  (
109  const word& x,
110  const word& y,
111  const word& z,
112  const word& surface
113  );
114 
115  //- Write vertices list
116  void writeVertices();
117 
118  //- Write blocks sub-dictionary
119  void writeBlocks();
120 
121  //- Write edges list
122  void writeEdges();
123 
124  //- Write mergePatchPairs
125  void writeMergePatchPairs();
126 
127 
128 public:
129 
130  // Static Data Members
131 
132  //- Default patch names for the background mesh
133  static const List<word> patches;
134 
135 
136  // Constructors
137 
138  //- Construct from components
140  (
141  const fileName& name,
142  const fileName& dir,
143  const Time& time,
144  const meshingSurfaceList& surfaces,
145  const Vector<label>& nCells,
146  const label refineFactor,
147  const HashTable<Pair<word>>& patchOpts,
148  const bool clearBoundary
149  );
150 
151  //- Disallow default bitwise copy construction
153  (
155  ) = delete;
156 
157 
158  //- Destructor
160 
161 
162  // Member Functions
163 
164  // Write the blockMeshDict
165  void write();
166 
167 
168  // Member Operators
169 
170  //- Disallow default bitwise assignment
171  void operator=(const blockMeshCylindricalConfiguration&) = delete;
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
scalar y
An STL-conforming hash table.
Definition: HashTable.H:127
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
Functions to configure and write a blockMeshDict configuration file.
From a set of input surface geometry files and a set of configuration parameters, writes out a blockM...
blockMeshCylindricalConfiguration(const fileName &name, const fileName &dir, const Time &time, const meshingSurfaceList &surfaces, const Vector< label > &nCells, const label refineFactor, const HashTable< Pair< word >> &patchOpts, const bool clearBoundary)
Construct from components.
static const List< word > patches
Default patch names for the background mesh.
void operator=(const blockMeshCylindricalConfiguration &)=delete
Disallow default bitwise assignment.
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:59
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:76
A class for handling file names.
Definition: fileName.H:82
List of meshingSurfaces which stores the overall bounding box of all the meshingSurfaces.
A class for handling words, derived from string.
Definition: word.H:62
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
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