braamvandyk / SteamTables.jl

Julia implementation of steam tables according to IAPWS Industrial Formulation (1997)
Other
12 stars 4 forks source link

P-h, P-s solvers for regions 3 and 5 #24

Closed longemen3000 closed 4 months ago

longemen3000 commented 5 months ago

This PR adds the corresponding implicit solvers for regions 3 and 5.

On Region 5, for P-h and P-s the iteration scheme is easy, just find the brackets on (P,1073.15) and (P,2273.15) and iterate from there. Region 3 has a split depending if the point is under or over the critical point. a secant step is then used until convergence.

To allow better solutions of density in Region 3, i ported the Clapeyron.jl Solver into SteamTables. That solver is the one that AGA8 uses to solve densities for the AGA8 detailed (GERG-2008) helmholtz-based equation of state. the initial points are chosen depending on where on the saturation line is Tsat(P) and if the initial point is stable (dpdrho > 0). This coincidentally allow the removal of Roots.jl as a dependency. The P-h and P-s iterations in this case are nested iterations. we solve the density (implicitly, using Region3(prop,P,T) and calculate the secand step from there.

there were a lot of repeated conditionals, that were grouped in three new functions:

on those functions: Temperature_Ph and Temperature_Ps are now exported.

The only use for ForwardDiff was to calculate derivative(Psat2,T). a hardcoded implementation is added instead to eliminate the ForwardDiff dependency.

closes #23 closes #11

tkoenig1 commented 5 months ago

Does not appear to fix #23, see https://github.com/braamvandyk/SteamTables.jl/issues/23#issuecomment-2067985372

longemen3000 commented 5 months ago

weird, because those values are in the test files: https://github.com/longemen3000/SteamTables.jl/blob/c5a7c4df13cc5e751d133502a21350d43408a67c/test/testreg3Px.jl#L1-L6 did you load the PR branch?, the package is not updated inmediately

longemen3000 commented 5 months ago

also, this branch also seems to fix #25:

julia> SpecificH(30.0,623.1600000000001)
1608.8575170405275
tkoenig1 commented 5 months ago

weird, because those values are in the test files: https://github.com/longemen3000/SteamTables.jl/blob/c5a7c4df13cc5e751d133502a21350d43408a67c/test/testreg3Px.jl#L1-L6 did you load the PR branch?, the package is not updated inmediately

I am rather new to Julia, so I may have gotten things wrong...

Is

(@v1.10) pkg> remove SteamTables

Pkg.add(url="https://github.com/longemen3000/SteamTables.jl.git")

the right way to go about this, or should I use some other URL?

This gives me

    Updating `~/.julia/environments/v1.10/Project.toml`
⌃ [91a5bcdd] ↓ Plots v1.40.4 ⇒ v1.38.12
  [43dc94dd] + SteamTables v1.2.1 `https://github.com/longemen3000/SteamTables.jl.git#master`
⌅ [1986cc42] ↓ Unitful v1.19.0 ⇒ v0.15.0
    Updating `~/.julia/environments/v1.10/Manifest.toml`
⌅ [28b8d3ca] ↓ GR v0.73.3 ⇒ v0.72.10
⌃ [91a5bcdd] ↓ Plots v1.40.4 ⇒ v1.38.12
⌅ [f2b01f46] + Roots v1.2.0
⌅ [2913bbd2] ↓ StatsBase v0.34.3 ⇒ v0.33.21
  [43dc94dd] + SteamTables v1.2.1 `https://github.com/longemen3000/SteamTables.jl.git#master`
⌅ [1986cc42] ↓ Unitful v1.19.0 ⇒ v0.15.0
  [45397f5d] - UnitfulLatexify v1.6.3
⌅ [d2c73de3] ↓ GR_jll v0.73.3+0 ⇒ v0.72.10+0

where SteamTables is at version v1.2.1, which seems wrong.

longemen3000 commented 5 months ago

Almost correct 😅, can you try Pkg.add("https://github.com/longemen3000/SteamTables.jl/tree/ph_ps-solvers" )?

tkoenig1 commented 5 months ago

Hm, that didn't work either... I added url=, but still got a 404:


$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.2 (2024-03-01)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Pkg

julia> Pkg.add(url="https://github.com/longemen3000/SteamTables.jl/tree/ph_ps-solvers" )
     Cloning git-repo `https://github.com/longemen3000/SteamTables.jl/tree/ph_ps-solvers`
ERROR: failed to clone from https://github.com/longemen3000/SteamTables.jl/tree/ph_ps-solvers, error: GitError(Code:ERROR, Class:HTTP, unexpected http status code: 404)
Stacktrace:
  [1] pkgerror(msg::String)
    @ Pkg.Types ~/.julia/juliaup/julia-1.10.2+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/Types.jl:70
  [2] clone(io::Base.TTY, url::String, source_path::String; header::Nothing, credentials::Nothing, kwargs::@Kwargs{isbare::Bool})
``
longemen3000 commented 5 months ago

Sorry, my bad, try Pkg.add("https://github.com/longemen3000/SteamTables.jl", rev = "ph_ps-solvers" )

tkoenig1 commented 5 months ago

Works like a charm now.

Thanks a lot! That was really helpful, and very fast, too.

tkoenig1 commented 5 months ago

Hm, another point, this time with the correct version of the package (with the ph_ps-solvers one, as shown by st SteamTables):


$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.2 (2024-03-01)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using SteamTables

(@v1.10) pkg> st SteamTables
Status `~/.julia/environments/v1.10/Project.toml`
  [43dc94dd] SteamTables v1.4.2 `https://github.com/longemen3000/SteamTables.jl#ph_ps-solvers`

julia> SpecificH(647.9368750000001, 24.18433391209346)
ERROR: DomainError with (647.9368750000001, 24.18433391209346):
Pressure/Temperature outside valid ranges.
Stacktrace:
 [1] RegionID(P::Float64, T::Float64)
   @ SteamTables ~/.julia/packages/SteamTables/rPx5Z/src/SteamTables.jl:2273
 [2] SpecificH(P::Float64, T::Float64)
   @ SteamTables ~/.julia/packages/SteamTables/rPx5Z/src/SteamTables.jl:3186
 [3] top-level scope
   @ REPL[3]:1
``
longemen3000 commented 5 months ago

Are you sure are those the correct values? , it seems like you put 647 MPa, 20 K (T, P instead of P T)

tkoenig1 commented 5 months ago

Sorry, copy & paste confusion on my part.

Here is the real error, which complains about the temperature not being between triple and critical points:

$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.2 (2024-03-01)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using SteamTables

(@v1.10) pkg> st SteamTables
Status `~/.julia/environments/v1.10/Project.toml`
  [43dc94dd] SteamTables v1.4.2 `https://github.com/longemen3000/SteamTables.jl#ph_ps-solvers`

julia> SpecificH(24.18433391209346,647.9368750000001)
ERROR: DomainError with 647.9368750000001:
Temperature not between triple and critical points.
Stacktrace:
 [1] Psat
   @ ~/.julia/packages/SteamTables/rPx5Z/src/SteamTables.jl:2541 [inlined]
 [2] Region3_ρ0(P::Float64, T::Float64)
   @ SteamTables ~/.julia/packages/SteamTables/rPx5Z/src/SteamTables.jl:2003
 [3] Region3_ρPT
   @ ~/.julia/packages/SteamTables/rPx5Z/src/SteamTables.jl:2021 [inlined]
 [4] Region3
   @ ~/.julia/packages/SteamTables/rPx5Z/src/SteamTables.jl:1993 [inlined]
 [5] property_PT(property::Symbol, Region::Symbol, P::Float64, T::Float64)
   @ SteamTables ~/.julia/packages/SteamTables/rPx5Z/src/SteamTables.jl:2597
 [6] SpecificH(P::Float64, T::Float64)
   @ SteamTables ~/.julia/packages/SteamTables/rPx5Z/src/SteamTables.jl:3187
 [7] top-level scope
   @ REPL[3]:1
longemen3000 commented 5 months ago

That is a genuine error, let me check

longemen3000 commented 5 months ago

fixed. it was a typo (i was using 647.96 instead of 647.096 for Tc) try adding the package again

tkoenig1 commented 5 months ago

Works now, thanks again!

tkoenig1 commented 5 months ago

And here's another one...

(Currently trying to create a p-S diagram, in case you were wondering where all these cases come from :-)

$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.2 (2024-03-01)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using SteamTables

(@v1.10) pkg> st SteamTables
Status `~/.julia/environments/v1.10/Project.toml`
  [43dc94dd] SteamTables v1.4.2 `https://github.com/longemen3000/SteamTables.jl#ph_ps-solvers`

julia> SpecificS_Ph(28.,1750.)
ERROR: Region3_TPh: temperature iterations failed to converge.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] Region3_TPh(P::Float64, h::Float64)
   @ SteamTables ~/.julia/packages/SteamTables/wtU3l/src/SteamTables.jl:1194
 [3] _Temperature_Ph(Region::Symbol, P::Float64, h::Float64)
   @ SteamTables ~/.julia/packages/SteamTables/wtU3l/src/SteamTables.jl:2653
 [4] SpecificS_Ph(P::Float64, h::Float64)
   @ SteamTables ~/.julia/packages/SteamTables/wtU3l/src/SteamTables.jl:3148
 [5] top-level scope
   @ REPL[3]:1
