28 #include "heatTransferModel.H" 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_);
168 interfaceCompositionModelTable,
169 interfaceCompositionModels_,
170 interfaceCompositionModelIter
173 const sidedInterfaceCompositionModel& sidedCompositionModel =
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 " << interface
187 <<
" interface is not specified. This is required by the " 188 <<
"corresponding interface composition model." 196 sidedCompositionModel.haveModelInThe(interfaceIter())
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" 230 interfaceCompositionModelTable,
231 interfaceCompositionModels_,
232 interfaceCompositionModelIter
235 const sidedInterfaceCompositionModel& sidedCompositionModel =
236 interfaceCompositionModelIter();
238 const phaseInterface&
interface = sidedCompositionModel.interface();
249 "interfaceCompositionPhaseChange:dmdtf",
252 this->
mesh().time().timeName(),
262 dmidtfSus_.insert(interface,
new HashPtrTable<volScalarField>());
264 dmidtfSps_.insert(interface,
new HashPtrTable<volScalarField>());
275 "interfaceCompositionPhaseChange:Tf",
278 this->
mesh().time().timeName(),
284 interface.phase1().thermo().T()
285 + interface.phase2().thermo().T()
292 const phaseModel& phase = interfaceIter();
294 if (!sidedCompositionModel.haveModelInThe(phase))
continue;
296 const interfaceCompositionModel& compositionModel =
297 sidedCompositionModel.modelInThe(phase);
302 compositionModel.species(),
306 const word& specie = *specieIter;
308 dmidtfSus_[interface]->insert
319 "interfaceCompositionPhaseChange:dmidtfSu",
324 this->
mesh().time().timeName(),
332 dmidtfSps_[interface]->insert
343 "interfaceCompositionPhaseChange:dmidtfSp",
348 this->
mesh().time().timeName(),
363 template<
class BasePhaseSystem>
371 template<
class BasePhaseSystem>
375 const phaseInterfaceKey& key
378 tmp<volScalarField> tDmdtf = BasePhaseSystem::dmdtf(key);
380 if (dmdtfs_.found(key))
382 tDmdtf.ref() += *dmdtfs_[key];
389 template<
class BasePhaseSystem>
393 PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts());
397 const phaseInterface interface(*
this, dmdtfIter.key());
399 addField(interface.phase1(),
"dmdt", *dmdtfIter(), dmdts);
400 addField(interface.phase2(),
"dmdt", - *dmdtfIter(), dmdts);
407 template<
class BasePhaseSystem>
412 autoPtr<phaseSystem::momentumTransferTable> eqnsPtr =
417 this->addDmdtUfs(dmdtfs_, eqns);
423 template<
class BasePhaseSystem>
428 autoPtr<phaseSystem::momentumTransferTable> eqnsPtr =
429 BasePhaseSystem::momentumTransferf();
433 this->addDmdtUfs(dmdtfs_, eqns);
439 template<
class BasePhaseSystem>
444 autoPtr<phaseSystem::heatTransferTable> eqnsPtr =
445 BasePhaseSystem::heatTransfer();
454 latentHeatTransfer::mass,
462 template<
class BasePhaseSystem>
467 autoPtr<phaseSystem::specieTransferTable> eqnsPtr =
480 interfaceCompositionModelTable,
481 interfaceCompositionModels_,
482 interfaceCompositionModelIter
485 const sidedInterfaceCompositionModel& compositionModel =
486 interfaceCompositionModelIter();
488 const phaseInterface&
interface = compositionModel.interface();
492 const phaseModel& phase = interfaceIter();
493 const phaseModel& otherPhase = interfaceIter.otherPhase();
495 if (!compositionModel.haveModelInThe(phase))
continue;
500 compositionModel.modelInThe(phase).species(),
504 const word& specie = *specieIter;
507 *eqns[phase.Y(specie).name()] +=
508 *(*dmidtfSus_[interface])[specie]
509 +
fvm::Sp(*(*dmidtfSps_[interface])[specie], phase.Y(specie));
514 *eqns[otherPhase.Y(specie).name()] -=
515 *(*dmidtfSus_[interface])[specie]
516 + *(*dmidtfSps_[interface])[specie]*phase.Y(specie);
526 template<
class BasePhaseSystem>
535 interfaceCompositionModelTable,
536 interfaceCompositionModels_,
537 interfaceCompositionModelIter
540 const sidedInterfaceCompositionModel& compositionModel =
541 interfaceCompositionModelIter();
543 const phaseInterface&
interface = compositionModel.interface();
549 const phaseModel& phase = interfaceIter();
551 if (!compositionModel.haveModelInThe(phase))
continue;
555 diffusiveMassTransferModels_[interface]->modelInThe(phase).
K()
561 compositionModel.modelInThe(phase).species(),
565 const word& specie = *specieIter;
569 K*compositionModel.modelInThe(phase).D(specie)
573 compositionModel.modelInThe(phase).Yf(specie, Tf)
576 *(*dmidtfSus_[interface])[specie] = phase.rho()*KD*Yf;
577 *(*dmidtfSps_[interface])[specie] = - phase.rho()*KD;
586 template<
class BasePhaseSystem>
596 template<
class BasePhaseSystem>
624 interfaceCompositionModelTable,
625 interfaceCompositionModels_,
626 interfaceCompositionModelIter
629 sidedInterfaceCompositionModel& compositionModel =
630 *interfaceCompositionModelIter();
632 const phaseInterface&
interface = compositionModel.interface();
633 const phaseModel& phase1 = interface.phase1();
634 const phaseModel& phase2 = interface.phase2();
636 const sidedBlendedHeatTransferModel& heatTransferModel =
637 this->heatTransferModels_[interface];
639 const sidedBlendedDiffusiveMassTransferModel&
640 diffusiveMassTransferModel =
641 diffusiveMassTransferModels_[interface];
643 const volScalarField H1(heatTransferModel.modelInThe(phase1).K());
644 const volScalarField H2(heatTransferModel.modelInThe(phase2).K());
649 for (
label i = 0; i < nInterfaceCorrectors_; ++ i)
651 tmp<volScalarField> dmdtLf =
658 tmp<volScalarField> dmdtLfPrime =
669 const phaseModel& phase = interfaceIter();
671 if (!compositionModel.haveModelInThe(phase))
continue;
673 const label sign = interfaceIter.index() == 0 ? 1 : -1;
678 compositionModel.modelInThe(phase).species(),
682 const word& specie = *specieIter;
686 compositionModel.modelInThe(phase).dY(specie, Tf)
691 compositionModel.modelInThe(phase).dYfPrime(specie, Tf)
697 *diffusiveMassTransferModel.modelInThe(phase).K()
698 *compositionModel.modelInThe(phase).D(specie)
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)
726 Tf.correctBoundaryConditions();
728 Info<<
"Tf." << interface.name()
729 <<
": min = " <<
min(Tf.primitiveField())
730 <<
", mean = " <<
average(Tf.primitiveField())
731 <<
", max = " <<
max(Tf.primitiveField())
737 const phaseModel& phase = interfaceIter();
739 if (!compositionModel.haveModelInThe(phase))
continue;
741 compositionModel.modelInThe(phase).update(Tf);
748 template<
class BasePhaseSystem>
dimensionedScalar sign(const dimensionedScalar &ds)
virtual tmp< volScalarField > Li(const phaseInterface &interface, const word &member, const volScalarField &dmidtf, const volScalarField &Tf, const latentHeatScheme scheme) const
Return the latent heat for a given interface, specie, mass transfer.
virtual autoPtr< phaseSystem::specieTransferTable > specieTransfer() const
Return the specie transfer matrices.
virtual ~InterfaceCompositionPhaseChangePhaseSystem()
Destructor.
virtual PtrList< volScalarField > dmdts() const
Return the mass transfer rates for each phase.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > 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)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(rho0+psi *p, rhoMin);# 1 "/home/ubuntu/OpenFOAM-10/applications/solvers/multiphase/cavitatingFoam/alphavPsi.H" 1{ alphav=max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0));alphal=1.0 - alphav;Info<< "max-min alphav: "<< max(alphav).value()<< " "<< min(alphav).value()<< endl;psiModel-> correct()
HashPtrTable< fvVectorMatrix > momentumTransferTable
InterfaceCompositionPhaseChangePhaseSystem(const fvMesh &)
Construct from fvMesh.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, const Internal &, const PtrList< fvPatchField< scalar >> &)
Return a temporary field constructed from name,.
Ostream & endl(Ostream &os)
Add newline and flush stream.
HashPtrTable< fvScalarMatrix > heatTransferTable
HashPtrTable< fvScalarMatrix > specieTransferTable
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
CGAL::Exact_predicates_exact_constructions_kernel K
virtual void correctInterfaceThermo()
Correct the interface temperatures.
static const dimensionSet dimK
Coefficient dimensions.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
void addDmidtHefs(const phaseSystem::dmidtfTable &dmidtfs, phaseSystem::heatTransferTable &eqns) const
Add energy transfer terms which result from specie mass transfers.
const dimensionSet dimTime
static word groupName(Name name, const word &group)
const dimensionSet dimDensity
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
virtual void correct()
Correct the fluid properties other than those listed below.
phaseSystem::specieTransferTable & specieTransfer(specieTransferPtr())
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransfer()
Return the momentum transfer matrices for the cell-based algorithm.
const dimensionSet dimEnergy
HashPtrTable< volScalarField, phaseInterfaceKey, phaseInterfaceKey::hash > dmdtfTable
virtual void correctSpecies()
Correct the mass transfer rates for the new species mass fractions.
phaseSystem::momentumTransferTable & momentumTransfer(momentumTransferPtr())
Internal & ref()
Return a reference to the dimensioned internal field.
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 dimVolume
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 > momentumTransferf()
Return the momentum transfer matrices for the face-based algorithm.
virtual tmp< volScalarField > dmdtf(const phaseInterfaceKey &key) const
Return the mass transfer rate for an interface.
virtual autoPtr< phaseSystem::heatTransferTable > heatTransfer() const
Return the heat transfer matrices.
virtual bool read()
Read base phaseProperties dictionary.
Calculate the matrix for implicit and explicit sources.
const dimensionSet dimTemperature
Class to provide interfacial heat and mass transfer between a number of phases according to a interfa...