From c0798213189c40c62b3a9ef41628e9eb15641cdd Mon Sep 17 00:00:00 2001
From: Henry <Henry>
Date: Thu, 29 Dec 2011 23:48:09 +0000
Subject: [PATCH] rhoCentralDyMFoam: Improved the handling of relative fluxes
 and corrected the pressure-work term

---
 .../rhoCentralDyMFoam/rhoCentralDyMFoam.C        | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C
index 4d0927a6afa..363a8fd2dcf 100644
--- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C
+++ b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C
@@ -109,6 +109,9 @@ int main(int argc, char *argv[])
         surfaceScalarField phiv_pos(U_pos & mesh.Sf());
         surfaceScalarField phiv_neg(U_neg & mesh.Sf());
 
+        fvc::makeRelative(phiv_pos, U);
+        fvc::makeRelative(phiv_neg, U);
+
         volScalarField c(sqrt(thermo.Cp()/thermo.Cv()*rPsi));
         surfaceScalarField cSf_pos
         (
@@ -161,17 +164,9 @@ int main(int argc, char *argv[])
         Info<< "Time = " << runTime.timeName() << nl << endl;
 
         mesh.movePoints(motionPtr->newPoints());
-        phiv_pos = U_pos & mesh.Sf();
-        phiv_neg = U_neg & mesh.Sf();
-        fvc::makeRelative(phiv_pos, U);
-        fvc::makeRelative(phiv_neg, U);
-        phiv_neg -= mesh.phi();
-        phiv_pos *= a_pos;
-        phiv_neg *= a_neg;
-        aphiv_pos = phiv_pos - aSf;
-        aphiv_neg = phiv_neg + aSf;
 
-        surfaceScalarField phi("phi", aphiv_pos*rho_pos + aphiv_neg*rho_neg);
+        phi = aphiv_pos*rho_pos + aphiv_neg*rho_neg;
+        Info<< phi.boundaryField()[0] << endl;
 
         surfaceVectorField phiUp
         (
@@ -183,6 +178,7 @@ int main(int argc, char *argv[])
         (
             aphiv_pos*(rho_pos*(e_pos + 0.5*magSqr(U_pos)) + p_pos)
           + aphiv_neg*(rho_neg*(e_neg + 0.5*magSqr(U_neg)) + p_neg)
+          + mesh.phi()*(a_pos*p_pos + a_neg*p_neg)
           + aSf*p_pos - aSf*p_neg
         );
 
-- 
GitLab