tkoenig1 commented 5 months ago

Another one that looks strange... I do not think the drop in entropy between 18.1 and 18.2 MPa is correct, probably something is not converging correctly there.

julia> using SteamTables

julia> SpecificS_Ph(18.0,2750.)
5.481981617666436

julia> SpecificS_Ph(18.1,2750.)
5.48041855689204

julia> SpecificS_Ph(18.2,2750.)
0.21531710829658093

julia> SpecificS_Ph(18.3,2750.)
0.9840136952964426

julia> SpecificS_Ph(18.4,2750.)
1.6336276464083936

julia> SpecificS_Ph(18.5,2750.)
2.2049099149539177

julia> SpecificS_Ph(18.6,2750.)
2.7295356466001026

julia> SpecificS_Ph(18.7,2750.)
3.2453323130205005

julia> SpecificS_Ph(18.8,2750.)
5.469756663508701

julia> SpecificS_Ph(18.9,2750.)
5.468271961387976

julia> SpecificS_Ph(19.0,2750.)
5.466796504969952
longemen3000 commented 5 months ago

i fixed the first error (i improved the solver adding a bisection step when the secant is out of bounds). the second error is more of a region identification error:

julia> p = 18:0.1:19
18.0:0.1:19.0

julia> SteamTables.RegionID_Ph.(p,2750.)
11-element Vector{Symbol}:
 :Region2c
 :Region2c
 :Region1
 :Region1
 :Region1
 :Region1
 :Region1
 :Region1
 :Region2c
 :Region2c
 :Region2c
