diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C index 8297cd691c74b536269310dad0d0eeffe7818e8d..7f225f4607a1dd10269e96ef9aaa248008a3c705 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -73,17 +73,19 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readControls.H" - #include "CourantNo.H" - #include "setDeltaT.H" + { + // Store divU from the previous mesh so that it can be mapped + // and used in correctPhi to ensure the corrected phi has the + // same divergence + volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U))); - runTime++; + #include "CourantNo.H" + #include "setDeltaT.H" - Info<< "Time = " << runTime.timeName() << nl << endl; + runTime++; - { - // Store divU from the previous mesh for the correctPhi - volScalarField divU(fvc::div(fvc::absolute(phi, U))); + Info<< "Time = " << runTime.timeName() << nl << endl; scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C index db6b7111d0b30db8837f9e9d87710ce1efabf9c3..5c05875e35811c63f0a837fe2bc1f58fca785c95 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C @@ -94,6 +94,12 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "../interFoam/interDyMFoam/readControls.H" + + // Store divU from the previous mesh so that it can be mapped + // and used in correctPhi to ensure the corrected phi has the + // same divergence + volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U))); + #include "CourantNo.H" #include "setDeltaT.H" @@ -106,9 +112,6 @@ int main(int argc, char *argv[]) { if (pimple.firstIter() || moveMeshOuterCorrectors) { - // Store divU from the previous mesh for the correctPhi - volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U))); - scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); mesh.update();