zonalThermoZones.C
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) 2026 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 \*---------------------------------------------------------------------------*/
25 
26 #include "zonalThermoZones.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
33 }
34 
35 
36 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
37 
38 void Foam::zonalThermoZones::update()
39 {
40  cellZones_.resize(mesh().nCells());
41  cellZones_ = -1;
42 
43  forAll(zones_, zonei)
44  {
45  const cellZone& cz = mesh().cellZones()[zones_[zonei]];
46 
47  forAll(cz, i)
48  {
49  if (cellZones_[cz[i]] != -1)
50  {
52  << "Cell zones must not overlap"
53  << exit(FatalError);
54  }
55 
56  cellZones_[cz[i]] = zonei;
57  }
58  }
59 
60  forAll(cellZones_, celli)
61  {
62  if (cellZones_[celli] == -1)
63  {
65  << "Cell zones must span the entire mesh"
66  << exit(FatalError);
67  }
68  }
69 }
70 
71 
72 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
73 
75 (
76  const word& name,
77  const fvMesh& mesh,
78  const hashedWordList& zones
79 )
80 :
82  (
83  name,
84  mesh
85  ),
86  zones_(zones),
87  cellZones_()
88 {
89  update();
90 }
91 
92 
93 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
94 
96 {}
97 
98 
99 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
100 
102 {
103  return true;
104 }
105 
106 
108 {
109  update();
110 }
111 
112 
114 {
115  update();
116 }
117 
118 
120 {
121  update();
122 }
123 
124 
125 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
void resize(const label)
Alias for setSize(const label)
Definition: ListI.H:138
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
A wordList with hashed indices for faster lookup by name.
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
const cellZoneList & cellZones() const
Return cell zones.
Definition: polyMesh.H:438
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Definition: word.H:63
Mesh object to store cell-zone correspondence for zonal thermo.
virtual bool movePoints()
Update for mesh motion.
zonalThermoZones(const word &name, const fvMesh &mesh, const hashedWordList &zones)
Construct from a name, a mesh and a list of zones.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual ~zonalThermoZones()
Destructor.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
error FatalError
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)