tkoenig1 commented 5 months ago

Thanks for the fast turnaround.

Unfortunately, I have trouble compiling the latest version. After removing the old version and restarting Julia, I get


$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.2 (2024-03-01)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Pkg

julia> Pkg.add(url="https://github.com/longemen3000/SteamTables.jl", rev = "ph_ps-solvers" )
    Updating git-repo `https://github.com/longemen3000/SteamTables.jl`
   Resolving package versions...
    Updating `~/.julia/environments/v1.10/Project.toml`
  [43dc94dd] + SteamTables v1.4.2 `https://github.com/longemen3000/SteamTables.jl#ph_ps-solvers`
    Updating `~/.julia/environments/v1.10/Manifest.toml`
  [43dc94dd] + SteamTables v1.4.2 `https://github.com/longemen3000/SteamTables.jl#ph_ps-solvers`

julia> using SteamTables
Precompiling SteamTables
        Info Given SteamTables was explicitly requested, output will be shown live 
ERROR: LoadError: DomainError with (3.0, 4.1313215739117547e21):
Pressure/Temperature outside valid ranges.
Stacktrace:
  [1] RegionID_Ph(P::Float64, h::Float64)
    @ SteamTables ~/.julia/packages/SteamTables/mmH31/src/SteamTables.jl:2344
  [2] SpecificG_Ph
    @ ~/.julia/packages/SteamTables/mmH31/src/SteamTables.jl:2708 [inlined]
  [3] runprecompworkload()
    @ SteamTables ~/.julia/packages/SteamTables/mmH31/src/compilefile.jl:30
  [4] macro expansion
    @ ~/.julia/packages/SteamTables/mmH31/src/SteamTables.jl:3905 [inlined]
  [5] macro expansion
    @ ~/.julia/packages/PrecompileTools/L8A3n/src/workloads.jl:78 [inlined]
  [6] macro expansion
    @ ~/.julia/packages/SteamTables/mmH31/src/SteamTables.jl:3903 [inlined]
  [7] macro expansion
    @ ~/.julia/packages/PrecompileTools/L8A3n/src/workloads.jl:140 [inlined]
  [8] top-level scope
    @ ~/.julia/packages/SteamTables/mmH31/src/SteamTables.jl:3900
  [9] include
    @ ./Base.jl:495 [inlined]
 [10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2222
 [11] top-level scope
    @ stdin:3
in expression starting at /home/ig25/.julia/packages/SteamTables/mmH31/src/SteamTables.jl:1
in expression starting at stdin:3
  ✗ SteamTables
  0 dependencies successfully precompiled in 3 seconds. 9 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

SteamTables [43dc94dd-f011-5c5d-8ab2-5073432dc0ba]

Failed to precompile SteamTables [43dc94dd-f011-5c5d-8ab2-5073432dc0ba] to "/home/ig25/.julia/compiled/v1.10/SteamTables/jl_nD55OX".
ERROR: LoadError: DomainError with (3.0, 4.1313215739117547e21):
Pressure/Temperature outside valid ranges.
Stacktrace:
  [1] RegionID_Ph(P::Float64, h::Float64)
    @ SteamTables ~/.julia/packages/SteamTables/mmH31/src/SteamTables.jl:2344
  [2] SpecificG_Ph
    @ ~/.julia/packages/SteamTables/mmH31/src/SteamTables.jl:2708 [inlined]
  [3] runprecompworkload()
    @ SteamTables ~/.julia/packages/SteamTables/mmH31/src/compilefile.jl:30
  [4] macro expansion
    @ ~/.julia/packages/SteamTables/mmH31/src/SteamTables.jl:3905 [inlined]
  [5] macro expansion
    @ ~/.julia/packages/PrecompileTools/L8A3n/src/workloads.jl:78 [inlined]
  [6] macro expansion
    @ ~/.julia/packages/SteamTables/mmH31/src/SteamTables.jl:3903 [inlined]
  [7] macro expansion
    @ ~/.julia/packages/PrecompileTools/L8A3n/src/workloads.jl:140 [inlined]
  [8] top-level scope
    @ ~/.julia/packages/SteamTables/mmH31/src/SteamTables.jl:3900
  [9] include
    @ ./Base.jl:495 [inlined]
 [10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2222
 [11] top-level scope
    @ stdin:3
in expression starting at /home/ig25/.julia/packages/SteamTables/mmH31/src/SteamTables.jl:1
in expression starting at stdin:
Stacktrace:
  [1] pkgerror(msg::String)
    @ Pkg.Types ~/.julia/juliaup/julia-1.10.2+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/Types.jl:70
  [2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{…}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, timing::Bool, _from_loading::Bool, kwargs::@Kwargs{…})
    @ Pkg.API ~/.julia/juliaup/julia-1.10.2+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/API.jl:1659
  [3] precompile(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::@Kwargs{_from_loading::Bool})
    @ Pkg.API ~/.julia/juliaup/julia-1.10.2+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/API.jl:159
  [4] precompile
    @ ~/.julia/juliaup/julia-1.10.2+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/API.jl:147 [inlined]
  [5] #precompile#114
    @ ~/.julia/juliaup/julia-1.10.2+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/API.jl:146 [inlined]
  [6] #invokelatest#2
    @ ./essentials.jl:894 [inlined]
  [7] invokelatest
    @ ./essentials.jl:889 [inlined]
  [8] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1963
  [9] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1812
 [10] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [11] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [12] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1803
 [13] macro expansion
    @ ./loading.jl:1790 [inlined]
 [14] macro expansion
    @ ./lock.jl:267 [inlined]
 [15] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1753
 [16] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [17] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [18] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1746
Some type information was truncated. Use `show(err)` to see complete types.

``
longemen3000 commented 5 months ago

found the error, a typo introduced while fixing the erroneous values between 18 and 19 MPa

tkoenig1 commented 5 months ago

There are still a few bad points left (but I think it is converging :-)

julia> P=range(24.,26.,step=0.1)
24.0:0.1:26.0

julia> SpecificS_Ph.(P,2000.)
21-element Vector{Float64}:
   5.217730267274345
   5.2164973302338895
   5.215261661088216
   5.214023628726989
   5.212783589080686
   5.211541885643318
   5.2102988499668585
   5.209054802129343
   2.518804555314167
   3.9362319927353178
 NaN
   3.928082971523051
   2.5164904856184442
   2.5159416048953935
   2.515824818606351
   3.912773221067974
   3.9091264706402677
   3.9055447211888
   2.5133606184268085
   3.898563853444663
   2.5124000414452765

julia> SpecificS_Ph.(P,1750.)
ERROR: Region3_TPh: temperature iterations failed to converge.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] Region3_TPh(P::Float64, h::Float64)
    @ SteamTables ~/.julia/packages/SteamTables/MKv3h/src/SteamTables.jl:1195
  [3] _Temperature_Ph(Region::Symbol, P::Float64, h::Float64)
    @ SteamTables ~/.julia/packages/SteamTables/MKv3h/src/SteamTables.jl:2657
  [4] SpecificS_Ph
    @ ~/.julia/packages/SteamTables/MKv3h/src/SteamTables.jl:3152 [inlined]
  [5] _broadcast_getindex_evalf
    @ ./broadcast.jl:709 [inlined]
  [6] _broadcast_getindex
    @ ./broadcast.jl:682 [inlined]
  [7] getindex
    @ ./broadcast.jl:636 [inlined]
  [8] macro expansion
    @ ./broadcast.jl:1004 [inlined]
  [9] macro expansion
    @ ./simdloop.jl:77 [inlined]
 [10] copyto!
    @ ./broadcast.jl:1003 [inlined]
 [11] copyto!
    @ ./broadcast.jl:956 [inlined]
 [12] copy
    @ ./broadcast.jl:928 [inlined]
 [13] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(SpecificS_Ph), Tuple{StepRangeLen{Float64, Base.TwicePrecision{…}, Base.TwicePrecision{…}, Int64}, Float64}})
    @ Base.Broadcast ./broadcast.jl:903
 [14] top-level scope
    @ REPL[16]:1
 [15] top-level scope
    @ none:1
