From 3f20e26231429368b5167963cb092f1c035de526 Mon Sep 17 00:00:00 2001
From: henry <Henry Weller h.weller@opencfd.co.uk>
Date: Tue, 27 May 2008 17:13:35 +0100
Subject: [PATCH] Reverting ddtPhiCorr back to standard (not good for moving
 meshes)

---
 .../incompressible/icoDyMFoam/icoDyMFoam.C    | 63 +++----------------
 .../multiphase/interDyMFoam/interDyMFoam.C    | 10 +--
 .../solvers/multiphase/interDyMFoam/pEqn.H    | 38 ++---------
 3 files changed, 16 insertions(+), 95 deletions(-)

diff --git a/applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C b/applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C
index d76d8c9ce48..814e755326f 100644
--- a/applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C
+++ b/applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C
@@ -56,6 +56,7 @@ int main(int argc, char *argv[])
     {
 #       include "readControls.H"
 #       include "CourantNo.H"
+
 #       include "setDeltaT.H"
 
         runTime++;
@@ -63,10 +64,7 @@ int main(int argc, char *argv[])
         Info<< "Time = " << runTime.timeName() << nl << endl;
 
         // Make the fluxes absolute
-        if (mesh.changing())
-        {
-            phi = fvc::interpolate(U) & mesh.Sf();
-        }
+        fvc::makeAbsolute(phi, U);
 
         mesh.update();
 
@@ -75,14 +73,8 @@ int main(int argc, char *argv[])
 #           include "correctPhi.H"
         }
 
-        // Keep the absolute fluxes for use in ddtPhiCorr
-        surfaceScalarField phiAbs0("phiAbs0", phi);
-
         // Make the fluxes relative to the mesh motion
-        if (mesh.changing())
-        {
-            fvc::makeRelative(phi, U);
-        }
+        fvc::makeRelative(phi, U);
 
         if (mesh.changing() && checkMeshCourantNo)
         {
@@ -106,49 +98,14 @@ int main(int argc, char *argv[])
 
                 if (ddtPhiCorr)
                 {
-                    if (mesh.changing())
-                    {
-                        dimensionedScalar rDeltaT = 1.0/mesh.time().deltaT();
-
-                        volScalarField V0byV
-                        (
-                            IOobject
-                            (
-                                "V0byV",
-                                mesh.time().timeName(),
-                                mesh
-                            ),
-                            mesh,
-                            dimensionedScalar("V0byV", dimless, 1),
-                            zeroGradientFvPatchScalarField::typeName
-                        );
-                        V0byV.dimensionedInternalField() = mesh.V0()/mesh.V();
-                        V0byV.correctBoundaryConditions();
-
-                        phi += rDeltaT*
-                        (
-                            fvc::interpolate(rAU*V0byV)*phiAbs0
-                          - (fvc::interpolate(rAU*V0byV*U.oldTime()) & mesh.Sf())
-                        );
-                    }
-                    else
-                    {
-                        phi += fvc::ddtPhiCorr(rAU, U, phiAbs0);
-                    }
+                    phi += fvc::ddtPhiCorr(rAU, U, phi);
                 }
 
                 if (p.needReference())
                 {
-                    if (mesh.changing())
-                    {
-                        fvc::makeRelative(phi, U);
-                        adjustPhi(phi, U, p);
-                        fvc::makeAbsolute(phi, U);
-                    }
-                    else
-                    {
-                        adjustPhi(phi, U, p);
-                    }
+                    fvc::makeRelative(phi, U);
+                    adjustPhi(phi, U, p);
+                    fvc::makeAbsolute(phi, U);
                 }
 
                 for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@@ -183,11 +140,11 @@ int main(int argc, char *argv[])
                     p.relax();
                 }
 
-                U -= rAU*fvc::grad(p);
-                U.correctBoundaryConditions();
-
                 // Make the fluxes relative to the mesh motion
                 fvc::makeRelative(phi, U);
+
+                U -= rAU*fvc::grad(p);
+                U.correctBoundaryConditions();
             }
         }
 
diff --git a/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C
index f0631fdd994..9d6b9c4cd9e 100644
--- a/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C
+++ b/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C
@@ -74,10 +74,7 @@ int main(int argc, char *argv[])
         Info<< "Time = " << runTime.timeName() << nl << endl;
 
         // Make the fluxes absolute
-        if (mesh.changing())
-        {
-            phi = fvc::interpolate(U) & mesh.Sf();
-        }
+        fvc::makeAbsolute(phi, U);
 
         scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
 
@@ -103,10 +100,7 @@ int main(int argc, char *argv[])
         surfaceScalarField phiAbs0("phiAbs0", phi);
 
         // Make the fluxes relative to the mesh motion
-        if (mesh.changing())
-        {
-            fvc::makeRelative(phi, U);
-        }
+        fvc::makeRelative(phi, U);
 
         if (mesh.changing() && checkMeshCourantNo)
         {
diff --git a/applications/solvers/multiphase/interDyMFoam/pEqn.H b/applications/solvers/multiphase/interDyMFoam/pEqn.H
index 74c301af6eb..0fdba99cd69 100644
--- a/applications/solvers/multiphase/interDyMFoam/pEqn.H
+++ b/applications/solvers/multiphase/interDyMFoam/pEqn.H
@@ -7,30 +7,7 @@
 
     if (ddtPhiCorr)
     {
-        //phiU += fvc::ddtPhiCorr(rAU, rho, U, phiAbs0);
-
-        dimensionedScalar rDeltaT = 1.0/mesh.time().deltaT();
-
-        volScalarField V0byV
-        (
-            IOobject
-            (
-                "V0byV",
-                mesh.time().timeName(),
-                mesh
-            ),
-            mesh,
-            dimensionedScalar("V0byV", dimless, 1),
-            zeroGradientFvPatchScalarField::typeName
-        );
-        V0byV.dimensionedInternalField() = mesh.V0()/mesh.V();
-        V0byV.correctBoundaryConditions();
-
-        phiU += rDeltaT*
-        (
-            fvc::interpolate(rAU*rho.oldTime()*V0byV)*phiAbs0
-          - (fvc::interpolate(rAU*rho.oldTime()*V0byV*U.oldTime()) & mesh.Sf())
-        );
+        phiU += fvc::ddtPhiCorr(rAU, rho, U, phiAbs0);
     }
 
     phi = phiU +
@@ -41,16 +18,9 @@
 
     if (pd.needReference())
     {
-        if (mesh.changing())
-        {
-            fvc::makeRelative(phi, U);
-            adjustPhi(phi, U, pd);
-            fvc::makeAbsolute(phi, U);
-        }
-        else
-        {
-            adjustPhi(phi, U, pd);
-        }
+        fvc::makeRelative(phi, U);
+        adjustPhi(phi, U, pd);
+        fvc::makeAbsolute(phi, U);
     }
 
     for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
-- 
GitLab