blockMeshCartesianConfiguration.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::blockMeshCartesianConfiguration
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 Cartesian axes.
31 
32 SourceFiles
33  blockMeshCartesianConfiguration.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef blockMeshCartesianConfiguration_H
38 #define blockMeshCartesianConfiguration_H
39 
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class blockMeshCartesianConfiguration Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 :
54 {
55 protected:
56 
57  // Protected Data
58 
59  //- Number of cells in background mesh block
61 
62  //- Number of cells in background mesh shortest direction
63  const label minDimCells_;
64 
65  //- Refinement factor used to scale nCells
66  const label refineFactor_;
67 
68  //- Clear the default patch entries for the background mesh
69  const bool clearBoundary_;
70 
71 
72  // Protected Member Functions
73 
74  //- Calculate the parameters for the blockMeshDict file
75  void calcBlockMeshDict(const bool& boundsOpt);
76 
77  //- Write backgroundMesh sub-dictionary
78  void writeBackgroundMesh();
79 
80  //- Write the defaultPatch entry
81  void writeDefaultPatch();
82 
83  //- Write a patch in the boundary sub-dictionary
84  void writePatch
85  (
86  const word& name,
87  const word& type,
88  const string& face
89  );
90 
91  //- Write the boundary sub-dictionary
92  void writeBoundary();
93 
94  //- Write vertices list
95  void writeVertices();
96 
97  //- Write blocks sub-dictionary
98  void writeBlocks();
99 
100  //- Write edges list
101  void writeEdges();
102 
103  //- Write mergePatchPairs
104  void writeMergePatchPairs();
105 
106 
107 public:
108 
109  // Static Data Members
110 
111  //- Default patch names for the background mesh
112  static const List<word> patches;
113 
114 
115  // Constructors
116 
117  //- Construct from components
119  (
120  const fileName& name,
121  const fileName& dir,
122  const Time& time,
123  const meshingSurfaceList& surfaces,
124  const bool& boundsOpt,
125  const Vector<label>& nCells,
126  const label minDimCells,
127  const label refineFactor,
128  const HashTable<Pair<word>>& patchOpts,
129  const bool clearBoundary
130  );
131 
132  //- Disallow default bitwise copy construction
134  (
136  ) = delete;
137 
138 
139  //- Destructor
141 
142 
143  // Member Functions
144 
145  //- Write the blockMeshDict
146  void write();
147 
148 
149  // Member Operators
150 
151  //- Disallow default bitwise assignment
152  void operator=(const blockMeshCartesianConfiguration&) = delete;
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
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
From a set of input surface geometry files and a set of configuration parameters, writes out a blockM...
void writeEdges()
Write edges list.
const bool clearBoundary_
Clear the default patch entries for the background mesh.
static const List< word > patches
Default patch names for the background mesh.
void writeBackgroundMesh()
Write backgroundMesh sub-dictionary.
const label minDimCells_
Number of cells in background mesh shortest direction.
const label refineFactor_
Refinement factor used to scale nCells.
Vector< label > nCells_
Number of cells in background mesh block.
void writeBoundary()
Write the boundary sub-dictionary.
void calcBlockMeshDict(const bool &boundsOpt)
Calculate the parameters for the blockMeshDict file.
void writeMergePatchPairs()
Write mergePatchPairs.
void writeDefaultPatch()
Write the defaultPatch entry.
void writeBlocks()
Write blocks sub-dictionary.
void write()
Write the blockMeshDict.
void writeVertices()
Write vertices list.
blockMeshCartesianConfiguration(const fileName &name, const fileName &dir, const Time &time, const meshingSurfaceList &surfaces, const bool &boundsOpt, const Vector< label > &nCells, const label minDimCells, const label refineFactor, const HashTable< Pair< word >> &patchOpts, const bool clearBoundary)
Construct from components.
void writePatch(const word &name, const word &type, const string &face)
Write a patch in the boundary sub-dictionary.
void operator=(const blockMeshCartesianConfiguration &)=delete
Disallow default bitwise assignment.
Functions to configure and write a blockMeshDict configuration file.
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
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