From dbe5e08213b45a8072f80a64bab05479e24d34ff Mon Sep 17 00:00:00 2001
From: andy <a.heather@opencfd.co.uk>
Date: Fri, 19 Dec 2008 13:59:05 +0000
Subject: [PATCH] minor mods:     - added pdFinal option     - labelled muf -
 grad(muf) used, so can now manipulate in fvSolution etc     - added
 absolute/relative around the calculation of divU

---
 .../compressibleInterDyMFoam/UEqn.H           |  7 +++-
 .../alphaEqnsSubCycle.H                       |  2 +
 .../compressibleInterDyMFoam/pEqn.H           | 40 ++++++++++++++-----
 3 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/UEqn.H b/applications/solvers/multiphase/compressibleInterDyMFoam/UEqn.H
index 90033f9826f..53257cf369c 100644
--- a/applications/solvers/multiphase/compressibleInterDyMFoam/UEqn.H
+++ b/applications/solvers/multiphase/compressibleInterDyMFoam/UEqn.H
@@ -1,6 +1,9 @@
-    surfaceScalarField muf =
+    surfaceScalarField muf
+    (
+        "muf",
         twoPhaseProperties.muf()
-      + fvc::interpolate(rho*turbulence->nut());
+      + fvc::interpolate(rho*turbulence->nut())
+    );
 
     fvVectorMatrix UEqn
     (
diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqnsSubCycle.H
index e161a3cbe6b..32a7163130e 100644
--- a/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqnsSubCycle.H
+++ b/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqnsSubCycle.H
@@ -12,7 +12,9 @@
     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)
     {
diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterDyMFoam/pEqn.H
index b0f3378408f..7e4b37061fd 100644
--- a/applications/solvers/multiphase/compressibleInterDyMFoam/pEqn.H
+++ b/applications/solvers/multiphase/compressibleInterDyMFoam/pEqn.H
@@ -30,7 +30,7 @@
           - ghf*fvc::snGrad(rho)
         )*rUAf*mesh.magSf();
 
-    for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
+    for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
     {
         fvScalarMatrix pdEqnIncomp
         (
@@ -38,15 +38,36 @@
           - fvm::laplacian(rUAf, pd)
         );
 
-        solve
+        if
         (
+            oCorr == nOuterCorr-1
+            && corr == nCorr-1
+            && nonOrth == nNonOrthCorr
+        )
+        {
+            solve
             (
-                max(alpha1, scalar(0))*(psi1/rho1)
-              + max(alpha2, scalar(0))*(psi2/rho2)
-            )
-           *pdEqnComp()
-          + pdEqnIncomp
-        );
+                (
+                    max(alpha1, scalar(0))*(psi1/rho1)
+                  + max(alpha2, scalar(0))*(psi2/rho2)
+                )
+               *pdEqnComp()
+              + pdEqnIncomp,
+                mesh.solver(pd.name() + "Final")
+            );
+        }
+        else
+        {
+            solve
+            (
+                (
+                    max(alpha1, scalar(0))*(psi1/rho1)
+                  + max(alpha2, scalar(0))*(psi2/rho2)
+                )
+               *pdEqnComp()
+              + pdEqnIncomp
+            );
+        }
 
         if (nonOrth == nNonOrthCorr)
         {
@@ -62,7 +83,8 @@
 
     p = max
         (
-            (pd + gh*(alpha1*rho10 + alpha2*rho20))/(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
+            (pd + gh*(alpha1*rho10 + alpha2*rho20))
+           /(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
             pMin
         );
 
-- 
GitLab