All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2022 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  //- Name of the density field
121  const word rhoName_;
122 
123  //- Name of the velocity field
124  const word UName_;
125 
126  //- The Lagrangian cloud list
127  mutable autoPtr<parcelCloudList> cloudsPtr_;
128 
129  //- Current time index (used for updating)
130  mutable label curTimeIndex_;
131 
132 
133 public:
134 
135  //- Runtime type information
136  TypeName("clouds");
137 
138 
139  // Constructors
140 
141  //- Construct from explicit source name and mesh
142  clouds
143  (
144  const word& sourceName,
145  const word& modelType,
146  const dictionary& dict,
147  const fvMesh& mesh
148  );
149 
150  //- Disallow default bitwise copy construction
151  clouds
152  (
153  const clouds&
154  ) = delete;
155 
156 
157  // Member Functions
158 
159  // Checks
160 
161  //- Return the list of fields for which the option adds source term
162  // to the transport equation
163  virtual wordList addSupFields() const;
164 
165 
166  // Correct
167 
168  //- Solve the Lagrangian clouds and update the sources
169  virtual void correct();
170 
171 
172  // Add explicit and implicit contributions to compressible equation
173 
174  //- Add source to continuity equation
175  virtual void addSup
176  (
177  fvMatrix<scalar>& eqn,
178  const word& fieldName
179  ) const;
180 
181  //- Add source to enthalpy or species equation
182  virtual void addSup
183  (
184  const volScalarField& rho,
185  fvMatrix<scalar>& eqn,
186  const word& fieldName
187  ) const;
188 
189  //- Add source to incompressible momentum equation
190  virtual void addSup
191  (
192  fvMatrix<vector>& eqn,
193  const word& fieldName
194  ) const;
195 
196  //- Add source to compressible momentum equation
197  virtual void addSup
198  (
199  const volScalarField& rho,
200  fvMatrix<vector>& eqn,
201  const word& fieldName
202  ) const;
203 
204 
205  // Mesh changes
206 
207  //- Prepare for mesh update
208  virtual void preUpdateMesh();
209 
210  //- Update topology using the given map
211  virtual void topoChange(const polyTopoChangeMap&);
212 
213  //- Update from another mesh using the given map
214  virtual void mapMesh(const polyMeshMap&);
215 
216  //- Redistribute or update using the given distribution map
217  virtual void distribute(const polyDistributionMap&);
218 
219  //- Update for mesh motion
220  virtual bool movePoints();
221 
222 
223  // Member Operators
224 
225  //- Disallow default bitwise assignment
226  void operator=(const clouds&) = delete;
227 };
228 
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 } // End namespace fv
233 } // End namespace Foam
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #endif
238 
239 // ************************************************************************* //
clouds(const word &sourceName, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
Definition: clouds.C:52
dictionary dict
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: clouds.C:337
TypeName("clouds")
Runtime type information.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: clouds.C:333
UniformDimensionedField< vector > uniformDimensionedVectorField
virtual void preUpdateMesh()
Prepare for mesh update.
Definition: clouds.C:326
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
This fvModel adds any number of Lagrangian clouds to any single-phase solver. The particles are track...
Definition: clouds.H:112
virtual void addSup(fvMatrix< scalar > &eqn, const word &fieldName) const
Add source to continuity equation.
Definition: clouds.C:200
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
void operator=(const clouds &)=delete
Disallow default bitwise assignment.
virtual void correct()
Solve the Lagrangian clouds and update the sources.
Definition: clouds.C:181
virtual wordList addSupFields() const
Return the list of fields for which the option adds source term.
Definition: clouds.C:148
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
virtual bool movePoints()
Update for mesh motion.
Definition: clouds.C:347
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
A class for managing temporary objects without reference counting.
Definition: tmpNrc.H:52
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: clouds.C:341
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A class for managing temporary objects.
Definition: PtrList.H:53
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:50
Namespace for OpenFOAM.