fvCellZone.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) 2011-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::fvCellZone
26 
27 Description
28  cellZone selection or generation class with caching of zone volume
29 
30  for fvModels, fvConstraints, functionObjects etc.
31 
32  The cellZone is either looked-up from the mesh or generated by a
33  zoneGenerator and stored locally.
34 
35 Usage
36  Examples:
37  \verbatim
38  // Select all cells
39  cellZone all;
40 
41  // Select the cells within the given cellZone
42  cellZone rotor;
43 
44  // Select the cells within the given box
45  cellZone
46  {
47  type box;
48  box (3.48 -0.1 -0.1) (3.5 0.1 0.1);
49  }
50 
51  // Select the cell containing the given point
52  // and update the cells with respect to the fixed points
53  // if the mesh moves
54  cellZone
55  {
56  type containsPoints;
57  moveUpdate true;
58  points ((0.075 0.2 0.05));
59  }
60  \endverbatim
61 
62 See also
63  Foam::generatedCellZone
64  Foam::generatedZoneSet
65  Foam::zoneGenerator
66  Foam::fvModel
67  Foam::fvConstraint
68 
69 SourceFiles
70  fvCellZone.C
71  fvCellZoneI.H
72 
73 \*---------------------------------------------------------------------------*/
74 
75 #ifndef fvCellZone_H
76 #define fvCellZone_H
77 
78 #include "generatedCellZone.H"
79 #include "writeFile.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 class fvMesh;
87 
88 /*---------------------------------------------------------------------------*\
89  Class fvCellZone Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 class fvCellZone
93 :
94  public generatedCellZone
95 {
96  // Private data
97 
98  //- Reference to the mesh
99  const fvMesh& mesh_;
100 
101  //- The global number of cells
102  mutable label nGlobalCells_;
103 
104  //- Sum of cell volumes
105  mutable scalar V_;
106 
107 
108  // Private functions
109 
110  //- Update the global number of cells and the sum of cell volumes
111  void update();
112 
113 
114 public:
115 
116  // Constructors
117 
118  //- Construct from mesh selecting all cells
119  fvCellZone(const fvMesh& mesh);
120 
121  //- Construct from mesh and dictionary
122  fvCellZone(const fvMesh& mesh, const dictionary& dict);
123 
124 
125  //- Destructor
126  ~fvCellZone();
127 
128 
129  // Member Functions
130 
131  //- Return const access to the global number of cells
132  inline label nGlobalCells() const;
133 
134  //- Return const access to the total cell volume
135  inline scalar V() const;
136 
137  //- Output file header information
138  void writeFileHeader
139  (
140  const functionObjects::writeFile& wf,
141  Ostream& file
142  );
143 
144 
145  // Mesh changes
146 
147  //- Update for mesh motion
148  void movePoints();
149 
150  //- Update topology using the given map
151  void topoChange(const polyTopoChangeMap&);
152 
153  //- Update from another mesh using the given map
154  void mapMesh(const polyMeshMap&);
155 
156  //- Redistribute or update using the given distribution map
157  void distribute(const polyDistributionMap&);
158 
159 
160  // IO
161 
162  //- Read coefficients dictionary
163  bool read(const dictionary& dict);
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #include "fvCellZoneI.H"
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
functionObject base class for writing single files
Definition: writeFile.H:56
cellZone selection or generation class with caching of zone volume
Definition: fvCellZone.H:94
scalar V() const
Return const access to the total cell volume.
Definition: fvCellZoneI.H:34
void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: fvCellZone.C:97
void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: fvCellZone.C:111
void movePoints()
Update for mesh motion.
Definition: fvCellZone.C:90
bool read(const dictionary &dict)
Read coefficients dictionary.
Definition: fvCellZone.C:118
label nGlobalCells() const
Return const access to the global number of cells.
Definition: fvCellZoneI.H:28
void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: fvCellZone.C:104
~fvCellZone()
Destructor.
Definition: fvCellZone.C:71
void writeFileHeader(const functionObjects::writeFile &wf, Ostream &file)
Output file header information.
Definition: fvCellZone.C:78
fvCellZone(const fvMesh &mesh)
Construct from mesh selecting all cells.
Definition: fvCellZone.C:49
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
cellZone selection or generation class
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
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
dictionary dict