clouds.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) 2021-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::fv::clouds
26 
27 Description
28  This fvModel adds any number of Lagrangian clouds to any single-phase
29  solver. The particles are tracked through, and exchange sources with, the
30  Eulerian flow field.
31 
32  As well as the fvModel controls, properties must be specified for each
33  cloud. For a single cloud, these should be provided in the
34  constant/cloudProperties file. For multiple clouds, the list of cloud names
35  must first be provided in the constant/clouds file. Then, each named cloud
36  has its properties specified in its constant/<cloudName>Properties file.
37 
38  The application of sources to the Eulerian fields is controlled by the
39  solution/coupled switch in each cloud's properties file. If set to "true"
40  then the Eulerian phase will have forces, and heat and mass sources applied
41  to it by the Lagrangian phase. If set to "false" then these will be omitted,
42  and the Lagrangian phase will not affect the Eulerian phase.
43 
44  If this model is used with an incompressible solver, then the density of
45  the Eulerian phase must be specified in the constant/physicalProperties
46  dictionary.
47 
48  Gravity will be read from the constant/g file if present, otherwise it will
49  default to zero.
50 
51 Usage
52  Example usage:
53  \verbatim
54  clouds
55  {
56  libs ("liblagrangianParcel.so");
57  type clouds;
58  }
59  \endverbatim
60 
61  \table
62  Property | Description | Required | Default value
63  type | Type name: clouds | yes |
64  rho | Name of the density field | no | rho
65  U | Name of the velocity field | no | U
66  \endtable
67 
68 SourceFiles
69  clouds.C
70 
71 \*---------------------------------------------------------------------------*/
72 
73 #ifndef clouds_H
74 #define clouds_H
75 
76 #include "fvModel.H"
77 #include "fluidThermo.H"
78 #include "viscosityModel.H"
80 #include "parcelCloudList.H"
81 
82 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
83 
84 namespace Foam
85 {
86 namespace fv
87 {
88 
89 /*---------------------------------------------------------------------------*\
90  Class clouds Declaration
91 \*---------------------------------------------------------------------------*/
92 
93 class clouds
94 :
95  public fvModel
96 {
97  // Private Data
98 
99  //- Optional acceleration due to gravity
101 
102  //- Flag to indicate whether a thermo model is available for the
103  // carrier
104  const bool carrierHasThermo_;
105 
106  //- Reference to the carrier phase thermo. Valid only if the carrier
107  // has thermo.
108  const tmpNrc<fluidThermo> tCarrierThermo_;
109 
110  //- Reference to the carrier viscosity model. Valid only if the carrier
111  // does not have thermo.
112  const tmpNrc<viscosityModel> tCarrierViscosity_;
113 
114  //- Density field. Valid only if the carrier does not have thermo.
115  const tmp<volScalarField> tRho_;
116 
117  //- Viscosity field. Valid only if the carrier does not have thermo.
118  tmp<volScalarField> tMu_;
119 
120  //- Names of the clouds
121  const wordList cloudNames_;
122 
123  //- Name of the density field
124  const word rhoName_;
125 
126  //- Name of the velocity field
127  const word UName_;
128 
129  //- The Lagrangian cloud list
130  mutable autoPtr<parcelCloudList> cloudsPtr_;
131 
132  //- Current time index (used for updating)
133  mutable label curTimeIndex_;
134 
135 
136 public:
137 
138  //- Runtime type information
139  TypeName("clouds");
140 
141 
142  // Constructors
143 
144  //- Construct from explicit source name and mesh
145  clouds
146  (
147  const word& sourceName,
148  const word& modelType,
149  const fvMesh& mesh,
150  const dictionary& dict
151  );
152 
153  //- Disallow default bitwise copy construction
154  clouds
155  (
156  const clouds&
157  ) = delete;
158 
159 
160  // Member Functions
161 
162  // Checks
163 
164  //- Return the list of fields for which the option adds source term
165  // to the transport equation
166  virtual wordList addSupFields() const;
167 
168 
169  // Correct
170 
171  //- Solve the Lagrangian clouds and update the sources
172  virtual void correct();
173 
174 
175  // Add explicit and implicit contributions to compressible equation
176 
177  //- Add source to continuity equation
178  virtual void addSup
179  (
180  fvMatrix<scalar>& eqn,
181  const word& fieldName
182  ) const;
183 
184  //- Add source to enthalpy or species equation
185  virtual void addSup
186  (
187  const volScalarField& rho,
188  fvMatrix<scalar>& eqn,
189  const word& fieldName
190  ) const;
191 
192  //- Add source to incompressible momentum equation
193  virtual void addSup
194  (
195  fvMatrix<vector>& eqn,
196  const word& fieldName
197  ) const;
198 
199  //- Add source to compressible momentum equation
200  virtual void addSup
201  (
202  const volScalarField& rho,
203  fvMatrix<vector>& eqn,
204  const word& fieldName
205  ) const;
206 
207 
208  // Mesh changes
209 
210  //- Prepare for mesh update
211  virtual void preUpdateMesh();
212 
213  //- Update topology using the given map
214  virtual void topoChange(const polyTopoChangeMap&);
215 
216  //- Update from another mesh using the given map
217  virtual void mapMesh(const polyMeshMap&);
218 
219  //- Redistribute or update using the given distribution map
220  virtual void distribute(const polyDistributionMap&);
221 
222  //- Update for mesh motion
223  virtual bool movePoints();
224 
225 
226  // Member Operators
227 
228  //- Disallow default bitwise assignment
229  void operator=(const clouds&) = delete;
230 };
231 
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 } // End namespace fv
236 } // End namespace Foam
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 #endif
241 
242 // ************************************************************************* //
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
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:101
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
This fvModel adds any number of Lagrangian clouds to any single-phase solver. The particles are track...
Definition: clouds.H:115
virtual bool movePoints()
Update for mesh motion.
Definition: clouds.C:361
virtual wordList addSupFields() const
Return the list of fields for which the option adds source term.
Definition: clouds.C:158
void operator=(const clouds &)=delete
Disallow default bitwise assignment.
virtual void correct()
Solve the Lagrangian clouds and update the sources.
Definition: clouds.C:191
virtual void addSup(fvMatrix< scalar > &eqn, const word &fieldName) const
Add source to continuity equation.
Definition: clouds.C:210
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: clouds.C:343
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: clouds.C:355
virtual void preUpdateMesh()
Prepare for mesh update.
Definition: clouds.C:336
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: clouds.C:349
TypeName("clouds")
Runtime type information.
clouds(const word &sourceName, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
Definition: clouds.C:52
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 managing temporary objects without reference counting.
Definition: tmpNrc.H:53
A class for managing temporary objects.
Definition: tmp.H:55
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
UniformDimensionedField< vector > uniformDimensionedVectorField
labelList fv(nPoints)
dictionary dict