Skip to content

Commit

Permalink
Region5_TPs/Region5_TPh: fix inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
longemen3000 committed Apr 22, 2024
1 parent d37e02c commit 0a45cf5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/SteamTables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ function itp_find_zero(f::F,xa,xb;tol = 0.5e-12,max_iters = 100) where F
κ₁,κ₂ = 0.2,2.0
n0 = 1
ya,yb = f(xa),f(xb)
nmid = log2((xb-xa)/(2*tol))
@assert ya < yb
nmid = ceil(log2(abs(xb-xa)/(2*tol)))
nmax = nmid + n0
for i in 0:max_iters
xa,xb,ya,yb = itp_step(f::F,xa,xb,ya,yb,tol,κ₁,κ₂,i,nmid,nmax)
Expand Down Expand Up @@ -2175,15 +2176,15 @@ function Region5(Output::Symbol, P, T)
end

function Region5_TPh(P, h)
Thigh,Tlow = 1073.15,2273.15
Tlow,Thigh = 1073.15,2273.15
f(T) = Region5(:SpecificH, P, T) - h
T = itp_find_zero(f, Tlow, Thigh)
isnan(T) && throw(error("Region5_TPh: temperature iterations failed to converge."))
return T
end

function Region5_TPs(P, s)
Thigh,Tlow = 1073.15,2273.15
Tlow,Thigh = 1073.15,2273.15
f(T) = Region5(:SpecificS, P, T) - s
T = itp_find_zero(f, Tlow, Thigh)
isnan(T) && throw(error("Region5_TPs: temperature iterations failed to converge."))
Expand Down

0 comments on commit 0a45cf5

Please sign in to comment.