braamvandyk / SteamTables.jl

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

SpecificH failure with negative argument to log #25

Open tkoenig1 opened 5 months ago

tkoenig1 commented 5 months ago
$ 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> SpecificH(30.0,623.1600000000001)
ERROR: DomainError with -18.07623503430128:
log was called with a negative real argument but will only return a complex result if called with a complex argument. Try log(Complex(x)).
Stacktrace:
  [1] throw_complex_domainerror(f::Symbol, x::Float64)
    @ Base.Math ./math.jl:33
  [2] _log(x::Float64, base::Val{:ℯ}, func::Symbol)
    @ Base.Math ./special/log.jl:301
  [3] log
    @ ./special/log.jl:267 [inlined]
  [4] Region3_ρ(Output::Symbol, ρ::Float64, T::Float64)
    @ SteamTables ~/.julia/packages/SteamTables/eKo68/src/SteamTables.jl:1717
  [5] f
    @ ~/.julia/packages/SteamTables/eKo68/src/SteamTables.jl:1758 [inlined]
  [6] Callable_Function
    @ ~/.julia/packages/Roots/neTBD/src/functions.jl:29 [inlined]
  [7] update_state
    @ ~/.julia/packages/Roots/neTBD/src/DerivativeFree/secant.jl:39 [inlined]
  [8] update_state
    @ ~/.julia/packages/Roots/neTBD/src/DerivativeFree/secant.jl:29 [inlined]
  [9] solve!(𝐙::Roots.ZeroProblemIterator{Roots.Secant, Roots.AlefeldPotraShi, Roots.Callable_Function{…}, Roots.UnivariateZeroState{…}, Roots.UnivariateZeroOptions{…}, Roots.NullTracks}; verbose::Bool)
    @ Roots ~/.julia/packages/Roots/neTBD/src/hybrid.jl:54
 [10] solve!
    @ ~/.julia/packages/Roots/neTBD/src/hybrid.jl:30 [inlined]
 [11] #solve#46
    @ ~/.julia/packages/Roots/neTBD/src/find_zero.jl:492 [inlined]
 [12] solve
    @ ~/.julia/packages/Roots/neTBD/src/find_zero.jl:484 [inlined]
 [13] #find_zero#39
    @ ~/.julia/packages/Roots/neTBD/src/find_zero.jl:220 [inlined]
 [14] find_zero (repeats 2 times)
    @ ~/.julia/packages/Roots/neTBD/src/find_zero.jl:210 [inlined]
 [15] find_zero
    @ ~/.julia/packages/Roots/neTBD/src/find_zero.jl:243 [inlined]
 [16] Region3(Output::Symbol, P::Float64, T::Float64)
    @ SteamTables ~/.julia/packages/SteamTables/eKo68/src/SteamTables.jl:1759
 [17] SpecificH(P::Float64, T::Float64)
    @ SteamTables ~/.julia/packages/SteamTables/eKo68/src/SteamTables.jl:3020
 [18] top-level scope
    @ REPL[2]:1
Some type information was truncated. Use `show(err)` to see complete types.

(@v1.10) pkg> st SteamTables
Status `~/.julia/environments/v1.10/Project.toml`
  [43dc94dd] SteamTables v1.4.1