34 template<
class BasePhaseSystem>
40 interfaceCompositionModelTable,
41 interfaceCompositionModels_,
42 interfaceCompositionModelIter
45 const sidedInterfaceCompositionModel& compositionModel =
46 interfaceCompositionModelIter();
48 const phaseInterface&
interface = compositionModel.interface();
50 *dmdtfs_[interface] =
Zero;
54 const phaseModel& phase = interfaceIter();
56 if (!compositionModel.haveModelInThe(phase))
continue;
61 compositionModel.modelInThe(phase).species(),
65 const word& specie = *specieIter;
67 *dmdtfs_[interface] +=
68 (interfaceIter.index() == 0 ? +1 : -1)
70 *(*dmidtfSus_[interface])[specie]
71 + *(*dmidtfSps_[interface])[specie]*phase.Y(specie)
79 template<
class BasePhaseSystem>
84 autoPtr<phaseSystem::dmidtfTable> totalDmidtfsPtr
86 new phaseSystem::dmidtfTable
88 phaseSystem::dmidtfTable& totalDmidtfs = totalDmidtfsPtr();
92 interfaceCompositionModelTable,
93 interfaceCompositionModels_,
94 interfaceCompositionModelIter
97 const sidedInterfaceCompositionModel& compositionModel =
98 interfaceCompositionModelIter();
100 const phaseInterface&
interface = compositionModel.interface();
102 if (!totalDmidtfs.found(interface))
104 totalDmidtfs.insert(interface,
new HashPtrTable<volScalarField>());
109 const phaseModel& phase = interfaceIter();
111 if (!compositionModel.haveModelInThe(phase))
continue;
116 compositionModel.modelInThe(phase).species(),
120 const word& specie = *specieIter;
122 tmp<volScalarField> dmidtf
124 (interfaceIter.index() == 0 ? +1 : -1)
126 *(*dmidtfSus_[interface])[specie]
127 + *(*dmidtfSps_[interface])[specie]*phase.Y(specie)
131 if (totalDmidtfs[interface]->
found(specie))
133 *(*totalDmidtfs[interface])[specie] += dmidtf;
137 totalDmidtfs[interface]->insert(specie, dmidtf.ptr());
143 return totalDmidtfsPtr;
149 template<
class BasePhaseSystem>
156 BasePhaseSystem(mesh),
157 nInterfaceCorrectors_
159 this->template lookupOrDefault<
label>(
"nInterfaceCorrectors", 1)
162 this->generateInterfacialModels(interfaceCompositionModels_);
163 this->generateInterfacialModels(diffusiveMassTransferModels_);
169 interfaceCompositionModels_,
170 interfaceCompositionModelIter
174 interfaceCompositionModelIter();
176 const phaseInterface&
interface = sidedCompositionModel.interface();
177 const phaseModel& phase1 = interface.phase1();
178 const phaseModel& phase2 = interface.phase2();
181 validateMassTransfer<interfaceCompositionModel>(interface);
183 if (!this->diffusiveMassTransferModels_.
found(interface))
186 <<
"A diffusive mass transfer model for the "
187 << interface.name() <<
" interface is not specified. This is "
188 <<
"required by the corresponding interface composition model."
197 && !diffusiveMassTransferModels_[interface]
198 ->haveModelInThe(interfaceIter())
202 <<
"A diffusive mass transfer model for the "
203 << interfaceIter().name() <<
" side of the "
204 << interface.name() <<
" interface is not "
205 <<
"specified. This is required by the corresponding "
206 <<
"interface composition model."
213 !this->heatTransferModels_.found(interface)
214 || !this->heatTransferModels_[interface]->haveModelInThe(phase1)
215 || !this->heatTransferModels_[interface]->haveModelInThe(phase2)
219 <<
"A heat transfer model for both sides of the "
221 <<
" interface is not specified. This is required by the "
222 <<
"corresponding interface composition model"
231 interfaceCompositionModels_,
232 interfaceCompositionModelIter
236 interfaceCompositionModelIter();
249 "interfaceCompositionPhaseChange:dmdtf",
252 this->mesh().time().name(),
275 "interfaceCompositionPhaseChange:Tf",
278 this->mesh().time().name(),
284 interface.phase1().thermo().T()
285 + interface.phase2().thermo().T()
308 dmidtfSus_[interface]->
insert
319 "interfaceCompositionPhaseChange:dmidtfSu",
324 this->mesh().time().name(),
332 dmidtfSps_[interface]->
insert
343 "interfaceCompositionPhaseChange:dmidtfSp",
348 this->mesh().time().name(),
363 template<
class BasePhaseSystem>
371 template<
class BasePhaseSystem>
380 if (dmdtfs_.found(key))
382 tDmdtf.
ref() += *dmdtfs_[key];
389 template<
class BasePhaseSystem>
407 template<
class BasePhaseSystem>
413 BasePhaseSystem::momentumTransfer();
417 this->addDmdtUfs(dmdtfs_, eqns);
423 template<
class BasePhaseSystem>
429 BasePhaseSystem::momentumTransferf();
433 this->addDmdtUfs(dmdtfs_, eqns);
439 template<
class BasePhaseSystem>
445 BasePhaseSystem::heatTransfer();
453 latentHeatScheme::symmetric,
454 latentHeatTransfer::mass,
462 template<
class BasePhaseSystem>
468 BasePhaseSystem::specieTransfer();
481 interfaceCompositionModels_,
482 interfaceCompositionModelIter
486 interfaceCompositionModelIter();
493 const phaseModel& otherPhase = interfaceIter.otherPhase();
507 *eqns[phase.
Y(
specie).name()] +=
508 *(*dmidtfSus_[interface])[
specie]
514 *eqns[otherPhase.
Y(
specie).name()] -=
515 *(*dmidtfSus_[interface])[
specie]
526 template<
class BasePhaseSystem>
536 interfaceCompositionModels_,
537 interfaceCompositionModelIter
541 interfaceCompositionModelIter();
555 diffusiveMassTransferModels_[interface]->modelInThe(phase).
K()
576 *(*dmidtfSus_[interface])[
specie] = phase.
rho()*KD*Yf;
577 *(*dmidtfSps_[interface])[
specie] = - phase.
rho()*KD;
586 template<
class BasePhaseSystem>
590 BasePhaseSystem::correctSpecies();
596 template<
class BasePhaseSystem>
625 interfaceCompositionModels_,
626 interfaceCompositionModelIter
630 *interfaceCompositionModelIter();
633 const phaseModel& phase1 = interface.phase1();
634 const phaseModel& phase2 = interface.phase2();
637 this->heatTransferModels_[interface];
641 diffusiveMassTransferModels_[interface];
649 for (
label i = 0; i < nInterfaceCorrectors_; ++ i)
673 const label sign = interfaceIter.index() == 0 ? 1 : -1;
705 latentHeatScheme::symmetric
709 dmdtLf.
ref() +=
sign*rhoKDL*dY;
710 dmdtLfPrime.
ref() +=
sign*rhoKDL*dYfPrime;
718 H1*(Tf - interface.phase1().thermo().
T())
719 + H2*(Tf - interface.phase2().thermo().
T())
723 max(H1 + H2 - dmdtLfPrime, HSmall)
728 Info<<
"Tf." << interface.name()
748 template<
class BasePhaseSystem>
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Generic GeometricField class.
const Internal::FieldType & primitiveField() const
Return a const-reference to the primitive field.
tmp< GeometricField< Type, PatchField, GeoMesh > > T() const
Return transpose (only if it is a tensor field)
void correctBoundaryConditions()
Correct boundary field.
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, const Internal &, const PtrList< PatchField< Type >> &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
A HashTable specialisation for hashing pointers.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
bool found(const Key &) const
Return true if hashedEntry is found in table.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static word groupName(Name name, const word &group)
Class to provide interfacial heat and mass transfer between a number of phases according to a interfa...
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransfer()
Return the momentum transfer matrices for the cell-based algorithm.
virtual void correctSpecies()
Correct the mass transfer rates for the new species mass fractions.
virtual autoPtr< phaseSystem::heatTransferTable > heatTransfer() const
Return the heat transfer matrices.
InterfaceCompositionPhaseChangePhaseSystem(const fvMesh &)
Construct from fvMesh.
virtual void correct()
Correct the fluid properties other than those listed below.
virtual void correctInterfaceThermo()
Correct the interface temperatures.
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.
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 ~InterfaceCompositionPhaseChangePhaseSystem()
Destructor.
virtual bool read()
Read base phaseProperties dictionary.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
const phaseInterface & interface() const
Access the interface.
bool haveModelInThe(const phaseModel &phase) const
Does a model exist in the given phase?
const ModelType & modelInThe(const phaseModel &phase) const
Access the model within the given phase.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Model for diffusive mass transfer coefficients between two phases.
virtual tmp< volScalarField > K() const =0
The implicit mass transfer coefficient.
Mesh data needed to do the Finite Volume discretisation.
A wordList with hashed indices for faster lookup by name.
Model for heat transfer between phases.
tmp< volScalarField > K() const
The heat transfer function K used in the enthalpy equation.
static const dimensionSet dimK
Coefficient dimensions.
Generic base class for interface composition models. These models describe the composition in phase 1...
tmp< volScalarField > D(const word &speciesName) const
Mass diffusivity.
tmp< volScalarField > dY(const word &speciesName, const volScalarField &Tf) const
Mass fraction difference between the interface and the field.
virtual tmp< volScalarField > Yf(const word &speciesName, const volScalarField &Tf) const =0
Interface mass fraction.
virtual void update(const volScalarField &Tf)=0
Update the composition.
tmp< volScalarField > dYfPrime(const word &speciesName, const volScalarField &Tf) const
Mass fraction difference between the interface and the field.
const hashedWordList & species() const
Return the transferring species names.
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.
const word & name() const
Return the name of this phase.
virtual const volScalarField & rho() const =0
Return the density field.
Base class of the thermophysical property types.
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.
Calculate the matrix for implicit and explicit sources.
void correct(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiCorr, const SpType &Sp, const SuType &Su)
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const VolField< Type > &)
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar sign(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const dimensionSet dimEnergy
const HashTable< dimensionSet > & dimensions()
Get the table of dimension sets.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void addField(const label phasei, const word &name, tmp< GeoField > field, PtrList< GeoField > &fieldList)
const dimensionSet dimTemperature
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimTime
const dimensionSet dimDensity
const dimensionSet dimVolume
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)