30#include "interfaceCompositionModel.H"
35template<
class BasePhaseSystem>
47 this->phases()[key.second()]
82template<
class BasePhaseSystem>
89 BasePhaseSystem(
mesh),
92 this->template getOrDefault<label>(
"nInterfaceCorrectors", 1)
95 this->generatePairsAndSubModels
97 "interfaceComposition",
101 this->generatePairsAndSubModels
113 interfaceCompositionModelIter
117 this->phasePairs_[interfaceCompositionModelIter.key()];
124 <<
"An interfacial composition model is specified for the "
125 <<
"unordered " << pair <<
" pair. Composition models only "
126 <<
"apply to ordered pairs. An entry for a "
127 <<
phasePairKey(
"A",
"B",
true) <<
" pair means a model for "
128 <<
"the A side of the A-B interface; i.e., \"A in the presence "
136 if (!this->phasePairs_.found(key))
139 <<
"A mass transfer model the " << key <<
" pair is not "
140 <<
"specified. This is required by the corresponding interface "
141 <<
"composition model."
145 const phasePair& uoPair = this->phasePairs_[key];
150 <<
"A mass transfer model for the " << pair.
phase1().
name()
151 <<
" side of the " << uoPair <<
" pair is not "
152 <<
"specified. This is required by the corresponding interface "
153 <<
"composition model."
161 massTransferModelIter
164 const phasePair& pair =
165 this->phasePairs_[massTransferModelIter.key()];
167 if (!this->heatTransferModels_.found(pair))
170 <<
"A heat transfer model for " << pair <<
" pair is not "
171 <<
"specified. This is required by the corresponding species "
182 interfaceCompositionModelIter
185 const interfaceCompositionModel& compositionModel =
186 interfaceCompositionModelIter();
188 const phasePair& pair =
189 this->phasePairs_[interfaceCompositionModelIter.key()];
191 iDmdtSu_.set(pair,
new HashPtrTable<volScalarField>());
192 iDmdtSp_.set(pair,
new HashPtrTable<volScalarField>());
194 for (
const word& member : compositionModel.species())
204 this->mesh().time().timeName(),
220 this->mesh().time().timeName(),
234template<
class BasePhaseSystem>
242template<
class BasePhaseSystem>
249 return BasePhaseSystem::dmdt(key) + this->
iDmdt(key);
253template<
class BasePhaseSystem>
261 interfaceCompositionModelTable,
262 interfaceCompositionModels_,
263 interfaceCompositionModelIter
267 interfaceCompositionModelIter();
270 this->phasePairs_[interfaceCompositionModelIter.key()];
274 for (
const word& member : compositionModel.species())
278 *(*iDmdtSu_[pair])[member]
279 + *(*iDmdtSp_[pair])[member]*
phase.Y(member)
282 this->addField(
phase,
"dmdt", iDmdt, dmdts);
283 this->addField(otherPhase,
"dmdt", - iDmdt, dmdts);
291template<
class BasePhaseSystem>
297 BasePhaseSystem::massTransfer();
304 interfaceCompositionModelTable,
305 interfaceCompositionModels_,
306 interfaceCompositionModelIter
310 interfaceCompositionModelIter();
313 this->phasePairs_[interfaceCompositionModelIter.key()];
323 massTransferModels_[unorderedPair][unorderedPair.
index(
phase)]->K()
329 : compositionModel.species()
342 *(*iDmdtSu_[pair])[member] =
phase.
rho()*KD*Yf;
343 *(*iDmdtSp_[pair])[member] = -
phase.
rho()*KD;
347 *(*iDmdtSu_[pair])[member]
353 *(*iDmdtSu_[pair])[member]
354 + *(*iDmdtSp_[pair])[member]*
phase.Y(member)
361 if (eqns.
found(otherName))
363 *eqns[otherName] -= iDmdt;
372template<
class BasePhaseSystem>
390 typename BasePhaseSystem::heatTransferModelTable,
391 this->heatTransferModels_,
392 heatTransferModelIter
395 const phasePair& pair =
396 this->phasePairs_[heatTransferModelIter.key()];
398 const phasePairKey key12(pair.first(), pair.second(),
true);
399 const phasePairKey key21(pair.second(), pair.first(),
true);
407 for (label i = 0; i < nInterfaceCorrectors_; ++ i)
433 if (this->interfaceCompositionModels_.found(key12))
435 this->interfaceCompositionModels_[key12]->addMDotL
437 massTransferModels_[pair].first()->
K(),
443 if (this->interfaceCompositionModels_.found(key21))
445 this->interfaceCompositionModels_[key21]->addMDotL
447 massTransferModels_[pair].second()->
K(),
458 H1*(Tf - pair.phase1().
thermo().
T())
459 + H2*(Tf - pair.phase2().thermo().T())
463 max(H1 + H2 + mDotLPrime, HSmall)
466 Tf.correctBoundaryConditions();
468 Info<<
"Tf." << pair.name()
469 <<
": min = " <<
min(Tf.primitiveField())
470 <<
", mean = " <<
average(Tf.primitiveField())
471 <<
", max = " <<
max(Tf.primitiveField())
475 if (this->interfaceCompositionModels_.found(key12))
477 this->interfaceCompositionModels_[key12]->update(Tf);
479 if (this->interfaceCompositionModels_.found(key21))
481 this->interfaceCompositionModels_[key21]->update(Tf);
488template<
class BasePhaseSystem>
491 if (BasePhaseSystem::read())
CGAL::Exact_predicates_exact_constructions_kernel K
const dimensionSet & dimensions() const noexcept
Return dimensions.
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
void correctBoundaryConditions()
Correct boundary field.
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
bool found(const Key &key) const
Same as contains().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
virtual tmp< volScalarField > dmdt(const phasePairKey &key) const
Return the mass transfer rate for a pair.
InterfaceCompositionPhaseChangePhaseSystem(const fvMesh &)
Construct from fvMesh.
const label nInterfaceCorrectors_
The number of interface correctors.
interfaceCompositionModelTable interfaceCompositionModels_
Interface composition models.
virtual void correctInterfaceThermo()
Correct the interface temperatures.
iDmdtSuSpTable iDmdtSp_
The implicit part of the interfacial mass transfer rates.
virtual autoPtr< phaseSystem::massTransferTable > massTransfer() const
Return the mass transfer matrices.
virtual tmp< volScalarField > iDmdt(const phasePairKey &key) const
Return the interfacial mass transfer rate for a pair for a pair.
virtual PtrList< volScalarField > dmdts() const
Return the mass transfer rates for each phase.
HashTable< autoPtr< interfaceCompositionModel >, phasePairKey, phasePairKey::hash > interfaceCompositionModelTable
iDmdtSuSpTable iDmdtSu_
The explicit part of the interfacial mass transfer rates.
HashTable< Pair< autoPtr< BlendedInterfacialModel< massTransferModel > > >, phasePairKey, phasePairKey::hash > massTransferModelTable
massTransferModelTable massTransferModels_
Mass transfer models.
virtual ~InterfaceCompositionPhaseChangePhaseSystem()
Destructor.
virtual bool read()
Read base phaseProperties dictionary.
static int compare(const Pair< T > &a, const Pair< T > &b)
Compare Pairs.
const T & first() const noexcept
Access the first element.
const T & second() const noexcept
Access the second element.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
virtual const volScalarField & T() const
Temperature [K].
Mesh data needed to do the Finite Volume discretisation.
static const dimensionSet dimK
Coefficient dimensions.
virtual tmp< volScalarField > Yf(const word &speciesName, const volScalarField &Tf) const =0
Interface mass fraction.
const word & name() const
The name of this phase.
virtual const rhoThermo & thermo() const =0
Access const to phase thermo.
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
const phaseModel & otherPhase() const
Return the other phase in this two-phase system.
const word & name() const
An ordered or unorder pair of phase names. Typically specified as follows.
bool ordered() const noexcept
Return the ordered flag.
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
virtual word name() const
Pair name.
label index(const phaseModel &phase) const
Return the index of the given phase. Generates a FatalError if.
const multiphaseInter::phaseModel & phase1() const
const multiphaseInter::phaseModel & phase2() const
virtual tmp< volScalarField > dmdt(const phasePairKey &key) const
Return the mass transfer rate for a pair.
HashPtrTable< fvScalarMatrix > massTransferTable
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
const word & name() const
const dimensionedScalar & rho() const
Return const-access to phase1 density.
A class for managing temporary objects.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
const dimensionSet dimEnergy
fvMatrix< scalar > fvScalarMatrix
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const dimensionSet dimVolume(pow3(dimLength))
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimDensity
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1, const label comm)
psiReactionThermo & thermo
multiphaseSystem::phaseModelList & phases
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object.