34 template<
class BasePhaseSystem>
37 PtrList<volScalarField>& dmdts
42 const phasePair& pair = this->phasePairs_[dmdtfIter.key()];
45 addField(pair.phase1(),
"dmdt", dmdtf, dmdts);
46 addField(pair.phase2(),
"dmdt", - dmdtf, dmdts);
51 const phasePair& pair = this->phasePairs_[nDmdtfIter.key()];
54 addField(pair.phase1(),
"dmdt", nDmdtf, dmdts);
55 addField(pair.phase2(),
"dmdt", - nDmdtf, dmdts);
62 template<
class BasePhaseSystem>
69 BasePhaseSystem(mesh),
70 volatile_(this->template lookupOrDefault<word>(
"volatile",
"none")),
71 dmdt0s_(this->
phases().size()),
74 this->template lookupOrDefault<Switch>(
"pressureImplicit", true)
77 this->generatePairsAndSubModels
91 const phasePair& pair =
92 this->phasePairs_[saturationModelIter.key()];
94 this->
template validateMassTransfer<saturationModel>(pair);
98 !this->heatTransferModels_.found(pair)
99 || !this->heatTransferModels_[pair].first().valid()
100 || !this->heatTransferModels_[pair].second().valid()
104 <<
"A heat transfer model for both sides of the " << pair
105 <<
"pair is not specified. This is required by the " 106 <<
"corresponding saturation model" 114 saturationModelTable,
119 const phasePair& pair =
120 this->phasePairs_[saturationModelIter.key()];
131 "thermalPhaseChange:dmdtf",
134 this->
mesh().time().timeName(),
153 "thermalPhaseChange:d2mdtdpf",
156 this->
mesh().time().timeName(),
175 "thermalPhaseChange:Tf",
178 this->
mesh().time().timeName(),
183 (pair.phase1().thermo().T() + pair.phase2().thermo().T())/2
196 "thermalPhaseChange:nucleation:dmdtf",
199 this->
mesh().time().timeName(),
214 template<
class BasePhaseSystem>
222 template<
class BasePhaseSystem>
226 const phasePairKey& key
229 return saturationModels_[key];
233 template<
class BasePhaseSystem>
237 const phasePairKey& key
240 tmp<volScalarField> tDmdtf = BasePhaseSystem::dmdtf(key);
242 const scalar dmdtfSign =
245 if (dmdtfs_.
found(key))
247 tDmdtf.ref() += dmdtfSign**dmdtfs_[key];
250 if (nDmdtfs_.found(key))
252 tDmdtf.ref() += dmdtfSign**nDmdtfs_[key];
259 template<
class BasePhaseSystem>
263 PtrList<volScalarField>
dmdts(BasePhaseSystem::dmdts());
271 template<
class BasePhaseSystem>
279 const phasePair& pair = this->phasePairs_[d2mdtdpfIter.key()];
282 addField(pair.phase1(),
"d2mdtdp", d2mdtdpf,
d2mdtdps);
283 addField(pair.phase2(),
"d2mdtdp", - d2mdtdpf,
d2mdtdps);
290 template<
class BasePhaseSystem>
295 autoPtr<phaseSystem::momentumTransferTable> eqnsPtr =
300 this->addDmdtUfs(dmdtfs_, eqns);
301 this->addDmdtUfs(nDmdtfs_, eqns);
307 template<
class BasePhaseSystem>
312 autoPtr<phaseSystem::momentumTransferTable> eqnsPtr =
313 BasePhaseSystem::momentumTransferf();
317 this->addDmdtUfs(dmdtfs_, eqns);
318 this->addDmdtUfs(nDmdtfs_, eqns);
324 template<
class BasePhaseSystem>
328 autoPtr<phaseSystem::heatTransferTable> eqnsPtr =
329 BasePhaseSystem::heatTransfer();
337 const phasePair& pair = this->phasePairs_[nDmdtfIter.key()];
338 const saturationModel& satModel = this->saturation(nDmdtfIter.key());
339 Tns.insert(pair, satModel.Tsat(pair.phase1().thermo().p()).ptr());
343 if (volatile_ !=
"none")
350 const phasePair& pair = this->phasePairs_[dmdtfIter.key()];
353 dmidtfs.insert(pair,
new HashPtrTable<volScalarField>());
361 latentHeatScheme::upwind,
362 latentHeatTransfer::heat,
371 const phasePair& pair = this->phasePairs_[nDmdtfIter.key()];
374 nDmidtfs.insert(pair,
new HashPtrTable<volScalarField>());
383 latentHeatScheme::upwind,
394 latentHeatScheme::upwind,
395 latentHeatTransfer::heat,
403 latentHeatScheme::upwind,
410 PtrList<volScalarField>
dmdts(this->
phases().size());
416 const phaseModel& phase = phaseIter();
418 if (dmdt0s_.set(phase.index()))
420 *eqns[phase.name()] +=
423 dmdt0s_[phase.index()] - dmdts[phase.index()],
434 template<
class BasePhaseSystem>
438 autoPtr<phaseSystem::specieTransferTable> eqnsPtr =
443 if (volatile_ !=
"none")
450 const phasePair& pair = this->phasePairs_[dmdtfIter.key()];
453 dmidtfs.insert(pair,
new HashPtrTable<volScalarField>());
457 this->addDmidtYf(dmidtfs, eqns);
465 const phasePair& pair = this->phasePairs_[nDmdtfIter.key()];
468 nDmidtfs.insert(pair,
new HashPtrTable<volScalarField>());
472 this->addDmidtYf(nDmidtfs, eqns);
477 this->addDmdtYfs(dmdtfs_, eqns);
478 this->addDmdtYfs(nDmdtfs_, eqns);
485 template<
class BasePhaseSystem>
489 dmdt0s_ = PtrList<volScalarField>(this->
phases().size());
493 BasePhaseSystem::correctContinuityError();
497 template<
class BasePhaseSystem>
501 typedef compressible::alphatPhaseChangeWallFunctionFvPatchScalarField
502 alphatPhaseChangeWallFunction;
506 saturationModelTable,
511 const phasePair& pair = this->phasePairs_[saturationModelIter.key()];
513 const phaseModel& phase1 = pair.phase1();
514 const phaseModel& phase2 = pair.phase2();
515 const rhoThermo& thermo1 = phase1.thermo();
516 const rhoThermo& thermo2 = phase2.thermo();
525 const volScalarField Tsat(saturationModelIter()->Tsat(thermo1.p()));
530 ? this->Li(pair, volatile_, dmdtf, Tsat, latentHeatScheme::upwind)
531 : this->L(pair, dmdtf, Tsat, latentHeatScheme::upwind)
539 if (volatile_ !=
"none")
542 neg0(dmdtfNew)*phase1.Y(volatile_)
543 +
pos(dmdtfNew)*phase2.Y(volatile_);
546 if (pressureImplicit_)
555 saturationModelIter()->Tsat(thermo1.p() + dp/2)
556 - saturationModelIter()->Tsat(thermo1.p() - dp/2)
560 d2mdtdpf = (H1 + H2)*dTsatdp/L;
562 if (volatile_ !=
"none")
565 neg0(dmdtfNew)*phase1.Y(volatile_)
566 +
pos(dmdtfNew)*phase2.Y(volatile_);
570 H1 = this->heatTransferModels_[pair].first()->K();
571 H2 = this->heatTransferModels_[pair].second()->K();
577 Tf = (H1*T1 + H2*T2 + dmdtfNew*L)/(H1 + H2);
580 <<
": min = " <<
min(Tf.primitiveField())
581 <<
", mean = " <<
average(Tf.primitiveField())
582 <<
", max = " <<
max(Tf.primitiveField())
585 const scalar dmdtfRelax =
586 this->
mesh().fieldRelaxationFactor(dmdtf.member());
588 dmdtf = (1 - dmdtfRelax)*dmdtf + dmdtfRelax*dmdtfNew;
591 <<
": min = " <<
min(dmdtf.primitiveField())
592 <<
", mean = " <<
average(dmdtf.primitiveField())
593 <<
", max = " <<
max(dmdtf.primitiveField())
604 bool wallBoilingActive =
false;
608 const phaseModel& phase = pairIter();
610 const word alphatName =
621 alphat.boundaryField()[
patchi];
623 if (isA<alphatPhaseChangeWallFunction>(alphatp))
625 const alphatPhaseChangeWallFunction& alphatw =
626 refCast<const alphatPhaseChangeWallFunction>
631 if (alphatw.activePhasePair(pair))
633 wallBoilingActive =
true;
639 pairIter.index() == 0 ? +1 : -1;
644 alphatw.patch().faceCells()[facei];
645 nDmdtf[celli] -= sign*patchDmdtf[facei];
653 if (wallBoilingActive)
656 <<
": min = " <<
min(nDmdtf.primitiveField())
657 <<
", mean = " <<
average(nDmdtf.primitiveField())
658 <<
", max = " <<
max(nDmdtf.primitiveField())
667 template<
class BasePhaseSystem>
dimensionedScalar sign(const dimensionedScalar &ds)
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual PtrList< volScalarField > dmdts() const
Return the mass transfer rates for each phase.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
ThermalPhaseChangePhaseSystem(const fvMesh &)
Construct from fvMesh.
HashPtrTable< fvVectorMatrix > momentumTransferTable
const dimensionSet dimPressure
static int compare(const Pair< Type > &a, const Pair< Type > &b)
Compare Pairs.
virtual autoPtr< phaseSystem::specieTransferTable > specieTransfer() const
Return the specie transfer matrices.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual PtrList< volScalarField > dmdts() const
Return the mass transfer rates for each phase.
HashPtrTable< fvScalarMatrix > heatTransferTable
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
HashPtrTable< fvScalarMatrix > specieTransferTable
const saturationModel & saturation(const phasePairKey &key) const
Return the saturationModel.
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
CGAL::Exact_predicates_exact_constructions_kernel K
Class to provide interfacial heat and mass transfer between a number of phases according the interfac...
virtual tmp< volScalarField > dmdtf(const phasePairKey &key) const
Return the mass transfer rate for an interface.
HashPtrTable< HashPtrTable< volScalarField >, phasePairKey, phasePairKey::hash > dmidtfTable
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
dimensionedScalar pos(const dimensionedScalar &ds)
const dimensionSet dimTime
virtual PtrList< volScalarField > d2mdtdps() const
Return the mass transfer linearisation coeffs for each phase.
virtual void correctInterfaceThermo()
Correct the interface thermodynamics.
bool found(const Key &) const
Return true if hashedEntry is found in table.
fvPatchField< scalar > fvPatchScalarField
virtual tmp< volScalarField > dmdtf(const phasePairKey &key) const
Return the mass transfer rate for an interface.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static word groupName(Name name, const word &group)
HashPtrTable< volScalarField, phasePairKey, phasePairKey::hash > dmdtfTable
const dimensionSet dimDensity
dimensionedScalar neg0(const dimensionedScalar &ds)
PtrListDictionary< phaseModel > phaseModelList
virtual autoPtr< phaseSystem::heatTransferTable > heatTransfer() const
Return the heat transfer matrices.
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransferf()
Return the momentum transfer matrices for the face-based algorithm.
Volume integrate volField creating a volField.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
phaseSystem::specieTransferTable & specieTransfer(specieTransferPtr())
const Mesh & mesh() const
Return mesh.
virtual bool read()
Read base phaseProperties dictionary.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
phaseSystem::momentumTransferTable & momentumTransfer(momentumTransferPtr())
virtual ~ThermalPhaseChangePhaseSystem()
Destructor.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
virtual void correctContinuityError()
Store phase dmdts at the during the continuity error update.
phaseSystem::phaseModelList & phases
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A class for managing temporary objects.
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransfer()
Return the momentum transfer matrices for the cell-based algorithm.
Calculate the matrix for implicit and explicit sources.
PtrList< volScalarField > d2mdtdps(fluid.d2mdtdps())