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  //- Calculate the parameters for the blockMeshDict file
81  void calcBlockMeshDict();
82 
83  //- Write backgroundMesh sub-dictionary
84  void writeBackgroundMesh();
85 
86  //- Write the defaultPatch entry
87  void writeDefaultPatch();
88 
89  //- Write a patch in the boundary sub-dictionary
90  void writePatch
91  (
92  const word& name,
93  const word& type,
94  const string& face
95  );
96 
97  //- Write the boundary sub-dictionary
98  void writeBoundary();
99 
100  //- Write the geometry sub-dictionary
101  void writeGeometry();
102 
103  //- Write a projected vertex entry in the vertices list
104  void writeProjectedVertex
105  (
106  const word& x,
107  const word& y,
108  const word& z,
109  const word& surface
110  );
111 
112  //- Write vertices list
113  void writeVertices();
114 
115  //- Write blocks sub-dictionary
116  void writeBlocks();
117 
118  //- Write edges list
119  void writeEdges();
120 
121  //- Write mergePatchPairs
122  void writeMergePatchPairs();
123 
124 
125 public:
126 
127  // Static Data Members
128 
129  //- Default patch names for the background mesh
130  static const List<word> patches;
131 
132 
133  // Constructors
134 
135  //- Construct from components
137  (
138  const fileName& name,
139  const fileName& dir,
140  const Time& time,
141  const meshingSurfaceList& surfaces,
142  const Vector<label>& nCells,
143  const label refineFactor,
144  const HashTable<Pair<word>>& patchOpts,
145  const bool clearBoundary
146  );
147 
148  //- Disallow default bitwise copy construction
150  (
152  ) = delete;
153 
154 
155  //- Destructor
157 
158 
159  // Member Functions
160 
161  // Write the blockMeshDict
162  void write();
163 
164 
165  // Member Operators
166 
167  //- Disallow default bitwise assignment
168  void operator=(const blockMeshCylindricalConfiguration&) = delete;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
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