From 4d7f98cd533af6852d6712c9153e65159ed10d20 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Mon, 18 Jun 2018 09:10:15 +0100 Subject: [PATCH] reactingEulerFoam: Fail if surface tension model does not exist The access of the surface tension coefficient has been changed in some places so that an error is generated rather than returning a default value of zero. The reciprocal of the surface tension coefficient is frequently used in sub-models, so returning zero can generate a floating point exception. A "surface tension model does not exist" warning is preferable in these cases. Patch to populationBalanceModel.C contributed by Institute of Fluid Dynamics, Helmholtz-Zentrum Dresden - Rossendorf (HZDR) --- .../phaseSystems/phasePair/phasePair/phasePair.C | 7 ++++++- .../populationBalanceModel/populationBalanceModel.C | 13 ++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phasePair/phasePair/phasePair.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phasePair/phasePair/phasePair.C index 77d113817..701e1eee8 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phasePair/phasePair/phasePair.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phasePair/phasePair/phasePair.C @@ -25,6 +25,7 @@ License #include "phasePair.H" #include "phaseSystem.H" +#include "surfaceTensionModel.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -165,7 +166,11 @@ Foam::tmp Foam::phasePair::EoH2() const Foam::tmp Foam::phasePair::sigma() const { - return phase1().fluid().sigma(phasePair(phase1(), phase2())); + return + phase1().fluid().lookupSubModel + ( + phasePair(phase1(), phase2()) + ).sigma(); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C index 6d269cd03..8cbe0d25a 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C @@ -30,6 +30,7 @@ License #include "driftModel.H" #include "nucleationModel.H" #include "phaseSystem.H" +#include "surfaceTensionModel.H" #include "fvmDdt.H" #include "fvcDdt.H" #include "fvmSup.H" @@ -1152,13 +1153,11 @@ Foam::diameterModels::populationBalanceModel::sigmaWithContinuousPhase const phaseModel& dispersedPhase ) const { - const phasePairKey key - ( - dispersedPhase.name(), - continuousPhase_.name() - ); - - return fluid_.sigma(key); + return + fluid_.lookupSubModel + ( + phasePair(dispersedPhase, continuousPhase_) + ).sigma(); }