From eaa089e38cd0549d47e114009c58dd4da8647654 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Mon, 24 Sep 2018 11:21:27 +0100 Subject: [PATCH] InterfaceCompositionPhaseChangePhaseSystem: Two sided mass transfer fix This change fixes an issue where mass transfer models were being looked up on the wrong side of the interface. This also means that specifying mass transfer just on one side of an interface is now possible without generating errors. --- ...terfaceCompositionPhaseChangePhaseSystem.C | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C index 1ae08f3362..9c02c9f385 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C @@ -123,6 +123,8 @@ InterfaceCompositionPhaseChangePhaseSystem { const phasePair& pair = this->phasePairs_[interfaceCompositionModelIter.key()]; + const phaseModel& phase = pair.phase1(); + const phaseModel& otherPhase = pair.phase2(); if (!pair.ordered()) { @@ -136,14 +138,27 @@ InterfaceCompositionPhaseChangePhaseSystem << exit(FatalError); } - const phasePairKey key(pair.phase1().name(), pair.phase2().name()); - if (!massTransferModels_[key][pair.index(pair.phase1())].valid()) + const phasePairKey key(phase.name(), otherPhase.name()); + + if (!this->phasePairs_.found(key)) + { + FatalErrorInFunction + << "A mass transfer model the " << key << " pair is not " + << "specified. This is required by the corresponding interface " + << "composition model." + << exit(FatalError); + } + + const phasePair& uoPair = this->phasePairs_[key]; + + if (!massTransferModels_[uoPair][uoPair.index(phase)].valid()) { FatalErrorInFunction << "A mass transfer model for the " << pair.phase1().name() - << " side of the " << key << " pair is not specified. This is " - << "required by the corresponding interface composition model." + << " side of the " << uoPair << " pair is not " + << "specified. This is required by the corresponding interface " + << "composition model." << exit(FatalError); } } @@ -180,7 +195,6 @@ InterfaceCompositionPhaseChangePhaseSystem const phasePair& pair = this->phasePairs_[interfaceCompositionModelIter.key()]; - const phasePair unorderedPair(pair.phase1(), pair.phase2()); iDmdtSu_.insert(pair, new HashPtrTable()); iDmdtSp_.insert(pair, new HashPtrTable()); @@ -317,13 +331,14 @@ massTransfer() const this->phasePairs_[interfaceCompositionModelIter.key()]; const phaseModel& phase = pair.phase1(); const phaseModel& otherPhase = pair.phase2(); - const phasePair unorderedPair(phase, otherPhase); + const phasePair& unorderedPair = + this->phasePairs_[phasePair(phase, otherPhase)]; const volScalarField& Tf(*this->Tf_[unorderedPair]); const volScalarField K ( - massTransferModels_[unorderedPair][pair.index(phase)]->K() + massTransferModels_[unorderedPair][unorderedPair.index(phase)]->K() ); forAllConstIter(hashedWordList, compositionModel.species(), memberIter)