parcelCloudList.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) 2020-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 "parcelCloudList.H"
28 #include "wordIOList.H"
29 #include "fvMatrices.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
34 
36 
38 
39 
40 // * * * * * * * * * * Private Static Member Functions * * * * * * * * * * * //
41 
42 Foam::wordList Foam::parcelCloudList::cloudNames(const objectRegistry& db)
43 {
44  typeIOobject<wordGlobalIOList> cloudNamesIO
45  (
47  db.time().constant(),
48  db,
51  );
52 
53  if (cloudNamesIO.headerOk())
54  {
55  return wordGlobalIOList(cloudNamesIO);
56  }
57 
58  typeIOobject<IOdictionary> cloudIO
59  (
60  defaultCloudName + "Properties",
61  db.time().constant(),
62  db,
65  );
66 
67  if (cloudIO.headerOk())
68  {
69  return wordList(1, defaultCloudName);
70  }
71 
73  << "Cloud properties were not found in either "
74  << cloudNamesIO.relativeObjectPath() << " or "
75  << cloudIO.relativeObjectPath() << exit(FatalError);
76 
77  return wordList::null();
78 }
79 
80 
81 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
82 
84 (
85  const wordList& cloudNames,
86  const volScalarField& rho,
87  const volVectorField& U,
88  const volScalarField& mu,
89  const dimensionedVector& g
90 )
91 :
93  mesh_(rho.mesh())
94 {
95  this->setSize(cloudNames.size());
96 
97  forAll(cloudNames, i)
98  {
99  this->set(i, parcelCloud::New(cloudNames[i], rho, U, mu, g));
100  }
101 }
102 
103 
105 (
106  const wordList& cloudNames,
107  const volScalarField& rho,
108  const volVectorField& U,
109  const dimensionedVector& g,
110  const fluidThermo& carrierThermo
111 )
112 :
113  PtrList<parcelCloud>(),
114  mesh_(rho.mesh())
115 {
116  this->setSize(cloudNames.size());
117 
118  forAll(cloudNames, i)
119  {
120  this->set(i, parcelCloud::New(cloudNames[i], rho, U, g, carrierThermo));
121  }
122 }
123 
124 
126 (
127  const volScalarField& rho,
128  const volVectorField& U,
129  const volScalarField& mu,
130  const dimensionedVector& g
131 )
132 :
133  parcelCloudList(cloudNames(rho.mesh()), rho, U, mu, g)
134 {}
135 
136 
138 (
139  const volScalarField& rho,
140  const volVectorField& U,
141  const dimensionedVector& g,
142  const fluidThermo& carrierThermo
143 )
144 :
145  parcelCloudList(cloudNames(rho.mesh()), rho, U, g, carrierThermo)
146 {}
147 
148 
149 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
150 
152 {}
153 
154 
155 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
156 
158 {
159  tmp<volScalarField> ttheta
160  (
162  (
163  cloudNamesName + ":alpha",
164  mesh_,
167  )
168  );
169  forAll(*this, i)
170  {
171  ttheta.ref() += operator[](i).alpha();
172  }
173  return ttheta;
174 }
175 
176 
178 (
179  const volVectorField& U
180 ) const
181 {
183  (
185  );
186 
187  forAll(*this, i)
188  {
189  tSU.ref() += operator[](i).SU(U);
190  }
191 
192  return tSU;
193 }
194 
195 
197 {
199  (
201  (
202  cloudNamesName + ":UTrans",
203  mesh_,
205  )
206  );
207  forAll(*this, i)
208  {
209  tUTrans.ref() += operator[](i).UTrans();
210  }
211  return tUTrans;
212 }
213 
214 
216 {
218  (
220  (
221  cloudNamesName + ":UCoeff",
222  mesh_,
224  )
225  );
226  forAll(*this, i)
227  {
228  tUCoeff.ref() += operator[](i).UCoeff();
229  }
230  return tUCoeff;
231 }
232 
233 
235 (
236  const volScalarField& hs
237 ) const
238 {
240  forAll(*this, i)
241  {
242  tSh.ref() += operator[](i).Sh(hs);
243  }
244  return tSh;
245 }
246 
247 
249 {
251  (
253  (
254  cloudNamesName + ":hsTrans",
255  mesh_,
257  )
258  );
259  forAll(*this, i)
260  {
261  thsTrans.ref() += operator[](i).hsTrans();
262  }
263  return thsTrans;
264 }
265 
266 
268 {
270  (
272  (
273  cloudNamesName + ":hsCoeff",
274  mesh_,
276  )
277  );
278  forAll(*this, i)
279  {
280  thsCoeff.ref() += operator[](i).hsCoeff();
281  }
282  return thsCoeff;
283 }
284 
285 
287 {
289  (
291  (
292  cloudNamesName + ":radiation:Ep",
293  mesh_,
295  (
299  Zero
300  )
301  )
302  );
303  forAll(*this, i)
304  {
305  tEp.ref() += operator[](i).Ep();
306  }
307  return tEp;
308 }
309 
310 
312 {
314  (
316  (
317  cloudNamesName + ":radiation:ap",
318  mesh_,
320  )
321  );
322  forAll(*this, i)
323  {
324  tap.ref() += operator[](i).ap();
325  }
326  return tap;
327 
328 }
329 
330 
332 {
333  tmp<volScalarField> tsigmap
334  (
336  (
337  cloudNamesName + ":radiation:sigmap",
338  mesh_,
340  )
341  );
342  forAll(*this, i)
343  {
344  tsigmap.ref() += operator[](i).sigmap();
345  }
346  return tsigmap;
347 }
348 
349 
351 (
352  const label speciei,
353  const volScalarField& Yi
354 ) const
355 {
357  (
359  );
360 
361  forAll(*this, i)
362  {
363  tSYi.ref() += operator[](i).SYi(speciei, Yi);
364  }
365 
366  return tSYi;
367 }
368 
369 
371 (
372  const volScalarField& rho
373 ) const
374 {
376  (
377  rho,
379  );
380 
381  forAll(*this, i)
382  {
383  tSrho.ref() += operator[](i).Srho(rho);
384  }
385 
386  return tSrho;
387 }
388 
389 
391 {
393  (
395  (
396  cloudNamesName + ":Srho",
397  mesh_,
399  )
400  );
401  forAll(*this, i)
402  {
403  tSrho.ref() += operator[](i).Srho();
404  }
405  return tSrho;
406 }
407 
408 
410 {
411  forAll(*this, i)
412  {
413  operator[](i).info();
414  }
415 }
416 
417 
419 {
420  forAll(*this, i)
421  {
422  operator[](i).evolve();
423  }
424 }
425 
426 
428 {
429  forAll(*this, i)
430  {
431  if (operator[](i).coupled())
432  {
433  return true;
434  }
435  }
436  return false;
437 }
438 
439 
441 {
442  forAll(*this, i)
443  {
444  operator[](i).storeGlobalPositions();
445  }
446 }
447 
448 
450 {
451  forAll(*this, i)
452  {
453  operator[](i).topoChange(map);
454  }
455 }
456 
457 
459 {
460  forAll(*this, i)
461  {
462  operator[](i).mapMesh(map);
463  }
464 }
465 
466 
468 {
469  forAll(*this, i)
470  {
471  operator[](i).distribute(map);
472  }
473 }
474 
475 
476 // ************************************************************************* //
scalar hs(const scalar p, const scalar T) const
Definition: EtoHthermo.H:11
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const GeoMesh &mesh, const dimensionSet &, const PrimitiveField< Type > &)
Return a temporary field constructed from name, mesh,.
Generic GeometricField class.
static tmp< GeometricField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Internal &, const PtrList< Patch > &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
bool set(const label) const
Is element set.
Definition: PtrListI.H:62
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Definition: PtrList.C:131
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:56
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
List of parcel clouds, with the same interface as an individual parcel cloud. This is the object that...
static const wordList defaultCloudNames
The default cloud names (i.e., a list of length one with the.
tmp< fvScalarMatrix > Sh(const volScalarField &hs) const
Return sensible enthalpy source term [J/s].
tmp< volScalarField::Internal > UCoeff() const
Momentum transfer coefficient [kg].
tmp< volVectorField::Internal > UTrans() const
Momentum transfer [kg m/s].
~parcelCloudList()
Destructor.
const tmp< volScalarField > alpha() const
Return the particle volume fraction field.
void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
tmp< fvScalarMatrix > SYi(const label speciei, const volScalarField &Yi) const
Return mass source term for specie [kg/s].
void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
tmp< volScalarField > sigmap() const
Return equivalent particulate scattering factor [1/m].
void evolve()
Evolve the cloud.
parcelCloudList(const wordList &cloudNames, const volScalarField &rho, const volVectorField &U, const volScalarField &mu, const dimensionedVector &g)
Construct specified clouds with given carrier fields.
tmp< volScalarField::Internal > hsCoeff() const
Sensible enthalpy transfer coefficient [J/K].
static const word defaultCloudName
The default cloud name.
bool coupled()
Does this cloud provide source terms to the carrier?
void info()
Print cloud information.
tmp< fvVectorMatrix > SU(const volVectorField &U) const
Return momentum source term [kg m/s^2].
tmp< volScalarField::Internal > Srho() const
Return total mass source [kg/m^3/s].
void storeGlobalPositions()
Call this before a topology change. Stores the particles global.
tmp< volScalarField > Ep() const
Return equivalent particulate emission [kg/m/s^3].
tmp< volScalarField::Internal > hsTrans() const
Sensible enthalpy transfer [J].
static const word cloudNamesName
The name of the clouds file in which multiple cloud names are.
tmp< volScalarField > ap() const
Return equivalent particulate absorption [1/m].
Virtual abstract base class for parcel clouds. As parcelCloudBase but with additional virtualisation ...
Definition: parcelCloud.H:57
static autoPtr< parcelCloud > New(const word &name, const volScalarField &rho, const volVectorField &U, const volScalarField &mu, const dimensionedVector &g)
Selectors.
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.
Definition: tmp.H:55
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:197
A class for handling words, derived from string.
Definition: word.H:63
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
A special matrix type and solver, designed for finite volume solutions of scalar equations.
U
Definition: pEqn.H:72
rho
Definition: pEqn.H:1
const dimensionedScalar mu
Atomic mass unit.
const dimensionSet density
const dimensionSet dimless
const dimensionSet time
const dimensionSet mass
const dimensionSet length
const dimensionSet momentum
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
static const zero Zero
Definition: zero.H:97
List< word > wordList
A List of words.
Definition: fileName.H:54
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
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
GlobalIOList< word > wordGlobalIOList
Definition: wordIOList.H:44
fvMatrix< vector > fvVectorMatrix
Definition: fvMatricesFwd.H:45
const dimensionSet & dimAcceleration
Definition: dimensions.C:287
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
void pow3(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
const dimensionSet & dimEnergy
Definition: dimensions.C:291
error FatalError
const dimensionSet & dimTemperature
Definition: dimensions.C:278
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.