diff --git a/applications/solvers/multiphase/reactingEulerFoam/functionObjects/phaseForces/phaseForces.C b/applications/solvers/multiphase/reactingEulerFoam/functionObjects/phaseForces/phaseForces.C index 7db1fe52fe..9355bc5ad6 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/functionObjects/phaseForces/phaseForces.C +++ b/applications/solvers/multiphase/reactingEulerFoam/functionObjects/phaseForces/phaseForces.C @@ -225,6 +225,7 @@ bool Foam::functionObjects::phaseForces::read(const dictionary& dict) bool Foam::functionObjects::phaseForces::execute() { + // Zero the force fields forAllConstIter ( HashPtrTable, @@ -232,73 +233,51 @@ bool Foam::functionObjects::phaseForces::execute() forceFieldIter ) { - const word& type = forceFieldIter.key(); - volVectorField& force = *forceFieldIter(); + *forceFieldIter() = Zero; + } - force = Zero; + // Add the forces from all the interfaces which contain this phase + forAllConstIter + ( + phaseSystem::phasePairTable, + fluid_.phasePairs(), + pairIter + ) + { + const phasePair& pair = pairIter(); - forAllConstIter - ( - phaseSystem::phasePairTable, - fluid_.phasePairs(), - pairIter - ) + if (pair.contains(phase_) && !pair.ordered()) { - const phasePair& pair = pairIter(); - - if (pair.contains(phase_) && !pair.ordered()) + if (fluid_.foundBlendedSubModel(pair)) { - if - ( - type == dragModel::typeName - && fluid_.foundBlendedSubModel(pair) - ) - { - force += - fluid_.lookupBlendedSubModel(pair).K() - *(pair.otherPhase(phase_).U() - phase_.U()); - } + *forceFields_[dragModel::typeName] += + fluid_.lookupBlendedSubModel(pair).K() + *(pair.otherPhase(phase_).U() - phase_.U()); + } - if - ( - type == virtualMassModel::typeName - && fluid_.foundBlendedSubModel(pair) - ) - { - force += - fluid_.lookupBlendedSubModel(pair).K() - *( - pair.otherPhase(phase_).DUDt() - - phase_.DUDt() - ); - } + if (fluid_.foundBlendedSubModel(pair)) + { + *forceFields_[virtualMassModel::typeName] += + fluid_.lookupBlendedSubModel(pair).K() + *(pair.otherPhase(phase_).DUDt() - phase_.DUDt()); + } - if - ( - type == liftModel::typeName - && fluid_.foundBlendedSubModel(pair) - ) - { - force += nonDragForce(pair); - } + if (fluid_.foundBlendedSubModel(pair)) + { + *forceFields_[liftModel::typeName] += + nonDragForce(pair); + } - if - ( - type == wallLubricationModel::typeName - && fluid_.foundBlendedSubModel(pair) - ) - { - force += nonDragForce(pair); - } + if (fluid_.foundBlendedSubModel(pair)) + { + *forceFields_[wallLubricationModel::typeName] += + nonDragForce(pair); + } - if - ( - type == turbulentDispersionModel::typeName - && fluid_.foundBlendedSubModel(pair) - ) - { - force += nonDragForce(pair); - } + if (fluid_.foundBlendedSubModel(pair)) + { + *forceFields_[turbulentDispersionModel::typeName] += + nonDragForce(pair); } } }