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-2024 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  const bool& boundsOpt,
87  const bool& rotatingZonesOpt
88  );
89 
90  //- Write backgroundMesh sub-dictionary
91  void writeBackgroundMesh();
92 
93  //- Write the defaultPatch entry
94  void writeDefaultPatch();
95 
96  //- Write a patch in the boundary sub-dictionary
97  void writePatch
98  (
99  const word& name,
100  const word& type,
101  const string& face
102  );
103 
104  //- Write the boundary sub-dictionary
105  void writeBoundary();
106 
107  //- Write the geometry sub-dictionary
108  void writeGeometry();
109 
110  //- Write a projected vertex entry in the vertices list
111  void writeProjectedVertex
112  (
113  const word& x,
114  const word& y,
115  const word& z,
116  const word& surface
117  );
118 
119  //- Write vertices list
120  void writeVertices();
121 
122  //- Write blocks sub-dictionary
123  void writeBlocks();
124 
125  //- Write edges list
126  void writeEdges();
127 
128  //- Write mergePatchPairs
129  void writeMergePatchPairs();
130 
131 
132 public:
133 
134  // Static Data Members
135 
136  //- Default patch names for the background mesh
137  static const List<word> patches;
138 
139 
140  // Constructors
141 
142  //- Construct from components
144  (
145  const fileName& name,
146  const fileName& dir,
147  const Time& time,
148  const meshingSurfaceList& surfaces,
149  const bool& boundsOpt,
150  const Vector<label>& nCells,
151  const label refineFactor,
152  const HashTable<Pair<word>>& patchOpts,
153  const bool clearBoundary
154  );
155 
156  //- Disallow default bitwise copy construction
158  (
160  ) = delete;
161 
162 
163  //- Destructor
165 
166 
167  // Member Functions
168 
169  // Write the blockMeshDict
170  void write();
171 
172 
173  // Member Operators
174 
175  //- Disallow default bitwise assignment
176  void operator=(const blockMeshCylindricalConfiguration&) = delete;
177 };
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
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...
static const List< word > patches
Default patch names for the background mesh.
blockMeshCylindricalConfiguration(const fileName &name, const fileName &dir, const Time &time, const meshingSurfaceList &surfaces, const bool &boundsOpt, const Vector< label > &nCells, const label refineFactor, const HashTable< Pair< word >> &patchOpts, const bool clearBoundary)
Construct from components.
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(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::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 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