From 2d8ec16d6c82f2baeeb9027f1c92e37716e5fd12 Mon Sep 17 00:00:00 2001
From: andy <a.heather@opencfd.co.uk>
Date: Thu, 12 Feb 2009 10:11:57 +0000
Subject: [PATCH] update

---
 .../buoyantBoussinesqFoam/pdEqn.H             | 23 ++++++++-----------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqFoam/pdEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqFoam/pdEqn.H
index a74b4e80221..25e2a9817fb 100644
--- a/applications/solvers/heatTransfer/buoyantBoussinesqFoam/pdEqn.H
+++ b/applications/solvers/heatTransfer/buoyantBoussinesqFoam/pdEqn.H
@@ -5,10 +5,13 @@
     U = rUA*UEqn().H();
     UEqn.clear();
 
-    phi =
+    surfaceScalarField phiU
+    (
         (fvc::interpolate(U) & mesh.Sf())
       + fvc::ddtPhiCorr(rUA, U, phi)
-      + betaghf*fvc::snGrad(T)*rUAf*mesh.magSf();
+    );
+
+    phi = phiU + betaghf*fvc::snGrad(T)*rUAf*mesh.magSf();
 
     for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
     {
@@ -17,8 +20,7 @@
             fvm::laplacian(rUAf, pd) == fvc::div(phi)
         );
 
-        // retain the residual from the first iteration
-        if (nonOrth == 0)
+        if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
         {
             pdEqn.solve(mesh.solver(pd.name() + "Final"));
         }
@@ -29,17 +31,12 @@
 
         if (nonOrth == nNonOrthCorr)
         {
-            // Calculate the conservative fluxes
-            phi -= pdEqn.flux();
-
-            // Correct the momentum source with the pressure gradient flux
-            // calculated from the relaxed pressure
-            U -=
-                rUA
-               *fvc::reconstruct((pdEqn.flux() - betaghf*fvc::snGrad(T))/rUAf);
-            U.correctBoundaryConditions();
+            phi += pdEqn.flux();
         }
     }
 
+    U -= rUA*fvc::reconstruct((phi - phiU)/rUAf);
+    U.correctBoundaryConditions();
+
     #include "continuityErrs.H"
 }
-- 
GitLab