Some type information was truncated. Use `show(err)` to see complete types.
longemen3000 commented 4 months ago

@tkoenig1 i just did some updates, region 5 was not converging because of a typo. Also, i updated the solvers to use ITP instead of secant. now all tests are passing, and your examples run

tkoenig1 commented 4 months ago

Thanks! Those are fixed now.

Getting closer to draw the diagram, I increased the number of points and hit another region with a negative square root:

$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.2 (2024-03-01)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using SteamTables

julia> SpecificS_Ph(4.5,2900)
ERROR: DomainError with -201.09208450864833:
sqrt was called with a negative real argument but will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stacktrace:
 [1] throw_complex_domainerror(f::Symbol, x::Float64)
   @ Base.Math ./math.jl:33
 [2] sqrt
   @ ./math.jl:686 [inlined]
 [3] B2bc
   @ ~/.julia/packages/SteamTables/hNd1l/src/SteamTables.jl:186 [inlined]
 [4] RegionID_Ph(P::Float64, h::Int64)
   @ SteamTables ~/.julia/packages/SteamTables/hNd1l/src/SteamTables.jl:2310
 [5] SpecificS_Ph(P::Float64, h::Int64)
   @ SteamTables ~/.julia/packages/SteamTables/hNd1l/src/SteamTables.jl:3119
 [6] top-level scope
   @ REPL[2]:1

