cloud_fvModel.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) 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::fv::cloud
26 
27 Description
28  Finite volume model that solves for the evolution of a cloud. Provides
29  two-way coupling with a finite-volume carrier phase.
30 
31 SourceFiles
32  cloud_fvModel.C
33  cloud_fvModelTemplates.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef cloud_fvModel_H
38 #define cloud_fvModel_H
39 
40 #include "fvModel.H"
41 #include "coupled.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 namespace fv
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class cloud Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class cloud
55 :
56  public fvModel
57 {
58  // Private Data
59 
60  //- The cloud
61  autoPtr<Foam::cloud> cloudPtr_;
62 
63  //- Cloud reference (for convenience)
64  const Foam::cloud& cloud_;
65 
66  //- Coupled cloud reference (for convenience)
67  const clouds::coupled& coupledCloud_;
68 
69 
70  // Private Member Functions
71 
72  // Sources
73 
74  //- Add a source term to an equation
75  template<class Type>
76  void addSupType
77  (
78  const VolField<Type>& field,
79  fvMatrix<Type>& eqn
80  ) const;
81 
82  //- Add a source term to a compressible equation
83  template<class Type>
84  void addSupType
85  (
86  const volScalarField& rho,
87  const VolField<Type>& field,
88  fvMatrix<Type>& eqn
89  ) const;
90 
91  //- Add a source term to a phase equation
92  template<class Type>
93  void addSupType
94  (
95  const volScalarField& alpha,
96  const volScalarField& rho,
97  const VolField<Type>& field,
98  fvMatrix<Type>& eqn
99  ) const;
100 
101 
102 protected:
103 
104  // Protected Classes
105 
106  //- Empty template class used to template the constructor on the type
107  // of the cloud
108  template<class Type>
109  class Cloud
110  {};
111 
112 
113  // Protected Constructors
114 
115  //- Construct from components
116  template<class Type>
117  cloud
118  (
119  const word& name,
120  const word& modelType,
121  const fvMesh& mesh,
122  const dictionary& dict,
123  const Cloud<Type>&
124  );
125 
126 
127 public:
128 
129  // Public Static Data
130 
131  //- Run-time type information
132  TypeName("cloud");
133 
134 
135  //- Destructor
136  virtual ~cloud();
137 
138 
139  // Member Functions
140 
141  // Checks
142 
143  //- Return true if the fvModel adds a source term to the given
144  // field's transport equation
145  virtual bool addsSupToField(const word& fieldName) const;
146 
147 
148  // Sources
149 
150  //- Add a source term to a field-less proxy equation
151  virtual void addSup(fvMatrix<scalar>& eqn) const;
152 
153  //- Add a source term to an equation
155 
156  //- Add a source term to a compressible equation
158 
159  //- Add a source term to a phase equation
161 
162 
163  //- Solve the evolution of the cloud over the current time-step
164  virtual void correct();
165 
166 
167  // Mesh changes
168 
169  //- Prepare for mesh update
170  virtual void preUpdateMesh();
171 
172  //- Update for mesh motion
173  virtual bool movePoints();
174 
175  //- Update topology using the given map
176  virtual void topoChange(const polyTopoChangeMap&);
177 
178  //- Update from another mesh using the given map
179  virtual void mapMesh(const polyMeshMap&);
180 
181  //- Redistribute or update using the given distribution map
182  virtual void distribute(const polyDistributionMap&);
183 };
184 
185 
186 /*---------------------------------------------------------------------------*\
187  Class Cloud Declaration
188 \*---------------------------------------------------------------------------*/
189 
190 template<class Type>
191 class Cloud
192 :
193  public cloud
194 {
195 public:
196 
197  // Public Static Data
198 
199  //- Run-time type information
200  TypeName("Cloud");
201 
202 
203  // Constructors
204 
205  //- Construct from components
206  Cloud
207  (
208  const word& name,
209  const word& modelType,
210  const fvMesh& mesh,
211  const dictionary& dict
212  );
213 };
214 
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 } // End namespace fv
219 } // End namespace Foam
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #ifdef NoRepository
224  #include "cloud_fvModelTemplates.C"
225 #endif
226 
227 
228 #define makeCloudFvModel(Type) \
229  \
230  typedef Cloud<clouds::Type> Type##CloudFvModel; \
231  \
232  defineTemplateTypeNameAndDebugWithName \
233  ( \
234  Type##CloudFvModel, \
235  (clouds::Type::typeName + "Cloud").c_str(), \
236  0 \
237  ); \
238  \
239  addToRunTimeSelectionTable \
240  ( \
241  fvModel, \
242  Type##CloudFvModel, \
243  dictionary \
244  );
245 
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #endif
250 
251 // ************************************************************************* //
Generic GeometricField class.
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
Definition: cloud.H:63
Base class for clouds which are coupled to a fluid.
Definition: coupled.H:60
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
Finite volume model abstract base class.
Definition: fvModel.H:60
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:69
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:57
static const word & fieldName()
Return the name of the field associated with a source term. Special.
Definition: fvModelI.H:49
Cloud(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
TypeName("Cloud")
Run-time type information.
Empty template class used to template the constructor on the type.
Finite volume model that solves for the evolution of a cloud. Provides two-way coupling with a finite...
Definition: cloud_fvModel.H:56
virtual bool movePoints()
Update for mesh motion.
virtual void correct()
Add a source term to an equation.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
TypeName("cloud")
Run-time type information.
virtual void preUpdateMesh()
Prepare for mesh update.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual ~cloud()
Destructor.
Definition: cloud_fvModel.C:81
virtual void addSup(fvMatrix< scalar > &eqn) const
Add a source term to a field-less proxy equation.
cloud(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict, const Cloud< Type > &)
Construct from components.
virtual bool addsSupToField(const word &fieldName) const
Return true if the fvModel adds a source term to the given.
Definition: cloud_fvModel.C:87
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.
A class for handling words, derived from string.
Definition: word.H:62
#define DEFINE_FV_MODEL_ADD_ALPHA_RHO_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:62
#define DEFINE_FV_MODEL_ADD_RHO_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:43
#define DEFINE_FV_MODEL_ADD_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:26
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
labelList fv(nPoints)
dictionary dict