From 766abbc075bf0810d4741f4af940feb64b0a9594 Mon Sep 17 00:00:00 2001
From: Henry <Henry>
Date: Wed, 24 Oct 2012 17:25:00 +0100
Subject: [PATCH] multiphase solver: Update and rationalize the
 alphaEqnSubCycling.H

---
 .../compressibleInterFoam/alphaEqnsSubCycle.H |  8 +---
 .../alphaEqnsSubCycle.H                       | 40 -------------------
 .../compressibleInterDyMFoam.C                |  6 +++
 .../compressibleInterFoam.C                   |  6 +++
 .../interFoam/LTSInterFoam/LTSInterFoam.C     |  1 +
 .../interFoam/LTSInterFoam/alphaEqn.H         |  4 +-
 .../interFoam/LTSInterFoam/alphaEqnSubCycle.H |  9 +----
 .../interFoam/MRFInterFoam/MRFInterFoam.C     |  1 +
 .../multiphase/interFoam/alphaEqnSubCycle.H   |  2 -
 .../interFoam/interDyMFoam/interDyMFoam.C     |  1 +
 .../solvers/multiphase/interFoam/interFoam.C  |  2 +-
 .../porousInterFoam/porousInterFoam.C         |  1 +
 .../interMixingFoam/alphaEqnsSubCycle.H       |  2 -
 .../interMixingFoam/interMixingFoam.C         |  1 +
 .../interPhaseChangeFoam/alphaEqnSubCycle.H   |  5 ---
 .../interPhaseChangeFoam.C                    |  5 +++
 .../twoLiquidMixingFoam/twoLiquidMixingFoam.C |  2 +-
 17 files changed, 29 insertions(+), 67 deletions(-)
 delete mode 100644 applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H

diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H
index 2d70a5bab59..be34ab52ed0 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H
+++ b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H
@@ -6,7 +6,7 @@
     surfaceScalarField phic(mag(phi/mesh.magSf()));
     phic = min(interface.cAlpha()*phic, max(phic));
 
-    volScalarField divU(fvc::div(phi));
+    volScalarField divU(fvc::div(fvc::absolute(phi, U)));
 
     if (nAlphaSubCycles > 1)
     {
@@ -29,10 +29,4 @@
     {
         #include "alphaEqns.H"
     }
-
-    // correct interface on first PIMPLE corrector
-    if (pimple.corr() == 1)
-    {
-        interface.correct();
-    }
 }
diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H
deleted file mode 100644
index ade8af00817..00000000000
--- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H
+++ /dev/null
@@ -1,40 +0,0 @@
-{
-    label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr")));
-
-    label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles")));
-
-    surfaceScalarField phic(mag(phi/mesh.magSf()));
-    phic = min(interface.cAlpha()*phic, max(phic));
-
-    fvc::makeAbsolute(phi, U);
-    volScalarField divU(fvc::div(phi));
-    fvc::makeRelative(phi, U);
-
-    if (nAlphaSubCycles > 1)
-    {
-        dimensionedScalar totalDeltaT = runTime.deltaT();
-        surfaceScalarField rhoPhiSum(0.0*rhoPhi);
-
-        for
-        (
-            subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles);
-            !(++alphaSubCycle).end();
-        )
-        {
-            #include "alphaEqns.H"
-            rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi;
-        }
-
-        rhoPhi = rhoPhiSum;
-    }
-    else
-    {
-        #include "alphaEqns.H"
-    }
-
-    // correct interface on first PIMPLE corrector
-    if (pimple.corr() == 1)
-    {
-        interface.correct();
-    }
-}
diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C
index b9f52944e84..acf563fc8e2 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C
+++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C
@@ -122,6 +122,12 @@ int main(int argc, char *argv[])
         {
             #include "alphaEqnsSubCycle.H"
 
+            // correct interface on first PIMPLE corrector
+            if (pimple.corr() == 1)
+            {
+                interface.correct();
+            }
+
             solve(fvm::ddt(rho) + fvc::div(rhoPhi));
 
             #include "UEqn.H"
diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C
index 7c24e05a1af..54c246f203b 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C
+++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C
@@ -80,6 +80,12 @@ int main(int argc, char *argv[])
         {
             #include "alphaEqnsSubCycle.H"
 
+            // correct interface on first PIMPLE corrector
+            if (pimple.corr() == 1)
+            {
+                interface.correct();
+            }
+
             solve(fvm::ddt(rho) + fvc::div(rhoPhi));
 
             #include "UEqn.H"
diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C
index 06811c21919..c1d9630a006 100644
--- a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C
+++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C
@@ -77,6 +77,7 @@ int main(int argc, char *argv[])
         twoPhaseProperties.correct();
 
         #include "alphaEqnSubCycle.H"
+        interface.correct();
 
         turbulence->correct();
 
diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqn.H b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqn.H
index 0c2cf71e4ed..5f5ac824b8a 100644
--- a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqn.H
+++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqn.H
@@ -30,8 +30,8 @@
         rhoPhi = phiAlpha*(rho1 - rho2) + phi*rho2;
     }
 
-    Info<< "Liquid phase volume fraction = "
-        << alpha1.weightedAverage(mesh.V()).value()
+    Info<< "Phase-1 volume fraction = "
+        << alpha1.weightedAverage(mesh.Vsc()).value()
         << "  Min(alpha1) = " << min(alpha1).value()
         << "  Max(alpha1) = " << max(alpha1).value()
         << endl;
diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H
index b59b0ae5fe2..6c82f940499 100644
--- a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H
+++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H
@@ -1,8 +1,5 @@
-const dictionary& pimpleDict = pimple.dict();
-
-label nAlphaCorr(readLabel(pimpleDict.lookup("nAlphaCorr")));
-
-label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles")));
+label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr")));
+label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles")));
 
 if (nAlphaSubCycles > 1)
 {
@@ -26,6 +23,4 @@ else
     #include "alphaEqn.H"
 }
 
-interface.correct();
-
 rho == alpha1*rho1 + (scalar(1) - alpha1)*rho2;
diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C
index 042a17e1f3c..6d2ad224b43 100644
--- a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C
+++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C
@@ -81,6 +81,7 @@ int main(int argc, char *argv[])
         twoPhaseProperties.correct();
 
         #include "alphaEqnSubCycle.H"
+        interface.correct();
         #include "zonePhaseVolumes.H"
 
         // --- Pressure-velocity PIMPLE corrector loop
diff --git a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H
index fa56de00bb4..6c82f940499 100644
--- a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H
+++ b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H
@@ -23,6 +23,4 @@ else
     #include "alphaEqn.H"
 }
 
