ENH: hydrostaticPressure FO - updated handling of pRef

This commit is contained in:
Andrew Heather 2019-06-14 09:53:49 +01:00
parent 7322f73a31
commit c83f3eda02
2 changed files with 11 additions and 4 deletions

View File

@ -57,6 +57,10 @@ Foam::dimensionedScalar
Foam::functionObjects::hydrostaticPressure::pRef() const Foam::functionObjects::hydrostaticPressure::pRef() const
{ {
if (pRefName_ == "none") if (pRefName_ == "none")
{
return dimensionedScalar(dimPressure, Zero);
}
else if (pRefName_ == "pInf")
{ {
return dimensionedScalar("pRef", dimPressure, pRefValue_); return dimensionedScalar("pRef", dimPressure, pRefValue_);
} }
@ -217,10 +221,12 @@ bool Foam::functionObjects::hydrostaticPressure::read(const dictionary& dict)
dict.readIfPresent("ghf", ghfName_); dict.readIfPresent("ghf", ghfName_);
dict.readIfPresent("nCorrectors", nCorrectors_); dict.readIfPresent("nCorrectors", nCorrectors_);
if (pRefName_ == "none") pRefValue_ = 0;
if (pRefName_ == "pInf")
{ {
pRefValue_ = dict.get<scalar>("pRefValue"); pRefValue_ = dict.get<scalar>("pRefValue");
} }
return true; return true;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd. \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -48,6 +48,7 @@ Usage
p_rgh | Name of p_rgh field | no | p_rgh p_rgh | Name of p_rgh field | no | p_rgh
ph_rgh | Name of ph_rgh field | no | ph_rgh ph_rgh | Name of ph_rgh field | no | ph_rgh
pRef | Name of pressure ref field | no | pRef 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 rho | Name of density field | no | rho
U | Name of velocity field | no | U U | Name of velocity field | no | U
gh | Name of gravity*height volume field | no | gh gh | Name of gravity*height volume field | no | gh
@ -97,10 +98,10 @@ protected:
word ph_rghName_; word ph_rghName_;
//- Name of uniform pressure reference field, default is "pRef" //- 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_; word pRefName_;
//- Reference pressure if pRef is set to "none" //- Reference pressure if pRefName is set to "pInf"
scalar pRefValue_; scalar pRefValue_;
//- Name of density field, default is "rho" //- Name of density field, default is "rho"