33 template<
class BasePhaseSystem>
37 const phasePairKey& key
40 tmp<volScalarField> tIDmdt = phaseSystem::dmdt(key);
42 const phasePair unorderedPair
44 this->
phases()[key.first()],
45 this->
phases()[key.second()]
50 const phaseModel& phase = iter();
51 const phaseModel& otherPhase = iter.otherPhase();
52 const phasePair pair(phase, otherPhase,
true);
54 if (interfaceCompositionModels_.found(pair))
61 interfaceCompositionModels_[pair]->species(),
65 const word& member = *memberIter;
67 const word
name(IOobject::groupName(member, phase.name()));
70 IOobject::groupName(member, otherPhase.name())
76 *(*iDmdtSu_[pair])[member]
77 + *(*iDmdtSp_[pair])[member]*phase.Y(member)
90 template<
class BasePhaseSystem>
97 BasePhaseSystem(mesh),
100 this->template lookupOrDefault<
label>(
"nInterfaceCorrectors", 1)
105 "interfaceComposition",
106 interfaceCompositionModels_
119 interfaceCompositionModelTable,
120 interfaceCompositionModels_,
121 interfaceCompositionModelIter
124 const phasePair& pair =
125 this->
phasePairs_[interfaceCompositionModelIter.key()];
126 const phaseModel& phase = pair.phase1();
127 const phaseModel& otherPhase = pair.phase2();
132 <<
"An interfacial composition model is specified for the " 133 <<
"unordered " << pair <<
" pair. Composition models only " 134 <<
"apply to ordered pairs. An entry for a " 135 << phasePairKey(
"A",
"B",
true) <<
" pair means a model for " 136 <<
"the A side of the A-B interface; i.e., \"A in the presence " 142 const phasePairKey key(phase.name(), otherPhase.name());
147 <<
"A mass transfer model the " << key <<
" pair is not " 148 <<
"specified. This is required by the corresponding interface " 149 <<
"composition model." 155 if (!massTransferModels_[uoPair][uoPair.index(phase)].valid())
158 <<
"A mass transfer model for the " << pair.phase1().name()
159 <<
" side of the " << uoPair <<
" pair is not " 160 <<
"specified. This is required by the corresponding interface " 161 <<
"composition model." 167 massTransferModelTable,
169 massTransferModelIter
172 const phasePair& pair =
175 if (!this->heatTransferModels_.found(pair))
178 <<
"A heat transfer model for " << pair <<
" pair is not " 179 <<
"specified. This is required by the corresponding species " 188 interfaceCompositionModelTable,
189 interfaceCompositionModels_,
190 interfaceCompositionModelIter
193 const interfaceCompositionModel& compositionModel =
194 interfaceCompositionModelIter();
196 const phasePair& pair =
197 this->
phasePairs_[interfaceCompositionModelIter.key()];
199 iDmdtSu_.
insert(pair,
new HashPtrTable<volScalarField>());
200 iDmdtSp_.insert(pair,
new HashPtrTable<volScalarField>());
202 forAllConstIter(hashedWordList, compositionModel.species(), memberIter)
204 const word& member = *memberIter;
206 iDmdtSu_[pair]->insert
222 iDmdtSp_[pair]->insert
244 template<
class BasePhaseSystem>
252 template<
class BasePhaseSystem>
256 const phasePairKey& key
259 return BasePhaseSystem::dmdt(key) + this->iDmdt(key);
263 template<
class BasePhaseSystem>
267 PtrList<volScalarField>
dmdts(BasePhaseSystem::dmdts());
271 interfaceCompositionModelTable,
272 interfaceCompositionModels_,
273 interfaceCompositionModelIter
276 const interfaceCompositionModel& compositionModel =
277 interfaceCompositionModelIter();
279 const phasePair& pair =
280 this->
phasePairs_[interfaceCompositionModelIter.key()];
281 const phaseModel& phase = pair.phase1();
282 const phaseModel& otherPhase = pair.phase2();
284 forAllConstIter(hashedWordList, compositionModel.species(), memberIter)
286 const word& member = *memberIter;
296 *(*iDmdtSu_[pair])[member]
297 + *(*iDmdtSp_[pair])[member]*phase.Y(member)
309 template<
class BasePhaseSystem>
314 autoPtr<phaseSystem::massTransferTable> eqnsPtr =
322 interfaceCompositionModelTable,
323 interfaceCompositionModels_,
324 interfaceCompositionModelIter
327 const interfaceCompositionModel& compositionModel =
328 interfaceCompositionModelIter();
330 const phasePair& pair =
331 this->
phasePairs_[interfaceCompositionModelIter.key()];
332 const phaseModel& phase = pair.phase1();
333 const phaseModel& otherPhase = pair.phase2();
334 const phasePair& unorderedPair =
341 massTransferModels_[unorderedPair][unorderedPair.index(phase)]->K()
344 forAllConstIter(hashedWordList, compositionModel.species(), memberIter)
346 const word& member = *memberIter;
358 *(*iDmdtSu_[pair])[member] = phase.rho()*KD*Yf;
359 *(*iDmdtSp_[pair])[member] = - phase.rho()*KD;
363 *(*iDmdtSu_[pair])[member]
364 +
fvm::Sp(*(*iDmdtSp_[pair])[member], phase.Y(member))
369 *(*iDmdtSu_[pair])[member]
370 + *(*iDmdtSp_[pair])[member]*phase.Y(member)
377 if (eqns.found(otherName))
379 *eqns[otherName] -= iDmdt;
388 template<
class BasePhaseSystem>
406 typename BasePhaseSystem::heatTransferModelTable,
407 this->heatTransferModels_,
408 heatTransferModelIter
411 const phasePair& pair =
414 const phasePairKey key12(pair.first(), pair.second(),
true);
415 const phasePairKey key21(pair.second(), pair.first(),
true);
423 for (
label i = 0; i < nInterfaceCorrectors_; ++ i)
449 if (this->interfaceCompositionModels_.found(key12))
451 this->interfaceCompositionModels_[key12]->addMDotL
453 massTransferModels_[pair].
first()->
K(),
459 if (this->interfaceCompositionModels_.found(key21))
461 this->interfaceCompositionModels_[key21]->addMDotL
463 massTransferModels_[pair].second()->
K(),
474 H1*(Tf - pair.phase1().thermo().T())
475 + H2*(Tf - pair.phase2().thermo().T())
479 max(H1 + H2 + mDotLPrime, HSmall)
482 Tf.correctBoundaryConditions();
484 Info<<
"Tf." << pair.name()
485 <<
": min = " <<
min(Tf.primitiveField())
486 <<
", mean = " <<
average(Tf.primitiveField())
487 <<
", max = " <<
max(Tf.primitiveField())
491 if (this->interfaceCompositionModels_.found(key12))
493 this->interfaceCompositionModels_[key12]->update(Tf);
495 if (this->interfaceCompositionModels_.found(key21))
497 this->interfaceCompositionModels_[key21]->update(Tf);
504 template<
class BasePhaseSystem>
fvMatrix< scalar > fvScalarMatrix
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
HashPtrTable< fvScalarMatrix > massTransferTable
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
multiphaseSystem::phaseModelList & phases
InterfaceCompositionPhaseChangePhaseSystem(const fvMesh &)
Construct from fvMesh.
virtual tmp< volScalarField > iDmdt(const phasePairKey &key) const
Return the interfacial mass transfer rate for a pair for a pair.
phasePairTable phasePairs_
Phase pairs.
static int compare(const Pair< word > &a, const Pair< word > &b)
Compare Pairs.
IOobject(const word &name, const fileName &instance, const objectRegistry ®istry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
Construct from name, instance, registry, io options.
phaseSystem::massTransferTable & massTransfer(massTransferPtr())
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual tmp< volScalarField > dmdt(const phasePairKey &key) const
Return the mass transfer rate for a pair.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
const Time & time() const
Return the top-level database.
CGAL::Exact_predicates_exact_constructions_kernel K
virtual void correctInterfaceThermo()
Correct the interface temperatures.
static const dimensionSet dimK
Coefficient dimensions.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionSet dimVolume(pow3(dimLength))
bool found(const Key &) const
Return true if hashedEntry is found in table.
static word groupName(Name name, const word &group)
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
const word & name() const
Name function is needed to disambiguate those inherited.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
virtual PtrList< volScalarField > dmdts() const
Return the mass transfer rates for each phase.
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
void generatePairsAndSubModels(const word &modelName, HashTable< autoPtr< modelType >, phasePairKey, phasePairKey::hash > &models)
Generate pairs and sub-model tables.
void addField(const phaseModel &phase, const word &fieldName, tmp< GeoField > field, PtrList< GeoField > &fieldList) const
Add the field to a phase-indexed list, with the given name,.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const Time & time() const
Return time.
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)
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.
T * first()
Return the first entry.
virtual autoPtr< phaseSystem::massTransferTable > massTransfer() const
Return the mass transfer matrices.
const fvMesh & mesh() const
Return the mesh.
virtual bool read()
Read base phaseProperties dictionary.