The range seems to extend from a pressure of 4.0 MPa (exclusive) to ~ 4.523 MPa, with enthalpy > 2805 kJ/kg.

longemen3000 commented 4 months ago

found the error, basically, between 4 and 4.5257578905948 MPa, a boundary line between regions 2b and 2c (B2bc) is not defined.

tkoenig1 commented 4 months ago

Another issue, which may not be specific to your pull request:

julia> p=range(43,47,step=0.2)
43.0:0.2:47.0

julia> SpecificS.(p,625.)
21-element Vector{Float64}:
   3.5895054305809357
   3.5885691485074847
   3.587637073227272
   3.5867091589138083
   3.5857853605445835
   3.5848656338758413
   3.583949935427027
   3.583038222462932
   2.519046247951557
 NaN
 NaN
 NaN
 NaN
   2.520978997154807
   2.5213657730882586
   2.5217526246909796
   2.5221395520967236
   2.5225265554362766
   2.522913634845939
   2.5233007904580256
   2.5236880224049116

julia> SpecificH.(p,625.)
21-element Vector{Float64}:
 1594.7872341532716
 1594.4983128718143
 1594.2118208504842
 1593.927730663509
 1593.6460153723672
 1593.366648510853
 1593.0896040755606
 1592.814856515017
  967.4071265732822
  NaN
  NaN
  NaN
  NaN
  969.6593567036114
  970.1099601986025
  970.5606163823397
  971.0113253437337
  971.4620871679522
  971.9129019457523
  972.3637697651229
  972.8146907101136

Possibly another region misidentified.

(Edited because of cut&paste error)

longemen3000 commented 4 months ago

Hmmm, at first glance, that is region 3, liquid phase, I need to check the volume solver