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()];
130 <<
"An interfacial composition model is specified for the " 131 <<
"unordered " << pair <<
" pair. Composition models only " 132 <<
"apply to ordered pairs. A entry for an " 133 << phasePairKey(
"A",
"B",
true) <<
" pair means a model for " 134 <<
"the A side of the A-B interface; i.e., \"A in the presence " 139 const phasePairKey key(pair.phase1().name(), pair.phase2().name());
141 if (!massTransferModels_[key][pair.index(pair.phase1())].valid())
144 <<
"A mass transfer model for the " << pair.phase1().name()
145 <<
" side of the " << key <<
" pair is not specified. This is " 146 <<
"required by the corresponding interface composition model." 152 massTransferModelTable,
154 massTransferModelIter
157 const phasePair& pair =
160 if (!this->heatTransferModels_.found(pair))
163 <<
"A heat transfer model for " << pair <<
" pair is not " 164 <<
"specified. This is required by the corresponding species " 173 interfaceCompositionModelTable,
174 interfaceCompositionModels_,
175 interfaceCompositionModelIter
178 const interfaceCompositionModel& compositionModel =
179 interfaceCompositionModelIter();
181 const phasePair& pair =
182 this->
phasePairs_[interfaceCompositionModelIter.key()];
183 const phasePair unorderedPair(pair.phase1(), pair.phase2());
185 iDmdtSu_.
insert(pair,
new HashPtrTable<volScalarField>());
186 iDmdtSp_.insert(pair,
new HashPtrTable<volScalarField>());
188 forAllConstIter(hashedWordList, compositionModel.species(), memberIter)
190 const word& member = *memberIter;
192 iDmdtSu_[pair]->insert
208 iDmdtSp_[pair]->insert
230 template<
class BasePhaseSystem>
238 template<
class BasePhaseSystem>
242 const phasePairKey& key
245 return BasePhaseSystem::dmdt(key) + this->iDmdt(key);
249 template<
class BasePhaseSystem>
253 PtrList<volScalarField>
dmdts(BasePhaseSystem::dmdts());
257 interfaceCompositionModelTable,
258 interfaceCompositionModels_,
259 interfaceCompositionModelIter
262 const interfaceCompositionModel& compositionModel =
263 interfaceCompositionModelIter();
265 const phasePair& pair =
266 this->
phasePairs_[interfaceCompositionModelIter.key()];
267 const phaseModel& phase = pair.phase1();
268 const phaseModel& otherPhase = pair.phase2();
270 forAllConstIter(hashedWordList, compositionModel.species(), memberIter)
272 const word& member = *memberIter;
282 *(*iDmdtSu_[pair])[member]
283 + *(*iDmdtSp_[pair])[member]*phase.Y(member)
295 template<
class BasePhaseSystem>
300 autoPtr<phaseSystem::massTransferTable> eqnsPtr =
308 interfaceCompositionModelTable,
309 interfaceCompositionModels_,
310 interfaceCompositionModelIter
313 const interfaceCompositionModel& compositionModel =
314 interfaceCompositionModelIter();
316 const phasePair& pair =
317 this->
phasePairs_[interfaceCompositionModelIter.key()];
318 const phaseModel& phase = pair.phase1();
319 const phaseModel& otherPhase = pair.phase2();
320 const phasePair unorderedPair(phase, otherPhase);
326 massTransferModels_[unorderedPair][pair.index(phase)]->K()
329 forAllConstIter(hashedWordList, compositionModel.species(), memberIter)
331 const word& member = *memberIter;
343 *(*iDmdtSu_[pair])[member] = phase.rho()*KD*Yf;
344 *(*iDmdtSp_[pair])[member] = - phase.rho()*KD;
348 *(*iDmdtSu_[pair])[member]
349 +
fvm::Sp(*(*iDmdtSp_[pair])[member], phase.Y(member))
354 *(*iDmdtSu_[pair])[member]
355 + *(*iDmdtSp_[pair])[member]*phase.Y(member)
362 if (eqns.found(otherName))
364 *eqns[otherName] -= iDmdt;
373 template<
class BasePhaseSystem>
391 typename BasePhaseSystem::heatTransferModelTable,
392 this->heatTransferModels_,
393 heatTransferModelIter
396 const phasePair& pair =
399 const phasePairKey key12(pair.first(), pair.second(),
true);
400 const phasePairKey key21(pair.second(), pair.first(),
true);
408 for (
label i = 0; i < nInterfaceCorrectors_; ++ i)
434 if (this->interfaceCompositionModels_.found(key12))
436 this->interfaceCompositionModels_[key12]->addMDotL
438 massTransferModels_[pair].
first()->
K(),
444 if (this->interfaceCompositionModels_.found(key21))
446 this->interfaceCompositionModels_[key21]->addMDotL
448 massTransferModels_[pair].second()->
K(),
459 H1*(Tf - pair.phase1().thermo().T())
460 + H2*(Tf - pair.phase2().thermo().T())
464 max(H1 + H2 + mDotLPrime, HSmall)
467 Tf.correctBoundaryConditions();
469 Info<<
"Tf." << pair.name()
470 <<
": min = " <<
min(Tf.primitiveField())
471 <<
", mean = " <<
average(Tf.primitiveField())
472 <<
", max = " <<
max(Tf.primitiveField())
476 if (this->interfaceCompositionModels_.found(key12))
478 this->interfaceCompositionModels_[key12]->update(Tf);
480 if (this->interfaceCompositionModels_.found(key21))
482 this->interfaceCompositionModels_[key21]->update(Tf);
489 template<
class BasePhaseSystem>
A simple container for copying or transferring objects of type <T>.
fvMatrix< scalar > fvScalarMatrix
virtual ~InterfaceCompositionPhaseChangePhaseSystem()
Destructor.
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))
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)
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.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
virtual Xfer< PtrList< volScalarField > > dmdts() const
Return the mass transfer rates for each phase.
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.
virtual Xfer< PtrList< volScalarField > > dmdts() const
Return the mass transfer rates for each phase.