From d81d99d490abac139dd83095e7fef0944918c4ab Mon Sep 17 00:00:00 2001
From: Henry <Henry>
Date: Sat, 9 Jul 2011 22:24:28 +0100
Subject: [PATCH] bubbleFoam, twoPhaseEulerFoam: Added storage of pressure from
 the previous iteration for PIMPLE

---
 .../multiphase/bubbleFoam/bubbleFoam.C        | 19 +++++++++++++++----
 .../twoPhaseEulerFoam/twoPhaseEulerFoam.C     |  9 ++++++---
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C b/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C
index d028a1376fc..e526266c90b 100644
--- a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C
+++ b/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C
@@ -34,6 +34,7 @@ Description
 #include "nearWallDist.H"
 #include "wallFvPatch.H"
 #include "Switch.H"
+
 #include "pimpleControl.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -47,6 +48,9 @@ int main(int argc, char *argv[])
     #include "readGravitationalAcceleration.H"
     #include "createFields.H"
     #include "initContinuityErrs.H"
+    #include "readTimeControls.H"
+    #include "CourantNo.H"
+    #include "setInitialDeltaT.H"
 
     pimpleControl pimple(mesh);
 
@@ -54,16 +58,23 @@ int main(int argc, char *argv[])
 
     Info<< "\nStarting time loop\n" << endl;
 
-    while (runTime.loop())
+    while (runTime.run())
     {
-        Info<< "Time = " << runTime.timeName() << nl << endl;
-
         #include "readBubbleFoamControls.H"
         #include "CourantNo.H"
+        #include "setDeltaT.H"
+
+        runTime++;
+        Info<< "Time = " << runTime.timeName() << nl << endl;
 
         // --- Pressure-velocity PIMPLE corrector loop
         for (pimple.start(); pimple.loop(); pimple++)
         {
+            if (pimple.nOuterCorr() != 1)
+            {
+                p.storePrevIter();
+            }
+
             #include "alphaEqn.H"
             #include "liftDragCoeffs.H"
             #include "UEqns.H"
@@ -73,7 +84,7 @@ int main(int argc, char *argv[])
             {
                 #include "pEqn.H"
 
-                if (correctAlpha)
+                if (correctAlpha && !pimple.finalIter())
                 {
                     #include "alphaEqn.H"
                 }
diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C
index 17cf2e7ec0c..3341d192dd3 100644
--- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C
+++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C
@@ -26,7 +26,7 @@ Application
 
 Description
     Solver for a system of 2 incompressible fluid phases with one phase
-    dispersed, e.g. gas bubbles in a liquid.
+    dispersed, e.g. gas bubbles in a liquid or solid particles in a gas.
 
 \*---------------------------------------------------------------------------*/
 
@@ -78,10 +78,13 @@ int main(int argc, char *argv[])
         // --- Pressure-velocity PIMPLE corrector loop
         for (pimple.start(); pimple.loop(); pimple++)
         {
-            #include "alphaEqn.H"
+            if (pimple.nOuterCorr() != 1)
+            {
+                p.storePrevIter();
+            }
 
+            #include "alphaEqn.H"
             #include "liftDragCoeffs.H"
-
             #include "UEqns.H"
 
             // --- PISO loop
-- 
GitLab