36 template<
class BasePhaseSystem>
39 PtrList<volScalarField>& dmdts
44 const phaseInterface interface(*
this, dmdtfIter.key());
46 addField(interface.phase1(),
"dmdt", *dmdtfIter(), dmdts);
47 addField(interface.phase2(),
"dmdt", - *dmdtfIter(), dmdts);
52 const phaseInterface interface(*
this, nDmdtfIter.key());
54 addField(interface.phase1(),
"dmdt", *nDmdtfIter(), dmdts);
55 addField(interface.phase2(),
"dmdt", - *nDmdtfIter(), 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->generateInterfacialModels(saturationModels_);
87 const phaseInterface&
interface = saturationModelIter()->interface();
91 this->
template validateMassTransfer
98 !this->heatTransferModels_.found(interface)
99 || !this->heatTransferModels_[interface]->haveModelInThe(phase1)
100 || !this->heatTransferModels_[interface]->haveModelInThe(phase2)
104 <<
"A heat transfer model for both sides of the "
105 << interface.name() <<
" interface is not specified. This is "
106 <<
"required by the corresponding saturation model"
119 const phaseInterface&
interface = saturationModelIter()->interface();
130 "thermalPhaseChange:dmdtf",
133 this->mesh().time().name(),
152 "thermalPhaseChange:d2mdtdpf",
155 this->mesh().time().name(),
174 "thermalPhaseChange:Tf",
177 this->mesh().time().name(),
183 interface.phase1().fluidThermo().T()
184 + interface.phase2().fluidThermo().T()
198 "thermalPhaseChange:Tsat",
201 this->mesh().time().name(),
206 saturationModels_[interface]->Tsat
208 interface.phase1().fluidThermo().p()
222 "thermalPhaseChange:nucleation:dmdtf",
225 this->mesh().time().name(),
240 template<
class BasePhaseSystem>
248 template<
class BasePhaseSystem>
255 return saturationModels_[key];
259 template<
class BasePhaseSystem>
268 if (dmdtfs_.found(key))
270 tDmdtf.
ref() += *dmdtfs_[key];
273 if (nDmdtfs_.found(key))
275 tDmdtf.
ref() += *nDmdtfs_[key];
282 template<
class BasePhaseSystem>
294 template<
class BasePhaseSystem>
304 addField(interface.
phase1(),
"d2mdtdp", *d2mdtdpfIter(), d2mdtdps);
305 addField(interface.
phase2(),
"d2mdtdp", - *d2mdtdpfIter(), d2mdtdps);
312 template<
class BasePhaseSystem>
318 BasePhaseSystem::momentumTransfer();
322 this->addDmdtUfs(dmdtfs_, eqns);
323 this->addDmdtUfs(nDmdtfs_, eqns);
329 template<
class BasePhaseSystem>
335 BasePhaseSystem::momentumTransferf();
339 this->addDmdtUfs(dmdtfs_, eqns);
340 this->addDmdtUfs(nDmdtfs_, eqns);
346 template<
class BasePhaseSystem>
351 BasePhaseSystem::heatTransfer();
361 this->saturation(nDmdtfIter.key());
371 if (volatile_ !=
"none")
381 dmidtfs[interface]->
insert
393 latentHeatScheme::upwind,
394 latentHeatTransfer::mass,
406 nDmidtfs[interface]->
insert
418 latentHeatScheme::upwind,
430 latentHeatScheme::upwind,
431 latentHeatTransfer::mass,
439 latentHeatScheme::upwind,
450 forAll(this->phases(), phasei)
452 const phaseModel& phase = this->phases()[phasei];
454 if (dmdt0s_.set(phase.
index()))
456 *eqns[phase.
name()] +=
459 dmdt0s_[phase.
index()] - dmdts[phase.
index()],
470 template<
class BasePhaseSystem>
475 BasePhaseSystem::specieTransfer();
479 if (volatile_ !=
"none")
489 dmidtfs[interface]->
insert
496 this->addDmidtYf(dmidtfs, eqns);
507 nDmidtfs[interface]->
insert
514 this->addDmidtYf(nDmidtfs, eqns);
519 this->addDmdtYfs(dmdtfs_, eqns);
520 this->addDmdtYfs(nDmdtfs_, eqns);
527 template<
class BasePhaseSystem>
535 BasePhaseSystem::correctContinuityError();
539 template<
class BasePhaseSystem>
545 wallBoilingHeatTransferModel;
548 wallBoilingHeatTransferModels =
549 this->mesh().template lookupClass<wallBoilingHeatTransferModel>();
553 alphatPhaseChangeWallFunction;
562 const phaseInterface&
interface = saturationModelIter()->interface();
563 const phaseModel& phase1 = interface.phase1();
564 const phaseModel& phase2 = interface.phase2();
571 this->heatTransferModels_[interface];
579 Tsat = saturationModelIter()->Tsat(thermo1.
p());
590 latentHeatScheme::symmetric
597 latentHeatScheme::symmetric
606 if (volatile_ !=
"none")
609 neg0(dmdtfNew)*phase1.Y(volatile_)
610 +
pos(dmdtfNew)*phase2.
Y(volatile_);
613 if (pressureImplicit_)
622 saturationModelIter()->Tsat(thermo1.
p() + dp/2)
623 - saturationModelIter()->Tsat(thermo1.
p() - dp/2)
627 d2mdtdpf = (H1 + H2)*dTsatdp/L;
629 if (volatile_ !=
"none")
632 neg0(dmdtfNew)*phase1.Y(volatile_)
633 +
pos(dmdtfNew)*phase2.
Y(volatile_);
644 Tf = (H1*T1 + H2*T2 + dmdtfNew*L)/(H1 + H2);
658 const scalar dmdtfRelax =
659 this->mesh().solution().fieldRelaxationFactor(dmdtf.
member());
661 dmdtf = (1 - dmdtfRelax)*dmdtf + dmdtfRelax*dmdtfNew;
676 bool wallBoilingActive =
false;
681 wallBoilingHeatTransferModels,
682 wallBoilingHeatTransferModelIter
685 const wallBoilingHeatTransferModel& wbht =
686 *wallBoilingHeatTransferModelIter();
688 if (!wbht.activePhaseInterface(interface))
continue;
690 wallBoilingActive =
true;
692 nDmdtf += (wbht.flipSign() ? -1 : +1)*wbht.dmdtf();
699 const word alphatName =
713 if (!isA<alphatPhaseChangeWallFunction>(alphatp))
continue;
715 const alphatPhaseChangeWallFunction& alphatw =
716 refCast<const alphatPhaseChangeWallFunction>(alphatp);
718 if (!alphatw.activeInterface(interface))
continue;
720 wallBoilingActive =
true;
730 - (interfaceIter.index() == 0 ? +1 : -1)
735 if (wallBoilingActive)
749 template<
class BasePhaseSystem>
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
const Mesh & mesh() const
Return mesh.
dimensioned< Type > average() const
Calculate and return arithmetic average.
Generic GeometricField class.
void max(const dimensioned< Type > &)
Internal::FieldType & primitiveFieldRef()
Return a reference to the primitive field.
const Internal::FieldType & primitiveField() const
Return a const-reference to the primitive field.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static word member(const word &name)
Return member (name without the extension)
const word & name() const
Return name.
static word groupName(Name name, const word &group)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Class to provide interfacial heat and mass transfer between a number of phases according the interfac...
const interfaceSaturationTemperatureModel & saturation(const phaseInterfaceKey &key) const
Return the saturation temperature model for an interface.
virtual ~ThermalPhaseChangePhaseSystem()
Destructor.
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransfer()
Return the momentum transfer matrices for the cell-based algorithm.
virtual autoPtr< phaseSystem::heatTransferTable > heatTransfer() const
Return the heat transfer matrices.
virtual void correctInterfaceThermo()
Correct the interface thermodynamics.
virtual tmp< volScalarField > dmdtf(const phaseInterfaceKey &key) const
Return the mass transfer rate for an interface.
virtual autoPtr< phaseSystem::specieTransferTable > specieTransfer() const
Return the specie transfer matrices.
ThermalPhaseChangePhaseSystem(const fvMesh &)
Construct from fvMesh.
virtual PtrList< volScalarField > dmdts() const
Return the mass transfer rates for each phase.
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransferf()
Return the momentum transfer matrices for the face-based algorithm.
virtual PtrList< volScalarField > d2mdtdps() const
Return the mass transfer linearisation coeffs for each phase.
virtual bool read()
Read base phaseProperties dictionary.
virtual void correctContinuityError()
Store phase dmdts at the during the continuity error update.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual const volScalarField & T() const =0
Temperature [K].
virtual const volScalarField & he() const =0
Enthalpy/Internal energy [J/kg].
Abstract base-class for all alphatWallFunctions supporting phase-change.
virtual const volScalarField & p() const =0
Pressure [Pa].
Mesh data needed to do the Finite Volume discretisation.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
const fvPatch & patch() const
Return patch.
virtual const labelUList & faceCells() const
Return faceCells.
Model for heat transfer between phases.
tmp< volScalarField > K() const
The heat transfer function K used in the enthalpy equation.
Wrapper around saturationTemperatureModel to facilitate convenient construction on interfaces.
tmp< volScalarField > Tsat(const volScalarField &p) const
Saturation temperature.
Word-pair based class used for keying interface models in hash tables.
Class to represent an interface between phases. Derivations can further specify the configuration of ...
const phaseModel & phase1() const
Return phase 1.
const phaseModel & phase2() const
Return phase 2.
virtual const PtrList< volScalarField > & Y() const =0
Return the species mass fractions.
virtual const rhoFluidThermo & fluidThermo() const =0
Return the thermophysical model.
label index() const
Return the index of the phase.
const word & name() const
Return the name of this phase.
Base-class for fluid thermodynamic properties based on density.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Volume integrate volField creating a volField.
Calculate the matrix for implicit and explicit sources.
dimensioned< Type > domainIntegrate(const VolField< Type > &vf)
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const VolField< Type > &)
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar pos(const dimensionedScalar &ds)
const dimensionSet dimPressure
Ostream & endl(Ostream &os)
Add newline and flush stream.
void addField(const label phasei, const word &name, tmp< GeoField > field, PtrList< GeoField > &fieldList)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const dimensionSet dimTime
const dimensionSet dimDensity
VolField< scalar > volScalarField
Type gAverage(const FieldField< Field, Type > &f)
dimensionedScalar neg0(const dimensionedScalar &ds)
Type gMin(const FieldField< Field, Type > &f)
Type gMax(const FieldField< Field, Type > &f)