-interface.correct();
-
 rho == alpha1*rho1 + (scalar(1) - alpha1)*rho2;
diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C
index 3d450a39170..730c535eff0 100644
--- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C
+++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C
@@ -114,6 +114,7 @@ int main(int argc, char *argv[])
         twoPhaseProperties.correct();
 
         #include "alphaEqnSubCycle.H"
+        interface.correct();
 
         // --- Pressure-velocity PIMPLE corrector loop
         while (pimple.loop())
diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C
index 559916f2ce3..20d2777ef52 100644
--- a/applications/solvers/multiphase/interFoam/interFoam.C
+++ b/applications/solvers/multiphase/interFoam/interFoam.C
@@ -43,7 +43,6 @@ Description
 #include "interfaceProperties.H"
 #include "twoPhaseMixture.H"
 #include "turbulenceModel.H"
-#include "interpolationTable.H"
 #include "pimpleControl.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -82,6 +81,7 @@ int main(int argc, char *argv[])
         twoPhaseProperties.correct();
 
         #include "alphaEqnSubCycle.H"
+        interface.correct();
 
         // --- Pressure-velocity PIMPLE corrector loop
         while (pimple.loop())
diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C
index 244ea75faef..795b7c14a1f 100644
--- a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C
+++ b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C
@@ -83,6 +83,7 @@ int main(int argc, char *argv[])
         twoPhaseProperties.correct();
 
         #include "alphaEqnSubCycle.H"
+        interface.correct();
 
         // --- Pressure-velocity PIMPLE corrector loop
         while (pimple.loop())
diff --git a/applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H
index d816f8acedf..97a09ce017d 100644
--- a/applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H
+++ b/applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H
@@ -24,8 +24,6 @@ else
     #include "alphaEqns.H"
 }
 
-interface.correct();
-
 {
     volScalarField rhoNew(alpha1*rho1 + alpha2*rho2 + alpha3*rho3);
 
diff --git a/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C b/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C
index d4b1194ba11..9f9095b4075 100644
--- a/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C
+++ b/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C
@@ -74,6 +74,7 @@ int main(int argc, char *argv[])
         threePhaseProperties.correct();
 
         #include "alphaEqnsSubCycle.H"
+        interface.correct();
 
         #define twoPhaseProperties threePhaseProperties
 
diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H
index 6e02524e262..ad2cf243d2b 100644
--- a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H
+++ b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H
@@ -40,10 +40,5 @@ surfaceScalarField rhoPhi
         #include "alphaEqn.H"
     }
 
-    if (pimple.nCorrPIMPLE() == 1)
-    {
-        interface.correct();
-    }
-
     rho == alpha1*rho1 + (scalar(1) - alpha1)*rho2;
 }
diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C
index 5ed807bbad4..59cb7f553e7 100644
--- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C
+++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C
@@ -82,6 +82,11 @@ int main(int argc, char *argv[])
 
         #include "alphaEqnSubCycle.H"
 
+        if (pimple.nCorrPIMPLE() == 1)
+        {
+            interface.correct();
+        }
+
         turbulence->correct();
 
         // --- Pressure-velocity PIMPLE corrector loop
diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C
index 22c709c960a..6113aba01f1 100644
--- a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C
+++ b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
-- 
GitLab