Commit 8e78a278 authored by Andrew Heather's avatar Andrew Heather
Browse files

BUG: pressure FO - resolved hydrostatic contribution for incompressible cases. See #1544

parent 0bbf94fb
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -175,7 +175,8 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::rhoScale ...@@ -175,7 +175,8 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::rhoScale
void Foam::functionObjects::pressure::addHydrostaticContribution void Foam::functionObjects::pressure::addHydrostaticContribution
( (
volScalarField& p const volScalarField& p,
volScalarField& prgh
) const ) const
{ {
// Add/subtract hydrostatic contribution // Add/subtract hydrostatic contribution
...@@ -206,12 +207,12 @@ void Foam::functionObjects::pressure::addHydrostaticContribution ...@@ -206,12 +207,12 @@ void Foam::functionObjects::pressure::addHydrostaticContribution
{ {
case ADD: case ADD:
{ {
p += rgh; prgh += rgh;
break; break;
} }
case SUBTRACT: case SUBTRACT:
{ {
p -= rgh; prgh -= rgh;
break; break;
} }
default: default:
...@@ -243,7 +244,7 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::calcPressure ...@@ -243,7 +244,7 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::calcPressure
volScalarField& result = tresult.ref(); volScalarField& result = tresult.ref();
addHydrostaticContribution(result); addHydrostaticContribution(p, result);
if (mode_ & STATIC) if (mode_ & STATIC)
{ {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -101,6 +101,8 @@ Usage ...@@ -101,6 +101,8 @@ Usage
UInf | Freestream velocity for coefficient calculation | no | UInf | Freestream velocity for coefficient calculation | no |
rhoInf | Freestream density for coefficient calculation | no | rhoInf | Freestream density for coefficient calculation | no |
hydrostaticMode | Hydrostatic contributions (see below) | no | none hydrostaticMode | Hydrostatic contributions (see below) | no | none
g | Gravity vector (see below) | no |
hRef | Reference height (see below) | no |
\endtable \endtable
The \c mode entry is used to select the type of pressure that is calculated. The \c mode entry is used to select the type of pressure that is calculated.
...@@ -117,6 +119,15 @@ Usage ...@@ -117,6 +119,15 @@ Usage
- \c add : add the term, e.g. to convert from p_rgh to p - \c add : add the term, e.g. to convert from p_rgh to p
- \c subtract : subtract the term, e.g. to convert from p to p_rgh - \c subtract : subtract the term, e.g. to convert from p to p_rgh
If the \c hydrostaticMode is active, values are also required for
gravity, \c g, and reference height, \c hRef. By default these will be
retrieved from the database. When these values are not available
the user must provide them, e.g.
\verbatim
g (0 -9.81 0);
hRef 0;
\endverbatim
See also See also
Foam::functionObjects::fieldExpression Foam::functionObjects::fieldExpression
...@@ -247,7 +258,11 @@ private: ...@@ -247,7 +258,11 @@ private:
) const; ) const;
//- Add the hydrostatic contribution //- Add the hydrostatic contribution
void addHydrostaticContribution(volScalarField& p) const; void addHydrostaticContribution
(
const volScalarField& p,
volScalarField& prgh
) const;
//- Calculate and return the pressure //- Calculate and return the pressure
tmp<volScalarField> calcPressure tmp<volScalarField> calcPressure
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment