Commit e05b85fa authored by sergio's avatar sergio Committed by Andrew Heather
Browse files

ENH: adding total isentropic pressure option

parent 312c97b4
......@@ -27,6 +27,7 @@ License
#include "pressure.H"
#include "volFields.H"
#include "fluidThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -51,6 +52,10 @@ Foam::word Foam::functionObjects::pressure::resultName() const
{
rName = "total(" + fieldName_ + ")";
}
else if (calcIsen_)
{
rName = "totalIsen(" + fieldName_ + ")";
}
else
{
rName = "static(" + fieldName_ + ")";
......@@ -145,6 +150,21 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::pDyn
tp
+ rhoScale(p, 0.5*magSqr(lookupObject<volVectorField>(UName_)));
}
else if (calcIsen_)
{
const fluidThermo* thermoPtr =
p.mesh().lookupObjectPtr<fluidThermo>(basicThermo::dictName);
const volScalarField gamma(thermoPtr->gamma());
const volScalarField Mb
(
mag(lookupObject<volVectorField>(UName_))
/sqrt(gamma*tp.ref()/thermoPtr->rho())
);
return tp.ref()*(pow(1 + (gamma-1)/2*sqr(Mb), gamma/(gamma-1)));
}
else
{
return std::move(tp);
......@@ -220,6 +240,7 @@ Foam::functionObjects::pressure::pressure
UName_("U"),
rhoName_("rho"),
calcTotal_(false),
calcIsen_(false),
pRef_(0),
calcCoeff_(false),
pInf_(0),
......@@ -252,6 +273,8 @@ bool Foam::functionObjects::pressure::read(const dictionary& dict)
rhoInfInitialised_ = true;
}
calcIsen_ = dict.lookupOrDefault<bool>("calcIsen", false);
dict.readEntry("calcTotal", calcTotal_);
if (calcTotal_)
{
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2016 OpenFOAM Foundation
......@@ -41,6 +41,10 @@ Description
\f[
p_0 = p_{ref} + p + 0.5 \rho |U|^2
\f]
- isentropic pressure
\f[
p_iso = p*(1 + ((gamma-1)*M^2)/2)^(gamma/(gamma - 1))
\f]
- static pressure coefficient
\f[
Cp = \frac{p - p_{\inf}}{0.5 \rho_{\inf} |U_{\inf}|^2}
......@@ -61,6 +65,7 @@ Description
p | Pressure [Pa]
p_0 | Total pressure [Pa]
p_{ref} | Reference pressure level [Pa]
p_iso | Total isentropic pressure
Cp | Pressure coefficient
Cp_0 | Total pressure coefficient
\endvartable
......@@ -71,11 +76,12 @@ Description
The modes of operation are:
\table
Mode | calcTotal | calcCoeff
Static pressure | no | no
Total pressure | yes | no
Pressure coefficient | no | yes
Total pressure coefficient | yes | yes
Mode | calcTotal | calcCoeff | calcIsen
Static pressure | no | no | no
Total pressure | yes | no | no
Pressure coefficient | no | yes | no
Total pressure coefficient | yes | yes | no
Total isentropic pressure | no | no | yes
\endtable
Usage
......@@ -100,6 +106,7 @@ Usage
rho | Name of the density field | no | rho
result | Name of the resulting field | no | derived from p
calcTotal | Calculate total coefficient | yes |
calcIsen | Calculate total isentropic | no | no
pRef | Reference pressure for total pressure | no | 0
calcCoeff | Calculate pressure coefficient | yes |
pInf | Freestream pressure for coefficient calculation | no |
......@@ -152,6 +159,9 @@ class pressure
//- Flag to calculate total pressure
bool calcTotal_;
//- Flag to calculate identropic total pressure
bool calcIsen_;
//- Reference pressure level
scalar pRef_;
......
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