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 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  // Private Data
56 
57  //- Number of cells in background mesh block
58  Vector<label> nCells_;
59 
60  //- Refinement factor used to scale nCells
61  const label refineFactor_;
62 
63  //- Clear the default patch entries for the background mesh
64  const bool clearBoundary_;
65 
66 
67  // Private Member Functions
68 
69  //- Calculate the parameters for the blockMeshDict file
70  void calcBlockMeshDict();
71 
72  //- Write backgroundMesh sub-dictionary
73  void writeBackgroundMesh();
74 
75  //- Write the defaultPatch entry
76  void writeDefaultPatch();
77 
78  //- Write a patch in the boundary sub-dictionary
79  void writePatch
80  (
81  const word& name,
82  const word& type,
83  const string& face
84  );
85 
86  //- Write the boundary sub-dictionary
87  void writeBoundary();
88 
89  //- Write vertices list
90  void writeVertices();
91 
92  //- Write blocks sub-dictionary
93  void writeBlocks();
94 
95  //- Write edges list
96  void writeEdges();
97 
98  //- Write mergePatchPairs
99  void writeMergePatchPairs();
100 
101 
102 public:
103 
104  // Static Data Members
105 
106  //- Default patch names for the background mesh
107  static const List<word> patches;
108 
109 
110  // Constructors
111 
112  //- Construct from components
114  (
115  const fileName& name,
116  const fileName& dir,
117  const Time& time,
118  const meshingSurfaceList& surfaces,
119  const Vector<label>& nCells,
120  const label refineFactor,
121  const HashTable<Pair<word>>& patchOpts,
122  const bool clearBoundary
123  );
124 
125  //- Disallow default bitwise copy construction
127  (
129  ) = delete;
130 
131 
132  //- Destructor
134 
135 
136  // Member Functions
137 
138  //- Write the blockMeshDict
139  void write();
140 
141 
142  // Member Operators
143 
144  //- Disallow default bitwise assignment
145  void operator=(const blockMeshCartesianConfiguration&) = delete;
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
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...
static const List< word > patches
Default patch names for the background mesh.
blockMeshCartesianConfiguration(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.
void write()
Write the blockMeshDict.
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 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