mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: pressure FO - corrected handling of enumeration in calcPressure function. See #1356
This commit is contained in:
@ -146,44 +146,38 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::calcPressure
|
|||||||
const tmp<volScalarField>& tp
|
const tmp<volScalarField>& tp
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
switch (mode_)
|
if (mode_ & TOTAL)
|
||||||
{
|
{
|
||||||
case TOTAL:
|
return
|
||||||
{
|
tp
|
||||||
return
|
+ dimensionedScalar("pRef", dimPressure, pRef_)
|
||||||
tp
|
+ rhoScale(p, 0.5*magSqr(lookupObject<volVectorField>(UName_)));
|
||||||
+ 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_);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
return tpCoeff;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return std::move(tp);
|
||||||
return std::move(tp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user