Commit b32c0bc9 authored by Andrew Heather's avatar Andrew Heather

BUG: pressure FO - corrected handling of enumeration in calcPressure function. See #1356

parent 788e257f
......@@ -146,44 +146,38 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::calcPressure
const tmp<volScalarField>& tp
) const
{
switch (mode_)
if (mode_ & TOTAL)
{
case TOTAL:
{
return
tp
+ dimensionedScalar("pRef", dimPressure, pRef_)
+ rhoScale(p, 0.5*magSqr(lookupObject<volVectorField>(UName_)));
}
case ISENTROPIC:
{
const basicThermo* thermoPtr =
p.mesh().lookupObjectPtr<basicThermo>(basicThermo::dictName);
if (!thermoPtr)
{
FatalErrorInFunction
<< "Isentropic pressure calculation requires a "
<< "thermodynamics package"
<< exit(FatalError);
}
const volScalarField gamma(thermoPtr->gamma());
const volScalarField Mb
(
mag(lookupObject<volVectorField>(UName_))
/sqrt(gamma*tp.ref()/thermoPtr->rho())
);
return
tp
+ dimensionedScalar("pRef", dimPressure, pRef_)
+ rhoScale(p, 0.5*magSqr(lookupObject<volVectorField>(UName_)));
}
return tp()*(pow(1 + (gamma - 1)/2*sqr(Mb), gamma/(gamma - 1)));
}
default:
if (mode_ & ISENTROPIC)
{
const basicThermo* thermoPtr =
p.mesh().lookupObjectPtr<basicThermo>(basicThermo::dictName);
if (!thermoPtr)
{
return
tp
+ dimensionedScalar("pRef", dimPressure, pRef_);
FatalErrorInFunction
<< "Isentropic pressure calculation requires a "
<< "thermodynamics package"
<< exit(FatalError);
}
const volScalarField gamma(thermoPtr->gamma());
const volScalarField Mb
(
mag(lookupObject<volVectorField>(UName_))
/sqrt(gamma*tp.ref()/thermoPtr->rho())
);
return tp()*(pow(1 + (gamma - 1)/2*sqr(Mb), gamma/(gamma - 1)));
}
return tp + dimensionedScalar("pRef", dimPressure, pRef_);
}
......@@ -207,10 +201,8 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::coeff
return tpCoeff;
}
else
{
return std::move(tp);
}
return std::move(tp);
}
......
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