28 #include "heatTransferModel.H" 34 template<
class BasePhaseSystem>
40 interfaceCompositionModelTable,
41 interfaceCompositionModels_,
42 interfaceCompositionModelIter
45 const phasePair& pair =
46 this->phasePairs_[interfaceCompositionModelIter.key()];
48 *dmdtfs_[pair] =
Zero;
52 const autoPtr<interfaceCompositionModel>& compositionModelPtr =
53 interfaceCompositionModelIter()[pairIter.index()];
55 if (!compositionModelPtr.valid())
continue;
57 const interfaceCompositionModel& compositionModel =
58 compositionModelPtr();
60 const phaseModel& phase = *pairIter;
65 compositionModel.species(),
69 const word& specie = *specieIter;
72 (pairIter.index() == 0 ? +1 : -1)
74 *(*dmidtfSus_[pair])[specie]
75 + *(*dmidtfSps_[pair])[specie]*phase.Y(specie)
83 template<
class BasePhaseSystem>
88 autoPtr<phaseSystem::dmidtfTable> totalDmidtfsPtr
90 new phaseSystem::dmidtfTable
92 phaseSystem::dmidtfTable& totalDmidtfs = totalDmidtfsPtr();
96 interfaceCompositionModelTable,
97 interfaceCompositionModels_,
98 interfaceCompositionModelIter
101 const phasePair& pair =
102 this->phasePairs_[interfaceCompositionModelIter.key()];
104 if (!totalDmidtfs.found(pair))
106 totalDmidtfs.insert(pair,
new HashPtrTable<volScalarField>());
111 const autoPtr<interfaceCompositionModel>& compositionModelPtr =
112 interfaceCompositionModelIter()[pairIter.index()];
114 if (!compositionModelPtr.valid())
continue;
116 const interfaceCompositionModel& compositionModel =
117 compositionModelPtr();
119 const phaseModel& phase = *pairIter;
124 compositionModel.species(),
128 const word& specie = *specieIter;
131 tmp<volScalarField> dmidtf
133 (pairIter.index() == 0 ? +1 : -1)
135 *(*dmidtfSus_[pair])[specie]
136 + *(*dmidtfSps_[pair])[specie]*phase.Y(specie)
140 if (totalDmidtfs[pair]->
found(specie))
142 *(*totalDmidtfs[pair])[specie] += dmidtf;
146 totalDmidtfs[pair]->insert(specie, dmidtf.ptr());
152 return totalDmidtfsPtr;
158 template<
class BasePhaseSystem>
165 BasePhaseSystem(mesh),
166 nInterfaceCorrectors_
168 this->template lookupOrDefault<
label>(
"nInterfaceCorrectors", 1)
171 this->generatePairsAndSubModels
173 "interfaceComposition",
174 interfaceCompositionModels_
177 this->generatePairsAndSubModels
179 "diffusiveMassTransfer",
180 diffusiveMassTransferModels_,
187 interfaceCompositionModelTable,
188 interfaceCompositionModels_,
189 interfaceCompositionModelIter
192 const phasePair& pair =
193 this->phasePairs_[interfaceCompositionModelIter.key()];
195 this->
template validateMassTransfer<interfaceCompositionModel>(pair);
197 if (!this->diffusiveMassTransferModels_.found(pair))
200 <<
"A diffusive mass transfer model the " << pair
201 <<
" pair is not specified. This is required by the " 202 <<
"corresponding interface composition model." 210 interfaceCompositionModelIter()[pairIter.index()].valid()
211 && !diffusiveMassTransferModels_[pair][pairIter.index()].valid()
215 <<
"A mass transfer model for the " << (*pairIter).name()
216 <<
" side of the " << pair <<
" pair is not " 217 <<
"specified. This is required by the corresponding " 218 <<
"interface composition model." 225 !this->heatTransferModels_.found(pair)
226 || !this->heatTransferModels_[pair].first().valid()
227 || !this->heatTransferModels_[pair].second().valid()
231 <<
"A heat transfer model for both sides of the " << pair
232 <<
"pair is not specified. This is required by the " 233 <<
"corresponding interface composition model" 241 interfaceCompositionModelTable,
242 interfaceCompositionModels_,
243 interfaceCompositionModelIter
246 const phasePair& pair =
247 this->phasePairs_[interfaceCompositionModelIter.key()];
258 "interfaceCompositionPhaseChange:dmdtf",
261 this->
mesh().time().timeName(),
271 dmidtfSus_.insert(pair,
new HashPtrTable<volScalarField>());
273 dmidtfSps_.insert(pair,
new HashPtrTable<volScalarField>());
284 "interfaceCompositionPhaseChange:Tf",
287 this->
mesh().time().timeName(),
292 (pair.phase1().thermo().T() + pair.phase2().thermo().T())/2
298 const autoPtr<interfaceCompositionModel>& compositionModelPtr =
299 interfaceCompositionModelIter()[pairIter.index()];
301 if (!compositionModelPtr.valid())
continue;
303 const interfaceCompositionModel& compositionModel =
304 compositionModelPtr();
309 compositionModel.species(),
313 const word& specie = *specieIter;
315 dmidtfSus_[pair]->insert
326 "interfaceCompositionPhaseChange:dmidtfSu",
331 this->
mesh().time().timeName(),
339 dmidtfSps_[pair]->insert
350 "interfaceCompositionPhaseChange:dmidtfSp",
355 this->
mesh().time().timeName(),
370 template<
class BasePhaseSystem>
378 template<
class BasePhaseSystem>
382 const phasePairKey& key
385 tmp<volScalarField> tDmdtf = BasePhaseSystem::dmdtf(key);
387 if (dmdtfs_.found(key))
391 tDmdtf.ref() += dmdtSign**dmdtfs_[key];
398 template<
class BasePhaseSystem>
402 PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts());
406 const phasePair& pair = this->phasePairs_[dmdtfsIter.key()];
407 const phaseModel& phase = pair.phase1();
408 const phaseModel& otherPhase = pair.phase2();
410 addField(phase,
"dmdt", *dmdtfsIter(), dmdts);
411 addField(otherPhase,
"dmdt", - *dmdtfsIter(), dmdts);
418 template<
class BasePhaseSystem>
423 autoPtr<phaseSystem::momentumTransferTable> eqnsPtr =
428 this->addDmdtUfs(dmdtfs_, eqns);
434 template<
class BasePhaseSystem>
439 autoPtr<phaseSystem::momentumTransferTable> eqnsPtr =
440 BasePhaseSystem::momentumTransferf();
444 this->addDmdtUfs(dmdtfs_, eqns);
450 template<
class BasePhaseSystem>
455 autoPtr<phaseSystem::heatTransferTable> eqnsPtr =
456 BasePhaseSystem::heatTransfer();
465 latentHeatTransfer::mass,
473 template<
class BasePhaseSystem>
478 autoPtr<phaseSystem::specieTransferTable> eqnsPtr =
491 interfaceCompositionModelTable,
492 interfaceCompositionModels_,
493 interfaceCompositionModelIter
496 const phasePair& pair =
497 this->phasePairs_[interfaceCompositionModelIter.key()];
501 const autoPtr<interfaceCompositionModel>& compositionModelPtr =
502 interfaceCompositionModelIter()[pairIter.index()];
504 if (!compositionModelPtr.valid())
continue;
506 const interfaceCompositionModel& compositionModel =
507 compositionModelPtr();
509 const phaseModel& phase = *pairIter;
510 const phaseModel& otherPhase = pairIter.otherPhase();
515 compositionModel.species(),
519 const word& specie = *specieIter;
522 *eqns[phase.Y(specie).name()] +=
523 *(*dmidtfSus_[pair])[specie]
524 +
fvm::Sp(*(*dmidtfSps_[pair])[specie], phase.Y(specie));
529 *eqns[otherPhase.Y(specie).name()] -=
530 *(*dmidtfSus_[pair])[specie]
531 + *(*dmidtfSps_[pair])[specie]*phase.Y(specie);
541 template<
class BasePhaseSystem>
550 interfaceCompositionModelTable,
551 interfaceCompositionModels_,
552 interfaceCompositionModelIter
555 const phasePair& pair =
556 this->phasePairs_[interfaceCompositionModelIter.key()];
562 const autoPtr<interfaceCompositionModel>& compositionModelPtr =
563 interfaceCompositionModelIter()[pairIter.index()];
565 if (!compositionModelPtr.valid())
continue;
567 const interfaceCompositionModel& compositionModel =
568 compositionModelPtr();
570 const phaseModel& phase = *pairIter;
574 diffusiveMassTransferModels_[pair][pairIter.index()]->K()
580 compositionModel.species(),
584 const word& specie = *specieIter;
589 *(*dmidtfSus_[pair])[specie] = phase.rho()*KD*Yf;
590 *(*dmidtfSps_[pair])[specie] = - phase.rho()*KD;
599 template<
class BasePhaseSystem>
609 template<
class BasePhaseSystem>
637 interfaceCompositionModelTable,
638 interfaceCompositionModels_,
639 interfaceCompositionModelIter
642 const phasePair& pair =
643 this->phasePairs_[interfaceCompositionModelIter.key()];
646 const volScalarField H2(this->heatTransferModels_[pair].second()->
K());
649 const typename diffusiveMassTransferModelTable::value_type&
650 diffusiveMassTransfers = this->diffusiveMassTransferModels_[pair];
652 const typename interfaceCompositionModelTable::value_type &
653 interfaceCompositions = this->interfaceCompositionModels_[pair];
657 for (
label i = 0; i < nInterfaceCorrectors_; ++ i)
659 tmp<volScalarField> dmdtLf =
666 tmp<volScalarField> dmdtLfPrime =
677 if (interfaceCompositions[pairIter.index()].valid())
679 const BlendedInterfacialModel<diffusiveMassTransferModel>&
680 diffusiveMassTransfer =
681 diffusiveMassTransfers[pairIter.index()];
683 const interfaceCompositionModel&
684 interfaceComposition =
685 interfaceCompositions[pairIter.index()];
687 const label sign = pairIter.index() == 0 ? 1 : -1;
692 interfaceComposition.species(),
696 const word& specie = *specieIter;
700 interfaceComposition.dY(specie, Tf)
705 interfaceComposition.dYfPrime(specie, Tf)
711 *diffusiveMassTransfer.K()
712 *interfaceComposition.D(specie)
723 dmdtLf.
ref() += sign*rhoKDL*dY;
724 dmdtLfPrime.ref() += sign*rhoKDL*dYfPrime;
733 H1*(Tf - pair.phase1().thermo().T())
734 + H2*(Tf - pair.phase2().thermo().T())
738 max(H1 + H2 - dmdtLfPrime, HSmall)
741 Tf.correctBoundaryConditions();
743 Info<<
"Tf." << pair.name()
744 <<
": min = " <<
min(Tf.primitiveField())
745 <<
", mean = " <<
average(Tf.primitiveField())
746 <<
", max = " <<
max(Tf.primitiveField())
750 if (this->interfaceCompositionModels_[pair].first().valid())
752 this->interfaceCompositionModels_[pair].first()->update(Tf);
754 if (this->interfaceCompositionModels_[pair].second().valid())
756 this->interfaceCompositionModels_[pair].second()->update(Tf);
763 template<
class BasePhaseSystem>
dimensionedScalar sign(const dimensionedScalar &ds)
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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
fluidReactionThermo & thermo
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
HashPtrTable< fvVectorMatrix > momentumTransferTable
InterfaceCompositionPhaseChangePhaseSystem(const fvMesh &)
Construct from fvMesh.
static int compare(const Pair< word > &a, const Pair< word > &b)
Compare Pairs.
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.
virtual tmp< volScalarField > dmdtf(const phasePairKey &key) const
Return the mass transfer rate for an interface.
static const dimensionSet dimK
Coefficient dimensions.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionSet dimTime
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(rho0+psi *p, rhoMin);# 1 "/home/ubuntu/OpenFOAM-9/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()
static word groupName(Name name, const word &group)
HashPtrTable< volScalarField, phasePairKey, phasePairKey::hash > dmdtfTable
const dimensionSet dimDensity
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
virtual void correct()
Correct the fluid properties other than those listed below.
phaseSystem::specieTransferTable & specieTransfer(specieTransferPtr())
virtual tmp< volScalarField > Li(const phasePair &pair, const word &member, const volScalarField &dmidtf, const volScalarField &Tf, const latentHeatScheme scheme) const =0
Return the latent heat for a given pair, specie, mass transfer rate.
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransfer()
Return the momentum transfer matrices for the cell-based algorithm.
const dimensionSet dimEnergy
virtual void correctSpecies()
Correct the mass transfer rates for the new species mass fractions.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
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 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...