ReactingParcel.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2016-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::ReactingParcel
29
30Group
31 grpLagrangianIntermediateParcels
32
33Description
34 Reacting parcel class with one/two-way coupling with the continuous
35 phase.
36
37SourceFiles
38 ReactingParcelI.H
39 ReactingParcel.C
40 ReactingParcelIO.C
41
42\*---------------------------------------------------------------------------*/
43
44#ifndef ReactingParcel_H
45#define ReactingParcel_H
46
47#include "particle.H"
48#include "SLGThermo.H"
49#include "demandDrivenEntry.H"
50
51// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52
53namespace Foam
54{
55
56template<class ParcelType>
57class ReactingParcel;
58
59template<class ParcelType>
60Ostream& operator<<
61(
62 Ostream&,
64);
65
66
67/*---------------------------------------------------------------------------*\
68 Class ReactingParcel Declaration
69\*---------------------------------------------------------------------------*/
70
71template<class ParcelType>
73:
74 public ParcelType
75{
76public:
77
78 //- Size in bytes of the fields
79 static const std::size_t sizeofFields;
80
81
82
83 //- Class to hold reacting parcel constant properties
85 :
86 public ParcelType::constantProperties
87 {
88 public:
89
90 //- Type of activity coefficient models
92 {
97 };
98
99 private:
100
101 // Private Data
102
103 //- Minimum pressure [Pa]
105
106 //- Method to update particle rho and diameter
107 //- 0: constant rho
108 //- 1: constant volume
109 //- 2: recalculation of rho and volume based on the lost mass
110 demandDrivenEntry<bool> constantVolume_;
111
112 //- Method to update vol and rho
113 demandDrivenEntry<label> volUpdateType_;
114
115
116 public:
117
118 // Constructors
119
120 //- Null constructor
122
123 //- Copy constructor
125
126 //- Construct from dictionary
127 constantProperties(const dictionary& parentDict);
128
129
130 // Access
131
132 //- Return const access to the minimum pressure
133 inline scalar pMin() const;
134
135 //- Return const access to the constant volume flag
136 inline bool constantVolume() const;
137
138 //- Return const access to the constant volume flag
139 inline label volUpdateType() const;
140 };
141
143 class trackingData
144 :
146 {
147 private:
148
149 // Private data
150
151 // Interpolators for continuous phase fields
152
153 //- Interpolator for continuous phase pressure field
155
156
157 // Cached continuous phase properties
158
159 //- Pressure [Pa]
160 scalar pc_;
161
162
163 public:
165 typedef typename ParcelType::trackingData::trackPart trackPart;
166
167 // Constructors
168
169 //- Construct from components
170 template<class TrackCloudType>
171 inline trackingData
172 (
173 const TrackCloudType& cloud,
174 trackPart part = ParcelType::trackingData::tpLinearTrack
175 );
176
177
178 // Member functions
179
180 //- Return const access to the interpolator for continuous phase
181 // pressure field
182 inline const interpolation<scalar>& pInterp() const;
183
184 //- Return the continuous phase pressure
185 inline scalar pc() const;
186
187 //- Access the continuous phase pressure
188 inline scalar& pc();
189 };
190
191
192protected:
193
194 // Protected data
195
196 // Parcel properties
197
198 //- Initial mass [kg]
199 scalar mass0_;
200
201 //- Mass fractions of mixture []
203
204
205 // Protected Member Functions
206
207 //- Return change of volume due to mass exchange
208 template<class TrackCloudType>
209 scalar updatedDeltaVolume
210 (
211 TrackCloudType& cloud,
212 const scalarField& dMass,
213 const scalar p,
214 const scalar T
215 );
216
217
218 //- Calculate Phase change
219 template<class TrackCloudType>
220 void calcPhaseChange
221 (
222 TrackCloudType& cloud,
223 trackingData& td,
224 const scalar dt, // timestep
225 const scalar Re, // Reynolds number
226 const scalar Pr, // Prandtl number
227 const scalar Ts, // Surface temperature
228 const scalar nus, // Surface kinematic viscosity
229 const scalar d, // diameter
230 const scalar T, // temperature
231 const scalar mass, // mass
232 const scalar rho, // density
233 const label idPhase, // id of phase involved in phase change
234 const scalar YPhase, // total mass fraction
235 const scalarField& YLiq, // liquid component mass fractions
236 const scalarField& YSol, // solid component mass fractions
237 scalarField& dMassPC, // mass transfer - local to parcel
238 scalar& Sh, // explicit parcel enthalpy source
239 scalar& N, // flux of species emitted from parcel
240 scalar& NCpW, // sum of N*Cp*W of emission species
241 scalarField& Cs // carrier conc. of emission species
242 );
243
244 //- Update mass fraction
245 scalar updateMassFraction
246 (
247 const scalar mass0,
248 const scalarField& dMass,
250 ) const;
251
252
253public:
254
255 // Static data members
256
257 //- Runtime type information
258 TypeName("ReactingParcel");
259
260 //- String representation of properties
262 (
263 ParcelType,
264 " mass0"
265 + " nPhases(Y1..YN)"
266 );
267
268
269 // Constructors
270
271 //- Construct from mesh, coordinates and topology
272 // Other properties initialised as null
273 inline ReactingParcel
274 (
275 const polyMesh& mesh,
277 const label celli,
278 const label tetFacei,
279 const label tetPti
280 );
281
282 //- Construct from a position and a cell, searching for the rest of the
283 // required topology. Other properties are initialised as null.
284 inline ReactingParcel
285 (
286 const polyMesh& mesh,
287 const vector& position,
288 const label celli
289 );
290
291 //- Construct from components
292 inline ReactingParcel
293 (
294 const polyMesh& mesh,
296 const label celli,
297 const label tetFacei,
298 const label tetPti,
299 const label typeId,
300 const scalar nParticle0,
301 const scalar d0,
302 const scalar dTarget0,
303 const vector& U0,
304 const vector& f0,
305 const vector& angularMomentum0,
306 const vector& torque0,
307 const scalarField& Y0,
308 const constantProperties& constProps
309 );
310
311 //- Construct from Istream
313 (
314 const polyMesh& mesh,
315 Istream& is,
316 bool readFields = true,
317 bool newFormat = true
318 );
319
320 //- Construct as a copy
322 (
323 const ReactingParcel& p,
324 const polyMesh& mesh
325 );
326
327 //- Construct as a copy
329
330 //- Construct and return a (basic particle) clone
331 virtual autoPtr<particle> clone() const
332 {
334 }
335
336 //- Construct and return a (basic particle) clone
337 virtual autoPtr<particle> clone(const polyMesh& mesh) const
338 {
339 return autoPtr<particle>
340 (
342 );
343 }
344
345 //- Factory class to read-construct particles used for
346 // parallel transfer
347 class iNew
348 {
349 const polyMesh& mesh_;
350
351 public:
353 iNew(const polyMesh& mesh)
354 :
355 mesh_(mesh)
356 {}
359 {
361 (
362 new ReactingParcel<ParcelType>(mesh_, is, true)
363 );
364 }
365 };
366
367
368 // Member Functions
369
370 // Access
371
372 //- Return const access to initial mass [kg]
373 inline scalar mass0() const;
374
375 //- Return const access to mass fractions of mixture []
376 inline const scalarField& Y() const;
377
378 //- Return const access to mass fractions of gases
379 // Note: for compatibilty only - returns Y()
380 inline const scalarField& YGas() const;
381
382 //- Return const access to mass fractions of liquids
383 // Note: for compatibilty only - returns Y()
384 inline const scalarField& YLiquid() const;
385
386 //- Return const access to mass fractions of solids
387 // Note: for compatibilty only - returns Y()
388 inline const scalarField& YSolid() const;
389
390
391 // Edit
392
393 //- Return access to initial mass [kg]
394 inline scalar& mass0();
395
396 //- Return access to mass fractions of mixture []
397 inline scalarField& Y();
398
399
400 // Main calculation loop
401
402 //- Set cell values
403 template<class TrackCloudType>
404 void setCellValues(TrackCloudType& cloud, trackingData& td);
405
406 //- Correct cell values using latest transfer information
407 template<class TrackCloudType>
409 (
410 TrackCloudType& cloud,
411 trackingData& td,
412 const scalar dt
413 );
414
415 //- Correct surface values due to emitted species
416 template<class TrackCloudType>
418 (
419 TrackCloudType& cloud,
420 trackingData& td,
421 const scalar T,
422 const scalarField& Cs,
423 scalar& rhos,
424 scalar& mus,
425 scalar& Prs,
426 scalar& kappas
427 );
428
429 //- Update parcel properties over the time interval
430 template<class TrackCloudType>
431 void calc
432 (
433 TrackCloudType& cloud,
434 trackingData& td,
435 const scalar dt
436 );
437
438
439 // I-O
440
441 //- Read - composition supplied
442 template<class CloudType, class CompositionType>
443 static void readFields
444 (
445 CloudType& c,
446 const CompositionType& compModel
447 );
448
449 //- Read - no composition
450 template<class CloudType>
451 static void readFields(CloudType& c);
452
453 //- Write - composition supplied
454 template<class CloudType, class CompositionType>
455 static void writeFields
456 (
457 const CloudType& c,
458 const CompositionType& compModel
459 );
460
461 //- Write - no composition
462 template<class CloudType>
463 static void writeFields(const CloudType& c);
464
465 //- Write individual parcel properties to stream
466 void writeProperties
467 (
468 Ostream& os,
469 const wordRes& filters,
470 const word& delim,
471 const bool namesOnly = false
472 ) const;
473
474 //- Read particle fields as objects from the obr registry
475 // - no composition
476 template<class CloudType>
477 static void readObjects
478 (
479 CloudType& c,
480 const objectRegistry& obr
481 );
482
483 //- Read particle fields as objects from the obr registry
484 template<class CloudType, class CompositionType>
485 static void readObjects
486 (
487 CloudType& c,
488 const CompositionType& compModel,
489 const objectRegistry& obr
490 );
491
492 //- Write particle fields as objects into the obr registry
493 // - no composition
494 template<class CloudType>
495 static void writeObjects
496 (
497 const CloudType& c,
498 objectRegistry& obr
499 );
500
501 //- Write particle fields as objects into the obr registry
502 template<class CloudType, class CompositionType>
503 static void writeObjects
504 (
505 const CloudType& c,
506 const CompositionType& compModel,
507 objectRegistry& obr
508 );
509
510
511 // Ostream Operator
513 friend Ostream& operator<< <ParcelType>
514 (
515 Ostream&,
517 );
518};
519
520
521// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
522
523} // End namespace Foam
524
525// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
526
527#include "ReactingParcelI.H"
529
530// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
531
532#ifdef NoRepository
533 #include "ReactingParcel.C"
534#endif
535
536// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
537
538#endif
539
540// ************************************************************************* //
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Class to hold reacting parcel constant properties.
label volUpdateType() const
Return const access to the constant volume flag.
bool constantVolume() const
Return const access to the constant volume flag.
scalar pMin() const
Return const access to the minimum pressure.
volumeUpdateType
Type of activity coefficient models.
Factory class to read-construct particles used for.
iNew(const polyMesh &mesh)
autoPtr< ReactingParcel< ParcelType > > operator()(Istream &is) const
scalar pc() const
Return the continuous phase pressure.
const interpolation< scalar > & pInterp() const
Return const access to the interpolator for continuous phase.
ParcelType::trackingData::trackPart trackPart
Reacting parcel class with one/two-way coupling with the continuous phase.
AddToPropertyList(ParcelType, " mass0"+" nPhases(Y1..YN)")
String representation of properties.
virtual autoPtr< particle > clone(const polyMesh &mesh) const
Construct and return a (basic particle) clone.
static void writeObjects(const CloudType &c, objectRegistry &obr)
Write particle fields as objects into the obr registry.
void cellValueSourceCorrection(TrackCloudType &cloud, trackingData &td, const scalar dt)
Correct cell values using latest transfer information.
virtual autoPtr< particle > clone() const
Construct and return a (basic particle) clone.
static const std::size_t sizeofFields
Size in bytes of the fields.
static void writeFields(const CloudType &c, const CompositionType &compModel)
Write - composition supplied.
const scalarField & Y() const
Return const access to mass fractions of mixture [].
scalar updatedDeltaVolume(TrackCloudType &cloud, const scalarField &dMass, const scalar p, const scalar T)
Return change of volume due to mass exchange.
ReactingParcel(const ReactingParcel &p, const polyMesh &mesh)
Construct as a copy.
void correctSurfaceValues(TrackCloudType &cloud, trackingData &td, const scalar T, const scalarField &Cs, scalar &rhos, scalar &mus, scalar &Prs, scalar &kappas)
Correct surface values due to emitted species.
scalarField Y_
Mass fractions of mixture [].
static void readObjects(CloudType &c, const objectRegistry &obr)
Read particle fields as objects from the obr registry.
const scalarField & YGas() const
Return const access to mass fractions of gases.
scalar updateMassFraction(const scalar mass0, const scalarField &dMass, scalarField &Y) const
Update mass fraction.
scalar mass0() const
Return const access to initial mass [kg].
void setCellValues(TrackCloudType &cloud, trackingData &td)
Set cell values.
void calcPhaseChange(TrackCloudType &cloud, trackingData &td, const scalar dt, const scalar Re, const scalar Pr, const scalar Ts, const scalar nus, const scalar d, const scalar T, const scalar mass, const scalar rho, const label idPhase, const scalar YPhase, const scalarField &YLiq, const scalarField &YSol, scalarField &dMassPC, scalar &Sh, scalar &N, scalar &NCpW, scalarField &Cs)
Calculate Phase change.
scalar mass0_
Initial mass [kg].
void writeProperties(Ostream &os, const wordRes &filters, const word &delim, const bool namesOnly=false) const
Write individual parcel properties to stream.
const scalarField & YSolid() const
Return const access to mass fractions of solids.
const scalarField & YLiquid() const
Return const access to mass fractions of liquids.
static void readFields(CloudType &c, const CompositionType &compModel)
Read - composition supplied.
TypeName("ReactingParcel")
Runtime type information.
ReactingParcel(const ReactingParcel &p)
Construct as a copy.
void calc(TrackCloudType &cloud, trackingData &td, const scalar dt)
Update parcel properties over the time interval.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:60
Class for demand-driven dictionary entries.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Class used to pass data into container.
Abstract base class for volume field interpolation.
Definition: interpolation.H:60
Registry of regIOobjects.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:54
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
dynamicFvMesh & mesh
PtrList< coordinateSystem > coordinates(solidRegions.size())
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
scalarField Re(const UList< complex > &cf)
Extract real component.
Definition: complexField.C:159
#define AddToPropertyList(ParcelType, str)
Add to existing static 'propertyList' for particle properties.
scalarList Y0(nSpecie, Zero)
const volScalarField & cp
const scalarField & Cs
dimensionedScalar Pr("Pr", dimless, laminarTransport)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73
const Vector< label > N(dict.get< Vector< label > >("N"))