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

This commit is contained in:
Andrew Heather 2019-07-09 11:44:52 +01:00
parent 1159aaa810
commit 5bd7c4b5bb

View File

@ -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()*(pow(1 + (gamma - 1)/2*sqr(Mb), gamma/(gamma - 1)));
}
default:
{
return
tp
+ dimensionedScalar("pRef", dimPressure, pRef_);
}
return
tp
+ dimensionedScalar("pRef", dimPressure, pRef_)
+ rhoScale(p, 0.5*magSqr(lookupObject<volVectorField>(UName_)));
}
if (mode_ & 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()*(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);
}