phaseSystem.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) 2015-2019 OpenFOAM Foundation
9 Copyright (C) 2022 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::phaseSystem
29
30Description
31 Class to represent a system of phases and model interfacial transfers
32 between them.
33
34SourceFiles
35 phaseSystem.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef phaseSystem_H
40#define phaseSystem_H
41
42#include "IOdictionary.H"
43
44#include "phaseModel.H"
45#include "phasePair.H"
46#include "orderedPhasePair.H"
47#include "HashPtrTable.H"
48#include "PtrListDictionary.H"
49
50#include "IOMRFZoneList.H"
51#include "fvOptions.H"
52
53#include "volFields.H"
54#include "surfaceFields.H"
55#include "fvMatricesFwd.H"
56
57// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58
59namespace Foam
60{
61
62class blendingMethod;
63template<class modelType> class BlendedInterfacialModel;
64class aspectRatioModel;
65
66namespace reactingMultiphaseEuler
67{
68 class surfaceTensionModel;
69}
70/*---------------------------------------------------------------------------*\
71 Class phaseSystem Declaration
72\*---------------------------------------------------------------------------*/
74class phaseSystem
75:
76 public IOdictionary
77{
78public:
79
80 // Public typedefs
91
92 typedef
95
96
97protected:
98
99 // Protected typedefs
100
101 typedef
103 dictTable;
104
105 typedef
107
108 typedef
110 <
116
117 typedef
119 <
125
126
127 // Protected data
128
129 //- Reference to the mesh
130 const fvMesh& mesh_;
131
132 //- Phase models
134
135 //- Moving phase models
137
138 //- Stationary phase models
140
141 //- Anisothermal phase models
143
144 //- Multi-component phase models
146
147 //- Phase pairs
149
150 //- Total volumetric flux
152
153 //- Rate of change of pressure
155
156 //- Optional MRF zones
158
159 //- Blending methods
161
162
163 // Sub Models
164
165 //- Surface tension models
167
168 //- Aspect ratio models
170
171
172 // Protected member functions
173
174 //- Calculate and return the mixture flux
176 (
177 const phaseModelList& phaseModels
178 ) const;
179
180 //- Generate pairs
181 void generatePairs
182 (
183 const dictTable& modelDicts
184 );
185
186 //- Generate pairs and sub-model tables
187 template<class modelType>
188 void createSubModels
189 (
190 const dictTable& modelDicts,
192 <
196 >& models
197 );
198
199 //- Generate pairs and sub-model tables
200 template<class modelType>
202 (
203 const word& modelName,
205 <
209 >& models
210 );
211
212 //- Generate pairs and blended sub-model tables
213 template<class modelType>
215 (
216 const word& modelName,
218 <
222 >& models,
223 const bool correctFixedFluxBCs = true
224 );
225
226 //- Generate pairs and two-sided sub-model tables
227 template<class modelType>
229 (
230 const word& modelName,
232 <
236 >& models,
237 const bool correctFixedFluxBCs = true
238 );
239
240 //- Add the field to a phase-indexed list, with the given name,
241 // constructing if necessary
242 template<class GeoField>
243 void addField
244 (
245 const phaseModel& phase,
246 const word& fieldName,
248 PtrList<GeoField>& fieldList
249 ) const;
250
251 //- Add the field to a phase-indexed list, with the given name,
252 // constructing if necessary
253 template<class GeoField>
254 void addField
255 (
256 const phaseModel& phase,
257 const word& fieldName,
258 const GeoField& field,
259 PtrList<GeoField>& fieldList
260 ) const;
261
262 //- Add the field to a phase-indexed table, with the given name,
263 // constructing if necessary
264 template<class GeoField>
265 void addField
266 (
267 const phaseModel& phase,
268 const word& fieldName,
270 HashPtrTable<GeoField>& fieldTable
271 ) const;
272
273 //- Add the field to a phase-indexed table, with the given name,
274 // constructing if necessary
275 template<class GeoField>
276 void addField
277 (
278 const phaseModel& phase,
279 const word& fieldName,
280 const GeoField& field,
281 HashPtrTable<GeoField>& fieldTable
282 ) const;
283
284
285public:
286
287 //- Runtime type information
288 TypeName("phaseSystem");
289
290 //- Default name of the phase properties dictionary
291 static const word propertiesName;
292
293
294 // Constructors
295
296 //- Construct from fvMesh
297 phaseSystem(const fvMesh& mesh);
298
299
300 //- Destructor
301 virtual ~phaseSystem();
302
303
304 // Member Functions
305
306 // Access
307
308 //- Return the mesh
309 inline const fvMesh& mesh() const;
310
311 //- Return the phase models
312 inline const phaseModelList& phases() const;
313
314 //- Access the phase models
315 inline phaseModelList& phases();
316
317 //- Return the models for phases that are moving
318 inline const phaseModelPartialList& movingPhases() const;
319
320 //- Access the models for phases that are moving
322
323 //- Return the models for phases that are stationary
324 inline const phaseModelPartialList& stationaryPhases() const;
325
326 //- Access the models for phases that are stationary
328
329 //- Return the models for phases that have variable temperature
330 inline const phaseModelPartialList& anisothermalPhases() const;
331
332 //- Access the models for phases that have variable temperature
334
335 //- Return the models for phases that have multiple species
336 inline const phaseModelPartialList& multiComponentPhases() const;
337
338 //- Access the models for phases that have multiple species
340
341 //- Return the phase pairs
342 inline const phasePairTable& phasePairs() const;
343
344 //- Return the mixture flux
345 inline const surfaceScalarField& phi() const;
346
347 //- Access the mixture flux
348 inline surfaceScalarField& phi();
349
350 //- Return the rate of change of the pressure
351 inline const volScalarField& dpdt() const;
352
353 //- Access the rate of change of the pressure
354 inline volScalarField& dpdt();
355
356 //- Return MRF zones
357 inline const IOMRFZoneList& MRF() const;
358
359 //- Access the fvOptions
360 inline fv::options& fvOptions() const;
361
362
363 // Sub-model lookup
364
365 //- Check availability of a sub model for a given phase pair
366 template<class modelType>
367 bool foundSubModel(const phasePair& key) const;
368
369 //- Return a sub model between a phase pair
370 template<class modelType>
371 const modelType& lookupSubModel(const phasePair& key) const;
372
373 //- Check availability of a sub model between two phases
374 template<class modelType>
375 bool foundSubModel
376 (
377 const phaseModel& dispersed,
378 const phaseModel& continuous
379 ) const;
380
381 //- Return a sub model between two phases
382 template<class modelType>
383 const modelType& lookupSubModel
384 (
385 const phaseModel& dispersed,
386 const phaseModel& continuous
387 ) const;
388
389 //- Check availability of a blended sub model for a given phase pair
390 template<class modelType>
391 bool foundBlendedSubModel(const phasePair& key) const;
392
393 //- Return a blended sub model between a phase pair
394 template<class modelType>
396 lookupBlendedSubModel(const phasePair& key) const;
397
398
399 // Field construction
400
401 //- Fill up gaps in a phase-indexed list of fields with zeros
402 template
403 <
404 class Type,
405 template<class> class PatchField,
406 class GeoMesh
407 >
408 void fillFields
409 (
410 const word& name,
411 const dimensionSet& dims,
413 ) const;
414
415 //- Fill up gaps in a phase-indexed table of fields with zeros
416 template
417 <
418 class Type,
419 template<class> class PatchField,
420 class GeoMesh
421 >
422 void fillFields
423 (
424 const word& name,
425 const dimensionSet& dims,
427 fieldTable
428 ) const;
429
430
431 // Properties
432
433 //- Return the mixture density
434 tmp<volScalarField> rho() const;
435
436 //- Return the mixture velocity
437 tmp<volVectorField> U() const;
438
439 //- Return the aspect-ratio for a pair
440 tmp<volScalarField> E(const phasePairKey& key) const;
441
442 //- Return the surface tension coefficient for a pair
443 tmp<volScalarField> sigma(const phasePairKey& key) const;
444
445 //- Return the mass transfer rate for a pair
446 virtual tmp<volScalarField> dmdt(const phasePairKey& key) const;
447
448 //- Return the mass transfer rates for each phase
449 virtual PtrList<volScalarField> dmdts() const;
450
451
452 // Transfers
453
454 //- Return the momentum transfer matrices for the cell-based
455 // algorithm
457
458 //- Return the momentum transfer matrices for the face-based
459 // algorithm
461
462 //- Return the implicit force coefficients for the face-based
463 // algorithm
464 virtual PtrList<surfaceScalarField> AFfs() const = 0;
465
466 //- Return the force fluxes for the cell-based algorithm
468 (
470 ) = 0;
471
472 //- Return the force fluxes for the face-based algorithm
474 (
476 ) = 0;
477
478 //- Return the force fluxes for the cell-based algorithm
480 (
482 ) const = 0;
483
484 //- Return the force fluxes for the face-based algorithm
486 (
488 ) const = 0;
489
490 //- Return the explicit part of the drag force
492 (
494 ) const = 0;
495
496 //- Solve the drag system for the new velocities and fluxes
497 virtual void partialElimination
498 (
500 ) = 0;
501
502 //- Solve the drag system for the new fluxes
503 virtual void partialEliminationf
504 (
506 ) = 0;
507
508 //- Return the flux corrections for the cell-based algorithm
510 (
512 const bool includeVirtualMass = false
513 ) const = 0;
514
515 //- Return the phase diffusivities divided by the momentum
516 // coefficients
517 virtual const HashPtrTable<surfaceScalarField>& DByAfs() const = 0;
518
519 //- Return the heat transfer matrices
520 virtual autoPtr<heatTransferTable> heatTransfer() const = 0;
521
522 //- Return the mass transfer matrices
523 virtual autoPtr<massTransferTable> massTransfer() const = 0;
524
525
526 // Evolution
527
528 //- Solve for the phase fractions
529 virtual void solve();
530
531 //- Correct the fluid properties other than those listed below
532 virtual void correct();
533
534 //- Correct the kinematics
535 virtual void correctKinematics();
536
537 //- Correct the thermodynamics
538 virtual void correctThermo();
539
540 //- Correct the turbulence
541 virtual void correctTurbulence();
542
543 //- Correct the energy transport e.g. alphat
544 virtual void correctEnergyTransport();
545
546
547 // IO
548
549 //- Read base phaseProperties dictionary
550 virtual bool read();
551};
552
553
554// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
555
558
559// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
560
561} // End namespace Foam
562
563// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
564
565#include "phaseSystemI.H"
566
567// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
568
569#ifdef NoRepository
570 #include "phaseSystemTemplates.C"
571#endif
572
573// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
574
575#endif
576
577// ************************************************************************* //
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:49
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
Definition: HashPtrTable.H:68
A HashTable similar to std::unordered_map.
Definition: HashTable.H:123
List of MRF zones with IO functionality. MRF zones are specified by a list of dictionary entries,...
Definition: IOMRFZoneList.H:75
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:69
Template dictionary class which manages the storage associated with it.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: UPtrList.H:71
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
const word & name() const
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:109
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Finite-volume options.
Definition: fvOptions.H:59
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:61
An ordered or unorder pair of phase names. Typically specified as follows.
Definition: phasePairKey.H:68
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
Definition: phasePair.H:56
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:76
phaseModelPartialList stationaryPhaseModels_
Stationary phase models.
Definition: phaseSystem.H:138
void createSubModels(const dictTable &modelDicts, HashTable< autoPtr< modelType >, phasePairKey, phasePairKey::hash > &models)
Generate pairs and sub-model tables.
virtual void correctKinematics()
Correct the kinematics.
Definition: phaseSystem.C:376
virtual void correctEnergyTransport()
Correct the energy transport e.g. alphat.
Definition: phaseSystem.C:413
const phasePairTable & phasePairs() const
Return the phase pairs.
Definition: phaseSystemI.H:107
virtual PtrList< surfaceScalarField > phiKdPhifs(const PtrList< surfaceScalarField > &rAUfs) const =0
Return the force fluxes for the face-based algorithm.
virtual tmp< volScalarField > dmdt(const phasePairKey &key) const
Return the mass transfer rate for a pair.
Definition: phaseSystem.C:342
static const word propertiesName
Default name of the phase properties dictionary.
Definition: phaseSystem.H:290
HashTable< autoPtr< blendingMethod > > blendingMethodTable
Definition: phaseSystem.H:105
const IOMRFZoneList & MRF() const
Return MRF zones.
Definition: phaseSystemI.H:137
void generatePairs(const dictTable &modelDicts)
Generate pairs.
Definition: phaseSystem.C:76
const fvMesh & mesh_
Reference to the mesh.
Definition: phaseSystem.H:129
phaseModelList phaseModels_
Phase models.
Definition: phaseSystem.H:132
virtual PtrList< surfaceScalarField > phiKdPhis(const PtrList< volScalarField > &rAUs) const =0
Return the force fluxes for the cell-based algorithm.
phaseModelPartialList movingPhaseModels_
Moving phase models.
Definition: phaseSystem.H:135
const surfaceScalarField & phi() const
Return the mixture flux.
Definition: phaseSystemI.H:113
virtual void correctThermo()
Correct the thermodynamics.
Definition: phaseSystem.C:395
const volScalarField & dpdt() const
Return the rate of change of the pressure.
Definition: phaseSystemI.H:125
virtual void correct()
Correct the fluid properties other than those listed below.
Definition: phaseSystem.C:367
virtual autoPtr< massTransferTable > massTransfer() const =0
Return the mass transfer matrices.
tmp< volScalarField > sigma(const phasePairKey &key) const
Return the surface tension coefficient for a pair.
Definition: phaseSystem.C:319
phaseModelPartialList multiComponentPhaseModels_
Multi-component phase models.
Definition: phaseSystem.H:144
phaseModelPartialList anisothermalPhaseModels_
Anisothermal phase models.
Definition: phaseSystem.H:141
const phaseModelPartialList & movingPhases() const
Return the models for phases that are moving.
Definition: phaseSystemI.H:51
virtual const HashPtrTable< surfaceScalarField > & DByAfs() const =0
Return the phase diffusivities divided by the momentum.
tmp< volVectorField > U() const
Return the mixture velocity.
Definition: phaseSystem.C:270
void fillFields(const word &name, const dimensionSet &dims, PtrList< GeometricField< Type, PatchField, GeoMesh > > &fieldList) const
Fill up gaps in a phase-indexed list of fields with zeros.
HashPtrTable< fvScalarMatrix > massTransferTable
Definition: phaseSystem.H:85
tmp< surfaceScalarField > calcPhi(const phaseModelList &phaseModels) const
Calculate and return the mixture flux.
Definition: phaseSystem.C:52
const phaseModelList & phases() const
Return the phase models.
Definition: phaseSystemI.H:37
PtrListDictionary< phaseModel > phaseModelList
Definition: phaseSystem.H:87
const phaseModelPartialList & anisothermalPhases() const
Return the models for phases that have variable temperature.
Definition: phaseSystemI.H:79
const modelType & lookupSubModel(const phasePair &key) const
Return a sub model between a phase pair.
aspectRatioModelTable aspectRatioModels_
Aspect ratio models.
Definition: phaseSystem.H:168
const BlendedInterfacialModel< modelType > & lookupBlendedSubModel(const phasePair &key) const
Return a blended sub model between a phase pair.
HashTable< autoPtr< phasePair >, phasePairKey, phasePairKey::hash > phasePairTable
Definition: phaseSystem.H:93
virtual PtrList< surfaceScalarField > AFfs() const =0
Return the implicit force coefficients for the face-based.
bool foundBlendedSubModel(const phasePair &key) const
Check availability of a blended sub model for a given phase pair.
surfaceTensionModelTable surfaceTensionModels_
Surface tension models.
Definition: phaseSystem.H:165
HashTable< autoPtr< reactingMultiphaseEuler::surfaceTensionModel >, phasePairKey, phasePairKey::hash > surfaceTensionModelTable
Definition: phaseSystem.H:114
const phaseModelPartialList & multiComponentPhases() const
Return the models for phases that have multiple species.
Definition: phaseSystemI.H:93
virtual autoPtr< heatTransferTable > heatTransfer() const =0
Return the heat transfer matrices.
virtual void correctTurbulence()
Correct the turbulence.
Definition: phaseSystem.C:404
void generatePairsAndSubModels(const word &modelName, HashTable< autoPtr< modelType >, phasePairKey, phasePairKey::hash > &models)
Generate pairs and sub-model tables.
virtual PtrList< volScalarField > dmdts() const
Return the mass transfer rates for each phase.
Definition: phaseSystem.C:355
const phaseModelPartialList & stationaryPhases() const
Return the models for phases that are stationary.
Definition: phaseSystemI.H:65
virtual PtrList< surfaceScalarField > ddtCorrByAs(const PtrList< volScalarField > &rAUs, const bool includeVirtualMass=false) const =0
Return the flux corrections for the cell-based algorithm.
bool foundSubModel(const phasePair &key) const
Check availability of a sub model for a given phase pair.
virtual autoPtr< momentumTransferTable > momentumTransferf()=0
Return the momentum transfer matrices for the face-based.
HashTable< autoPtr< aspectRatioModel >, phasePairKey, phasePairKey::hash > aspectRatioModelTable
Definition: phaseSystem.H:123
phasePairTable phasePairs_
Phase pairs.
Definition: phaseSystem.H:147
surfaceScalarField phi_
Total volumetric flux.
Definition: phaseSystem.H:150
virtual PtrList< surfaceScalarField > phiFs(const PtrList< volScalarField > &rAUs)=0
Return the force fluxes for the cell-based algorithm.
HashPtrTable< fvVectorMatrix > momentumTransferTable
Definition: phaseSystem.H:81
HashPtrTable< fvScalarMatrix > heatTransferTable
Definition: phaseSystem.H:83
virtual void partialEliminationf(const PtrList< surfaceScalarField > &rAUfs)=0
Solve the drag system for the new fluxes.
virtual PtrList< volVectorField > KdUByAs(const PtrList< volScalarField > &rAUs) const =0
Return the explicit part of the drag force.
virtual ~phaseSystem()
Destructor.
Definition: phaseSystem.C:236
const fvMesh & mesh() const
Return the mesh.
Definition: phaseSystemI.H:30
TypeName("phaseSystem")
Runtime type information.
UPtrList< phaseModel > phaseModelPartialList
Definition: phaseSystem.H:89
void addField(const phaseModel &phase, const word &fieldName, tmp< GeoField > field, PtrList< GeoField > &fieldList) const
Add the field to a phase-indexed list, with the given name,.
tmp< volScalarField > rho() const
Return the mixture density.
Definition: phaseSystem.C:242
virtual PtrList< surfaceScalarField > phiFfs(const PtrList< surfaceScalarField > &rAUfs)=0
Return the force fluxes for the face-based algorithm.
IOMRFZoneList MRF_
Optional MRF zones.
Definition: phaseSystem.H:156
fv::options & fvOptions() const
Access the fvOptions.
Definition: phaseSystemI.H:143
volScalarField dpdt_
Rate of change of pressure.
Definition: phaseSystem.H:153
blendingMethodTable blendingMethods_
Blending methods.
Definition: phaseSystem.H:159
virtual void partialElimination(const PtrList< volScalarField > &rAUs)=0
Solve the drag system for the new velocities and fluxes.
virtual autoPtr< momentumTransferTable > momentumTransfer()=0
Return the momentum transfer matrices for the cell-based.
tmp< volScalarField > E(const phasePairKey &key) const
Return the aspect-ratio for a pair.
Definition: phaseSystem.C:300
HashTable< dictionary, phasePairKey, phasePairKey::hash > dictTable
Definition: phaseSystem.H:102
virtual void solve()
Solve for the phase fractions.
Definition: phaseSystem.C:363
virtual bool read()
Read base phaseProperties dictionary.
Definition: phaseSystem.C:422
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phase.H:57
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
rDeltaTY field()
Forward declarations of fvMatrix specializations.
PtrList< volScalarField > rAUs
Definition: pEqn.H:4
PtrList< surfaceScalarField > rAUfs
Definition: pEqn.H:30
Namespace for OpenFOAM.
tmp< volScalarField > byDt(const volScalarField &vf)
Definition: phaseSystem.C:442
Hashing functor for phasePairKey.
Definition: phasePairKey.H:123
Foam::surfaceFields.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73