mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: liquidPropertues - updated pvInvert function - contribution by dkxls - mantis #938
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -344,44 +344,43 @@ Foam::scalar Foam::liquidProperties::D(scalar p, scalar T, scalar Wb) const
|
|||||||
|
|
||||||
Foam::scalar Foam::liquidProperties::pvInvert(scalar p) const
|
Foam::scalar Foam::liquidProperties::pvInvert(scalar p) const
|
||||||
{
|
{
|
||||||
scalar T = Tc_;
|
// Check for critical and solid phase conditions
|
||||||
scalar deltaT = 10.0;
|
if (p >= Pc_)
|
||||||
scalar dp0 = pv(p, T) - p;
|
|
||||||
|
|
||||||
|
|
||||||
label n = 0;
|
|
||||||
|
|
||||||
while ((n < 200) && (mag(deltaT) > 1.0e-3))
|
|
||||||
{
|
{
|
||||||
n++;
|
return Tc_;
|
||||||
scalar pBoil = pv(p, T);
|
}
|
||||||
scalar dp = pBoil - p;
|
else if (p < Pt_)
|
||||||
|
{
|
||||||
if ((dp > 0.0) && (dp0 > 0.0))
|
if (debug)
|
||||||
{
|
{
|
||||||
T -= deltaT;
|
WarningIn
|
||||||
|
(
|
||||||
|
"Foam::scalar Foam::liquidProperties::pvInvert(scalar) const"
|
||||||
|
) << "Pressure below triple point pressure: "
|
||||||
|
<< "p = " << p << " < Pt = " << Pt_ << nl << endl;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set initial upper and lower bounds
|
||||||
|
scalar Thi = Tc_;
|
||||||
|
scalar Tlo = Tt_;
|
||||||
|
|
||||||
|
// Initialise T as boiling temperature under normal conditions
|
||||||
|
scalar T = Tb_;
|
||||||
|
|
||||||
|
while ((Thi - Tlo) > 1.0e-4)
|
||||||
|
{
|
||||||
|
if ((pv(p, T) - p) <= 0.0)
|
||||||
|
{
|
||||||
|
Tlo = T;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((dp < 0.0) && (dp0 < 0.0))
|
Thi = T;
|
||||||
{
|
|
||||||
T += deltaT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
deltaT *= 0.5;
|
|
||||||
if ((dp > 0.0) && (dp0 < 0.0))
|
|
||||||
{
|
|
||||||
T -= deltaT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
T += deltaT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dp0 = dp;
|
T = (Thi + Tlo)*0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
return T;
|
return T;
|
||||||
|
|||||||
Reference in New Issue
Block a user