diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam/multiphaseSystems/multiphaseSystems.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam/multiphaseSystems/multiphaseSystems.C index f7ccafa7b5..831f21bb52 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam/multiphaseSystems/multiphaseSystems.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam/multiphaseSystems/multiphaseSystems.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -119,6 +119,30 @@ namespace Foam populationBalanceMultiphaseSystem ); + typedef + InterfaceCompositionPhaseChangePhaseSystem + < + PopulationBalancePhaseSystem + < + PhaseTransferPhaseSystem + < + TwoResistanceHeatTransferPhaseSystem + < + MomentumTransferPhaseSystem + > + > + > + > + interfaceCompositionPhaseChangePopulationBalanceMultiphaseSystem; + + addNamedToRunTimeSelectionTable + ( + phaseSystem, + interfaceCompositionPhaseChangePopulationBalanceMultiphaseSystem, + dictionary, + interfaceCompositionPhaseChangePopulationBalanceMultiphaseSystem + ); + typedef ThermalPhaseChangePhaseSystem < diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C index 7efafe28d9..59f742d3db 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C @@ -34,10 +34,13 @@ License template Foam::autoPtr Foam::InterfaceCompositionPhaseChangePhaseSystem:: -dmdtfs() const +totalDmdtfs() const { - autoPtr dmdtPtr(new phaseSystem::dmdtfTable); - phaseSystem::dmdtfTable& dmdtfs = dmdtPtr(); + autoPtr totalDmdtfsPtr + ( + new phaseSystem::dmdtfTable + ); + phaseSystem::dmdtfTable& totalDmdtfs = totalDmdtfsPtr(); forAllConstIter ( @@ -79,29 +82,32 @@ dmdtfs() const ) ); - if (dmdtfs.found(pair)) + if (totalDmdtfs.found(pair)) { - *dmdtfs[pair] += dmidtf; + *totalDmdtfs[pair] += dmidtf; } else { - dmdtfs.insert(pair, dmidtf.ptr()); + totalDmdtfs.insert(pair, dmidtf.ptr()); } } } } - return dmdtPtr; + return totalDmdtfsPtr; } template Foam::autoPtr Foam::InterfaceCompositionPhaseChangePhaseSystem:: -dmidtfs() const +totalDmidtfs() const { - autoPtr dmidtfsPtr(new phaseSystem::dmidtfTable); - phaseSystem::dmidtfTable& dmidtfs = dmidtfsPtr(); + autoPtr totalDmidtfsPtr + ( + new phaseSystem::dmidtfTable + ); + phaseSystem::dmidtfTable& totalDmidtfs = totalDmidtfsPtr(); forAllConstIter ( @@ -113,9 +119,9 @@ dmidtfs() const const phasePair& pair = this->phasePairs_[interfaceCompositionModelIter.key()]; - if (!dmidtfs.found(pair)) + if (!totalDmidtfs.found(pair)) { - dmidtfs.insert(pair, new HashPtrTable()); + totalDmidtfs.insert(pair, new HashPtrTable()); } forAllConstIter(phasePair, pair, pairIter) @@ -149,19 +155,19 @@ dmidtfs() const ) ); - if (dmidtfs[pair]->found(specie)) + if (totalDmidtfs[pair]->found(specie)) { - *(*dmidtfs[pair])[specie] += dmidtf; + *(*totalDmidtfs[pair])[specie] += dmidtf; } else { - dmidtfs[pair]->insert(specie, dmidtf.ptr()); + totalDmidtfs[pair]->insert(specie, dmidtf.ptr()); } } } } - return dmidtfsPtr; + return totalDmidtfsPtr; } @@ -258,6 +264,28 @@ InterfaceCompositionPhaseChangePhaseSystem const phasePair& pair = this->phasePairs_[interfaceCompositionModelIter.key()]; + dmdtfs_.insert + ( + pair, + new volScalarField + ( + IOobject + ( + IOobject::groupName + ( + "interfaceCompositionPhaseChange:dmdtf", + pair.name() + ), + this->mesh().time().timeName(), + this->mesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + this->mesh(), + dimensionedScalar(dimDensity/dimTime, Zero) + ) + ); + dmidtfSus_.insert(pair, new HashPtrTable()); dmidtfSps_.insert(pair, new HashPtrTable()); @@ -374,39 +402,11 @@ Foam::InterfaceCompositionPhaseChangePhaseSystem::dmdtf { tmp tDmdtf = BasePhaseSystem::dmdtf(key); - if (interfaceCompositionModels_.found(key)) + if (dmdtfs_.found(key)) { - const phasePair& pair = this->phasePairs_[key]; + const label dmdtSign(Pair::compare(this->phasePairs_[key], key)); - forAllConstIter(phasePair, pair, pairIter) - { - const autoPtr& compositionModelPtr = - interfaceCompositionModels_[key][pairIter.index()]; - - if (!compositionModelPtr.valid()) continue; - - const interfaceCompositionModel& compositionModel = - compositionModelPtr(); - - const phaseModel& phase = *pairIter; - - forAllConstIter - ( - hashedWordList, - compositionModel.species(), - specieIter - ) - { - const word& specie = *specieIter; - - tDmdtf.ref() += - Pair::compare(pair, key) - *( - *(*dmidtfSus_[pair])[specie] - + *(*dmidtfSps_[pair])[specie]*phase.Y(specie) - ); - } - } + tDmdtf.ref() += dmdtSign**dmdtfs_[key]; } return tDmdtf; @@ -419,10 +419,7 @@ Foam::InterfaceCompositionPhaseChangePhaseSystem::dmdts() const { PtrList dmdts(BasePhaseSystem::dmdts()); - autoPtr dmdtfsPtr = this->dmdtfs(); - const phaseSystem::dmdtfTable& dmdtfs = dmdtfsPtr(); - - forAllConstIter(phaseSystem::dmdtfTable, dmdtfs, dmdtfsIter) + forAllConstIter(phaseSystem::dmdtfTable, dmdtfs_, dmdtfsIter) { const phasePair& pair = this->phasePairs_[dmdtfsIter.key()]; const phaseModel& phase = pair.phase1(); @@ -446,7 +443,7 @@ momentumTransfer() phaseSystem::momentumTransferTable& eqns = eqnsPtr(); - this->addDmdtUfs(dmdtfs(), eqns); + this->addDmdtUfs(dmdtfs_, eqns); return eqnsPtr; } @@ -462,7 +459,7 @@ momentumTransferf() phaseSystem::momentumTransferTable& eqns = eqnsPtr(); - this->addDmdtUfs(dmdtfs(), eqns); + this->addDmdtUfs(dmdtfs_, eqns); return eqnsPtr; } @@ -480,7 +477,7 @@ heatTransfer() const this->addDmidtHefs ( - dmidtfs(), + totalDmidtfs(), Tfs_, latentHeatScheme::symmetric, latentHeatTransfer::mass, @@ -503,7 +500,7 @@ specieTransfer() const // Explicit /* - this->addDmidtYf(dmidtfs(), eqns); + this->addDmidtYf(totalDmidtfs(), eqns); */ // Semi-implicit @@ -612,6 +609,18 @@ correct() } } } + + dmdtfs_ = totalDmdtfs(); +} + + +template +void Foam::InterfaceCompositionPhaseChangePhaseSystem:: +correctSpecies() +{ + BasePhaseSystem::correctSpecies(); + + dmdtfs_ = totalDmdtfs(); } diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.H b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.H index 5730098905..8ba98dc2e8 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,10 +93,13 @@ class InterfaceCompositionPhaseChangePhaseSystem //- Interface composition models interfaceCompositionModelTable interfaceCompositionModels_; - //- The explicit part of the interfacial mass transfer rates + //- Interface mass transfer rates + phaseSystem::dmdtfTable dmdtfs_; + + //- The explicit part of the interface specie transfer rates phaseSystem::dmidtfTable dmidtfSus_; - //- The implicit part of the interfacial mass transfer rates + //- The implicit part of the interface specie transfer rates phaseSystem::dmidtfTable dmidtfSps_; //- Interface temperatures @@ -106,10 +109,10 @@ class InterfaceCompositionPhaseChangePhaseSystem // Private Member Functions //- Return mass transfers across each interface - autoPtr dmdtfs() const; + autoPtr totalDmdtfs() const; //- Return species mass transfers across each interface - autoPtr dmidtfs() const; + autoPtr totalDmidtfs() const; public: @@ -148,6 +151,9 @@ public: //- Correct the fluid properties other than those listed below virtual void correct(); + //- Correct the mass transfer rates for the new species mass fractions + virtual void correctSpecies(); + //- Correct the interface temperatures virtual void correctInterfaceThermo(); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/PhaseSystems/PopulationBalancePhaseSystem/PopulationBalancePhaseSystem.C b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/PhaseSystems/PopulationBalancePhaseSystem/PopulationBalancePhaseSystem.C index 6e55fc1f7d..8568d3154c 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/PhaseSystems/PopulationBalancePhaseSystem/PopulationBalancePhaseSystem.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/PhaseSystems/PopulationBalancePhaseSystem/PopulationBalancePhaseSystem.C @@ -113,16 +113,16 @@ Foam::PopulationBalancePhaseSystem::dmdtf const phasePairKey& key ) const { - tmp tDmdt = BasePhaseSystem::dmdtf(key); + tmp tDmdtf = BasePhaseSystem::dmdtf(key); - if (!dmdtfs_.found(key)) + if (dmdtfs_.found(key)) { const label dmdtSign(Pair::compare(this->phasePairs_[key], key)); - tDmdt.ref() += dmdtSign**dmdtfs_[key]; + tDmdtf.ref() += dmdtSign**dmdtfs_[key]; } - return tDmdt; + return tDmdtf; }