From 80175df2ddfe9f0703726f03c3edbb675c41cf2b Mon Sep 17 00:00:00 2001
From: henry <Henry Weller h.weller@opencfd.co.uk>
Date: Fri, 29 May 2009 11:57:15 +0100
Subject: [PATCH] Changed the BC to switch between "pd" and static pressure
 according to the variable name.

---
 .../fixedFluxBuoyantPressureFvPatchScalarField.C     | 12 +++++++++++-
 .../fixedFluxBuoyantPressureFvPatchScalarField.H     |  5 ++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxBuoyantPressure/fixedFluxBuoyantPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxBuoyantPressure/fixedFluxBuoyantPressureFvPatchScalarField.C
index c31f5acc5c3..b6f48ff6ada 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxBuoyantPressure/fixedFluxBuoyantPressureFvPatchScalarField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxBuoyantPressure/fixedFluxBuoyantPressureFvPatchScalarField.C
@@ -113,7 +113,17 @@ void fixedFluxBuoyantPressureFvPatchScalarField::updateCoeffs()
     const fvPatchField<scalar>& rho =
         patch().lookupPatchField<volScalarField, scalar>("rho");
 
-    gradient() = -rho.snGrad()*(g.value() & patch().Cf());
+    // If the variable name is "pd" assume it is p - rho*g.h
+    // and set the gradient appropriately.
+    // Otherwise assume the variable is the static pressure.
+    if (dimensionedInternalField().name() == "pd")
+    {
+        gradient() = -rho.snGrad()*(g.value() & patch().Cf());
+    }
+    else
+    {
+        gradient() = rho*(g.value() & patch().nf());
+    }
 
     fixedGradientFvPatchScalarField::updateCoeffs();
 }
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxBuoyantPressure/fixedFluxBuoyantPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxBuoyantPressure/fixedFluxBuoyantPressureFvPatchScalarField.H
index 3ce584bf873..8e433cb8f16 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxBuoyantPressure/fixedFluxBuoyantPressureFvPatchScalarField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxBuoyantPressure/fixedFluxBuoyantPressureFvPatchScalarField.H
@@ -26,7 +26,10 @@ Class
     Foam::fixedFluxBuoyantPressureFvPatchScalarField
 
 Description
-    Foam::fixedFluxBuoyantPressureFvPatchScalarField
+    Set the pressure gradient boundary condition appropriately for buoyant flow.
+
+    If the variable name is "pd" assume it is p - rho*g.h and set the gradient
+    appropriately.  Otherwise assume the variable is the static pressure.
 
 SourceFiles
     fixedFluxBuoyantPressureFvPatchScalarField.C
-- 
GitLab