From c83f3eda026fc89e717c2c81cabfb8753f54c162 Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Fri, 14 Jun 2019 09:53:49 +0100 Subject: [PATCH] ENH: hydrostaticPressure FO - updated handling of pRef --- .../hydrostaticPressure/hydrostaticPressure.C | 8 +++++++- .../hydrostaticPressure/hydrostaticPressure.H | 7 ++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.C b/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.C index 1b7e2505c7..2ea4db38c7 100644 --- a/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.C +++ b/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.C @@ -57,6 +57,10 @@ Foam::dimensionedScalar Foam::functionObjects::hydrostaticPressure::pRef() const { if (pRefName_ == "none") + { + return dimensionedScalar(dimPressure, Zero); + } + else if (pRefName_ == "pInf") { return dimensionedScalar("pRef", dimPressure, pRefValue_); } @@ -217,10 +221,12 @@ bool Foam::functionObjects::hydrostaticPressure::read(const dictionary& dict) dict.readIfPresent("ghf", ghfName_); dict.readIfPresent("nCorrectors", nCorrectors_); - if (pRefName_ == "none") + pRefValue_ = 0; + if (pRefName_ == "pInf") { pRefValue_ = dict.get("pRefValue"); } + return true; } diff --git a/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.H b/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.H index d14228fe1e..ce280223e7 100644 --- a/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.H +++ b/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,6 +48,7 @@ Usage p_rgh | Name of p_rgh field | no | p_rgh ph_rgh | Name of ph_rgh field | no | ph_rgh pRef | Name of pressure ref field | no | pRef + pRefValue | Value of pressure ref when pRef set to pInf | no | 0 rho | Name of density field | no | rho U | Name of velocity field | no | U gh | Name of gravity*height volume field | no | gh @@ -97,10 +98,10 @@ protected: word ph_rghName_; //- Name of uniform pressure reference field, default is "pRef" - // Set to "none" to set to zero + // Set to "none" to set to zero or pInf to set according to pRefValue word pRefName_; - //- Reference pressure if pRef is set to "none" + //- Reference pressure if pRefName is set to "pInf" scalar pRefValue_; //- Name of density field, default is "rho"