33 template<
class BasePhaseSystem>
37 const phasePairKey& key
40 if (!iDmdt_.found(key))
42 return phaseSystem::dmdt(key);
47 return dmdtSign**iDmdt_[key];
51 template<
class BasePhaseSystem>
55 const phasePairKey& key
58 if (!wDmdt_.found(key))
60 return phaseSystem::dmdt(key);
65 return dmdtSign**wDmdt_[key];
71 template<
class BasePhaseSystem>
78 BasePhaseSystem(mesh),
79 volatile_(this->template lookupOrDefault<word>(
"volatile",
"none")),
82 saturationModel::
New(this->subDict(
"saturationModel"), mesh)
84 phaseChange_(this->
lookup(
"phaseChange"))
94 const phasePair& pair(phasePairIter());
110 this->
mesh().time().timeName(),
129 this->
mesh().time().timeName(),
148 this->
mesh().time().timeName(),
163 template<
class BasePhaseSystem>
171 template<
class BasePhaseSystem>
175 return saturationModel_();
179 template<
class BasePhaseSystem>
183 const phasePairKey& key
186 return BasePhaseSystem::dmdt(key) + this->iDmdt(key) + this->wDmdt(key);
190 template<
class BasePhaseSystem>
194 PtrList<volScalarField>
dmdts(BasePhaseSystem::dmdts());
198 const phasePair& pair = this->phasePairs_[iDmdtIter.key()];
201 this->addField(pair.phase1(),
"dmdt", iDmdt,
dmdts);
202 this->addField(pair.phase2(),
"dmdt", - iDmdt,
dmdts);
207 const phasePair& pair = this->phasePairs_[wDmdtIter.key()];
210 this->addField(pair.phase1(),
"dmdt", wDmdt,
dmdts);
211 this->addField(pair.phase2(),
"dmdt", - wDmdt,
dmdts);
218 template<
class BasePhaseSystem>
222 autoPtr<phaseSystem::heatTransferTable> eqnsPtr =
223 BasePhaseSystem::heatTransfer();
235 if (this->wMDotL_.found(phasePairIter.key()))
237 const phasePair& pair(phasePairIter());
244 const phaseModel& phase1 = pair.phase1();
245 const phaseModel& phase2 = pair.phase2();
247 *eqns[phase1.name()] +=
negPart(*this->wMDotL_[pair]);
248 *eqns[phase2.name()] -=
posPart(*this->wMDotL_[pair]);
252 phase1.thermo().he().member() ==
"e" 253 || phase2.thermo().he().member() ==
"e" 258 this->iDmdt(pair) + this->wDmdt(pair)
261 if (phase1.thermo().he().member() ==
"e")
263 *eqns[phase1.name()] +=
264 phase1.thermo().p()*
dmdt/phase1.thermo().rho();
267 if (phase2.thermo().he().member() ==
"e")
269 *eqns[phase2.name()] -=
270 phase2.thermo().p()*
dmdt/phase2.thermo().rho();
280 template<
class BasePhaseSystem>
284 autoPtr<phaseSystem::massTransferTable> eqnsPtr =
296 const phasePair& pair(phasePairIter());
303 const phaseModel& phase = pair.phase1();
304 const phaseModel& otherPhase = pair.phase2();
306 const PtrList<volScalarField>& Yi = phase.Y();
310 if (Yi[i].member() != volatile_)
331 *eqns[otherName] -=
dmdt;
339 template<
class BasePhaseSystem>
343 typedef compressible::alphatPhaseChangeWallFunctionFvPatchScalarField
344 alphatPhaseChangeWallFunction;
348 typename BasePhaseSystem::heatTransferModelTable,
349 this->heatTransferModels_,
350 heatTransferModelIter
353 const phasePair& pair
355 this->phasePairs_[heatTransferModelIter.key()]
358 const phaseModel& phase1 = pair.phase1();
359 const phaseModel& phase2 = pair.phase2();
372 const volScalarField Tsat(saturationModel_->Tsat(phase1.thermo().p()));
377 ? phase1.thermo().he(
p, Tsat) +
p/phase1.rho()
378 : phase1.thermo().he(
p, Tsat)
383 ? phase2.thermo().he(
p, Tsat) +
p/phase2.rho()
384 : phase2.thermo().he(
p, Tsat)
390 ? he1 +
p/phase1.rho()
391 : tmp<volScalarField>(he1)
397 ?
he2 +
p/phase2.rho()
398 : tmp<volScalarField>(
he2)
403 (
neg0(iDmdt)*hf2 +
pos(iDmdt)*h2)
404 - (
pos0(iDmdt)*hf1 +
neg(iDmdt)*h1)
414 iDmdtNew = (H1*(Tsat - T1) + H2*(Tsat - T2))/L;
428 Tf = (H1*T1 + H2*T2 + iDmdtNew*L)/(H1 + H2);
430 Info<<
"Tf." << pair.name()
431 <<
": min = " <<
min(Tf.primitiveField())
432 <<
", mean = " <<
average(Tf.primitiveField())
433 <<
", max = " <<
max(Tf.primitiveField())
436 scalar iDmdtRelax(this->
mesh().fieldRelaxationFactor(
"iDmdt"));
437 iDmdt = (1 - iDmdtRelax)*iDmdt + iDmdtRelax*iDmdtNew;
441 Info<<
"iDmdt." << pair.name()
442 <<
": min = " <<
min(iDmdt.primitiveField())
443 <<
", mean = " <<
average(iDmdt.primitiveField())
444 <<
", max = " <<
max(iDmdt.primitiveField())
454 bool wallBoilingActive =
false;
458 const phaseModel& phase = iter();
459 const phaseModel& otherPhase = iter.otherPhase();
465 "alphat." + phase.name()
472 "alphat." + phase.name()
478 const fvPatch& currPatch = patches[
patchi];
482 isA<alphatPhaseChangeWallFunction>
484 alphat.boundaryField()[
patchi]
488 const alphatPhaseChangeWallFunction& PCpatch =
489 refCast<const alphatPhaseChangeWallFunction>
491 alphat.boundaryField()[
patchi]
494 phasePairKey key(phase.name(), otherPhase.name());
496 if (PCpatch.activePhasePair(key))
498 wallBoilingActive =
true;
512 const label faceCelli =
513 currPatch.faceCells()[facei];
514 wDmdt[faceCelli] -=
sign*patchDmdt[facei];
515 wMDotL[faceCelli] -=
sign*patchMDotL[facei];
523 if (wallBoilingActive)
525 Info<<
"wDmdt." << pair.name()
526 <<
": min = " <<
min(wDmdt.primitiveField())
527 <<
", mean = " <<
average(wDmdt.primitiveField())
528 <<
", max = " <<
max(wDmdt.primitiveField())
536 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.
HashPtrTable< fvScalarMatrix > massTransferTable
HashTable< autoPtr< phasePair >, phasePairKey, phasePairKey::hash > phasePairTable
virtual PtrList< volScalarField > dmdts() const
Return the mass transfer rates for each phase.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
ThermalPhaseChangePhaseSystem(const fvMesh &)
Construct from fvMesh.
static int compare(const Pair< word > &a, const Pair< word > &b)
Compare Pairs.
phaseSystem::massTransferTable & massTransfer(massTransferPtr())
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual PtrList< volScalarField > dmdts() const
Return the mass transfer rates for each phase.
virtual tmp< volScalarField > dmdt(const phasePairKey &key) const
Return the mass transfer rate for a pair.
virtual autoPtr< phaseSystem::massTransferTable > massTransfer() const
Return the mass transfer matrices.
HashPtrTable< fvScalarMatrix > heatTransferTable
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
CGAL::Exact_predicates_exact_constructions_kernel K
dimensionedScalar posPart(const dimensionedScalar &ds)
dimensionedScalar neg(const dimensionedScalar &ds)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
dimensionedScalar pos(const dimensionedScalar &ds)
const dimensionSet dimVolume(pow3(dimLength))
stressControl lookup("compactNormalStress") >> compactNormalStress
virtual void correctInterfaceThermo()
Correct the interface thermodynamics.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static word groupName(Name name, const word &group)
dimensionedScalar neg0(const dimensionedScalar &ds)
virtual autoPtr< phaseSystem::heatTransferTable > heatTransfer() const
Return the heat transfer matrices.
Volume integrate volField creating a volField.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
dimensionedScalar pos0(const dimensionedScalar &ds)
const Mesh & mesh() const
Return mesh.
virtual bool read()
Read base phaseProperties dictionary.
tmp< volScalarField > iDmdt(const phasePairKey &key) const
Return the interfacial mass transfer rate for a pair.
tmp< volScalarField > wDmdt(const phasePairKey &key) const
Return the boundary mass transfer rate for a pair.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
const dimensionSet dimEnergy
const dimensionSet dimDensity
const saturationModel & saturation() const
Return the saturationModel.
PtrList< fvPatch > fvPatchList
container classes for fvPatch
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...
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
virtual tmp< volScalarField > dmdt(const phasePairKey &key) const
Return the mass transfer rate for a pair.
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.
Calculate the matrix for implicit and explicit sources.
dimensionedScalar negPart(const dimensionedScalar &ds)