From 82f6848f17a0b5606c949483582c6720a913f7f0 Mon Sep 17 00:00:00 2001 From: Johan Roenby <johan.roenby@gmail.com> Date: Tue, 30 Apr 2019 10:59:32 +0200 Subject: [PATCH] BUG: interIsoFoam nAlphaSubCycles, nOuterCorrectors issue (fixes #1300) - failed when nAlphaSubCycles > 1 and nOuterCorrectors > 1. Fixed thanks to Henning Scheufler (DLR Bremen). --- .../multiphase/interIsoFoam/alphaEqn.H | 37 ------------------- .../interIsoFoam/alphaEqnSubCycle.H | 36 ++++++++++++++++++ 2 files changed, 36 insertions(+), 37 deletions(-) diff --git a/applications/solvers/multiphase/interIsoFoam/alphaEqn.H b/applications/solvers/multiphase/interIsoFoam/alphaEqn.H index 360b9097a1..fda7a30c9b 100644 --- a/applications/solvers/multiphase/interIsoFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interIsoFoam/alphaEqn.H @@ -1,48 +1,11 @@ { - if (pimple.nCorrPIMPLE() > 1) - { - // If nOuterCorrectors > 1 then for all but the first loop the advection - // of alpha is done using an average, 0.5*phi+0.5*phiNew where phi is - // the flux at the beginning of the time step and phiNew is the flux - // estimate at the end of the time step from the previous outer - // iteration. Similarly we use 0.5*U + 0.5*UNew in later iterations. - if (pimple.firstIter()) - { - // To recalculate the alpha1 update in subsequent iterations, we - // must store its current value before overwriting with the new - // value - alpha1.storePrevIter(); - // Storing initial phi and U for use in later outer iterations. - phi.storePrevIter(); - U.storePrevIter(); - } - else - { - // Resetting alpha1 to value before advection in first PIMPLE - // iteration. - alpha1 = alpha1.prevIter(); - - // Setting U and phi with which to advect interface. - U = 0.5*U.prevIter() + 0.5*U; - phi = 0.5*phi.prevIter() + 0.5*phi; - } - } - // Updating alpha1 advector.advect(); #include "rhofs.H" rhoPhi = advector.getRhoPhi(rho1f, rho2f); - if (!pimple.firstIter()) - { - // Resetting U and phi to value at latest iteration. - U = 2.0*U - U.prevIter(); - phi = 2.0*phi - phi.prevIter(); - } - alpha2 = 1.0 - alpha1; mixture.correct(); - } Info<< "Phase-1 volume fraction = " diff --git a/applications/solvers/multiphase/interIsoFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interIsoFoam/alphaEqnSubCycle.H index 3c8ba18f2b..65376d61fe 100644 --- a/applications/solvers/multiphase/interIsoFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interIsoFoam/alphaEqnSubCycle.H @@ -1,3 +1,32 @@ +if (pimple.nCorrPIMPLE() > 1) +{ + // If nOuterCorrectors > 1 then for all but the first loop the advection + // of alpha is done using an average, 0.5*phi+0.5*phiNew where phi is + // the flux at the beginning of the time step and phiNew is the flux + // estimate at the end of the time step from the previous outer + // iteration. Similarly we use 0.5*U + 0.5*UNew in later iterations. + if (pimple.firstIter()) + { + // To recalculate the alpha1 update in subsequent iterations, we + // must store its current value before overwriting with the new + // value + alpha1.storePrevIter(); + // Storing initial phi and U for use in later outer iterations. + phi.storePrevIter(); + U.storePrevIter(); + } + else + { + // Resetting alpha1 to value before advection in first PIMPLE + // iteration. + alpha1 = alpha1.prevIter(); + + // Temporarily setting U and phi with which to advect interface. + U = 0.5*U.prevIter() + 0.5*U; + phi = 0.5*phi.prevIter() + 0.5*phi; + } +} + if (nAlphaSubCycles > 1) { dimensionedScalar totalDeltaT = runTime.deltaT(); @@ -30,4 +59,11 @@ else #include "alphaEqn.H" } +if (!pimple.firstIter()) +{ + // Resetting U and phi to value at latest iteration. + U = 2.0*U - U.prevIter(); + phi = 2.0*phi - phi.prevIter(); +} + rho == alpha1*rho1 + alpha2*rho2; -- GitLab