From 0f1921787e196ad772095b629760b18dc0d74b94 Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Tue, 3 May 2016 14:53:11 +0100
Subject: [PATCH] reactingTwoPhaseEulerFoam: Update p_rgh following density
 changes Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=2073

---
 .../reactingTwoPhaseEulerFoam/pU/pEqn.H               |  7 ++++---
 .../reactingTwoPhaseEulerFoam/pUf/pEqn.H              | 11 ++++-------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pU/pEqn.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pU/pEqn.H
index 3eda1b871e..6922869aa2 100644
--- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pU/pEqn.H
+++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pU/pEqn.H
@@ -85,6 +85,10 @@ while (pimple.correct())
 {
     // Update continuity errors due to temperature changes
     fluid.correct();
+    volScalarField rho("rho", fluid.rho());
+
+    // Correct p_rgh for consistency with p and the updated densities
+    p_rgh = p - rho*gh;
 
     // Correct fixed-flux BCs to be consistent with the velocity BCs
     MRF.correctBoundaryFlux(U1, phi1);
@@ -116,9 +120,6 @@ while (pimple.correct())
            *rho2*U2.oldTime()/runTime.deltaT()
         );
 
-    // Mean density for buoyancy force and p_rgh -> p
-    volScalarField rho("rho", fluid.rho());
-
     surfaceScalarField ghSnGradRho
     (
         "ghSnGradRho",
diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H
index 01c120d481..ddc262ba78 100644
--- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H
+++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H
@@ -95,6 +95,10 @@ while (pimple.correct())
 {
     // Update continuity errors due to temperature changes
     fluid.correct();
+    volScalarField rho("rho", fluid.rho());
+
+    // Correct p_rgh for consistency with p and the updated densities
+    p_rgh = p - rho*gh;
 
     surfaceScalarField rhof1(fvc::interpolate(rho1));
     surfaceScalarField rhof2(fvc::interpolate(rho2));
@@ -115,7 +119,6 @@ while (pimple.correct())
         max(alphaf2, phase2.residualAlpha())*rAUf2
     );
 
-    volScalarField rho("rho", fluid.rho());
     surfaceScalarField ghSnGradRho
     (
         "ghSnGradRho",
@@ -389,12 +392,6 @@ while (pimple.correct())
         }
     }
 
-    Info<< "min(p) = " << min(p_rgh + rho*gh).value() << endl;
-    if (min(p_rgh + rho*gh) < pMin)
-    {
-        Info<< "Clipping p" << endl;
-    }
-
     // Update and limit the static pressure
     p = max(p_rgh + rho*gh, pMin);
 
-- 
GitLab