MRFZones.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) 2012-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 Class
25  Foam::MRFZones
26 
27 Description
28  MRF zones DemandDrivenMeshObject read from MRFProperties dictionary
29 
30  MRF zones are specified by a list of dictionary entries, e.g.
31 
32  \verbatim
33  zone1
34  {
35  cellZone rotor1;
36  ...
37  }
38 
39  zone2
40  {
41  cellZone rotor2;
42  ...
43  }
44  \endverbatim
45 
46 SourceFiles
47  MRFZones.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef MRFZones_H
52 #define MRFZones_H
53 
54 #include "MRFZoneList.H"
55 #include "DemandDrivenMeshObject.H"
56 #include "IOdictionary.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 
63 /*---------------------------------------------------------------------------*\
64  Class MRFZones Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 class MRFZones
68 :
70  <
71  fvMesh,
72  TopoChangeableMeshObject,
73  MRFZones,
74  IOdictionary
75  >,
76  public MRFZoneList
77 {
78  // Private Member Functions
79 
80  //- Create IO object if dictionary is present
81  IOobject createIOobject(const fvMesh& mesh) const;
82 
83 
84 protected:
85 
86  friend class DemandDrivenMeshObject;
87 
88  // Protected Constructors
89 
90  //- Construct from mesh
91  explicit MRFZones(const fvMesh& mesh);
92 
93 
94 public:
95 
96  //- Runtime type information
97  TypeName("MRFZones");
98 
99 
100  // Constructors
101 
102  //- Disallow default bitwise copy construction
103  MRFZones(const MRFZones&) = delete;
104 
105  //- Inherit the base New method
107  <
108  fvMesh,
110  MRFZones,
112  >::New;
113 
114 
115  //- Destructor
116  virtual ~MRFZones()
117  {}
118 
119 
120  // Member Functions
121 
122  //- Use MRFZoneList::size for looping
123  using MRFZoneList::size;
124 
125  // Mesh changes
126 
127  //- Prepare for mesh update
128  virtual void preUpdateMesh();
129 
130  //- Update for mesh motion
131  virtual bool movePoints();
132 
133  //- Update topology using the given map
134  virtual void topoChange(const polyTopoChangeMap&);
135 
136  //- Update from another mesh using the given map
137  virtual void mapMesh(const polyMeshMap&);
138 
139  //- Redistribute or update using the given distribution map
140  virtual void distribute(const polyDistributionMap&);
141 
142 
143  // IO
144 
145  //- Read dictionary
146  virtual bool read();
147 
148 
149  // Member Operators
150 
151  //- Disallow default bitwise assignment
152  void operator=(const MRFZones&) = delete;
153 };
154 
155 
156 /*---------------------------------------------------------------------------*\
157  Class NullMRF Declaration
158 \*---------------------------------------------------------------------------*/
159 
160 class NullMRF
161 {
162 public:
163 
164  // Constructors
165 
166  //- Construct null
167  NullMRF()
168  {}
169 
170 
171  // Member Functions
172 
173  //- Return the argument unchanged
174  template<class Type>
175  inline const Type& relative(const Type& U) const
176  {
177  return U;
178  }
179 
180  //- Return the argument unchanged
181  template<class Type>
182  inline const Type& relative(const Type& U, const label patchi) const
183  {
184  return U;
185  }
186 
187  //- Return the argument unchanged
188  template<class Type>
189  inline const Type& absolute(const Type& U) const
190  {
191  return U;
192  }
193 
194  //- Return the argument unchanged
195  template<class Type>
196  inline const Type& absolute(const Type& U, const label patchi) const
197  {
198  return U;
199  }
200 
201 
202  //- Return the argument unchanged
203  template<class Type, class RhoType>
204  inline const Type& relative(const Type& U, const RhoType& rho) const
205  {
206  return U;
207  }
208 
209  //- Return the argument unchanged
210  template<class Type, class RhoType>
211  inline const Type& relative
212  (
213  const Type& U,
214  const RhoType& rho,
215  const label patchi
216  ) const
217  {
218  return U;
219  }
220 
221  //- Return the argument unchanged
222  template<class Type, class RhoType>
223  inline const Type& absolute(const Type& U, const RhoType& rho) const
224  {
225  return U;
226  }
227 
228  //- Return the argument unchanged
229  template<class Type, class RhoType>
230  inline const Type& absolute
231  (
232  const Type& U,
233  const RhoType& rho,
234  const label patchi
235  ) const
236  {
237  return U;
238  }
239 };
240 
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 } // End namespace Foam
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 #endif
249 
250 // ************************************************************************* //
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
static MRFZones & New(const word &name, const fvMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
List container for MRF zones.
Definition: MRFZoneList.H:55
MRF zones DemandDrivenMeshObject read from MRFProperties dictionary.
Definition: MRFZones.H:76
virtual bool movePoints()
Update for mesh motion.
Definition: MRFZones.C:97
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: MRFZones.C:104
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: MRFZones.C:116
void operator=(const MRFZones &)=delete
Disallow default bitwise assignment.
MRFZones(const fvMesh &mesh)
Construct from mesh.
Definition: MRFZones.C:72
virtual void preUpdateMesh()
Prepare for mesh update.
Definition: MRFZones.C:93
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: MRFZones.C:110
TypeName("MRFZones")
Runtime type information.
virtual ~MRFZones()
Destructor.
Definition: MRFZones.H:115
virtual bool read()
Read dictionary.
Definition: MRFZones.C:122
NullMRF()
Construct null.
Definition: MRFZones.H:166
const Type & absolute(const Type &U) const
Return the argument unchanged.
Definition: MRFZones.H:188
const Type & relative(const Type &U) const
Return the argument unchanged.
Definition: MRFZones.H:174
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
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.
label patchi
U
Definition: pEqn.H:72
rho
Definition: pEqn.H:1
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