- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 40
 
Description
After updating to latest Julia 1.11.4 and  BoundaryValueDiffEq v5.16.0, for the first time I see a glimmer of hope for BoundaryValueDiffEqFIRK, [despite remaining unavailability of solution interpolation of first derivative (in bc! function) , and rejection of RadauIIa5(autodiff=false or ... =AutoFiniteDiff().] (hint, hint!)
It turns out that the "jac_alg" fix that EricQQY [provided] (#304 (comment)), for the lastest Rodas4P solver also enables solver RadauIIa5 to run now:
prob = BVProblem{true}(BVPFunction(shtructure!, bcond2!; bcresid_prototype = zeros(5) ), initguess, rspan, (eos, rspan, Pr0, pf) ) 
sol = solve(prob, RadauIIa5(jac_alg = BVPJacobianAlgorithm(AutoFiniteDiff())); dt = 0.5, dtmax=0.5, callback=cb, abstol=1e-4, reltol=1e-4, verbose=false) 
But it still isn't useful yet, because of continuous warning messages from IntervalNonlinearSolve, which is called by my derivative function. These warnings arise from the limited range in function space in which it is known or defined. The problem seems to be that the function finite_difference_jacobian! is exploring values outside the available range:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] #15
    @ ./REPL[67]:3 [inlined]
  [3] handle_message(::TransformerLogger{TransformerLogger{TransformerLogger{…}, var"#13#14"}, var"#15#16"}, ::LogLevel, ::Vararg{Any}; kwargs::@Kwargs{})
    @ LoggingExtras ~/.julia/packages/LoggingExtras/cFgEq/src/CompositionalLoggers/transformer.jl:22
  [4] handle_message(::TransformerLogger{TransformerLogger{…}, var"#15#16"}, ::LogLevel, ::String, ::Module, ::Symbol, ::Symbol, ::String, ::Int64)
    @ LoggingExtras ~/.julia/packages/LoggingExtras/cFgEq/src/CompositionalLoggers/transformer.jl:20
  [5] #invokelatest#2
    @ ./essentials.jl:1055 [inlined]
  [6] invokelatest
    @ ./essentials.jl:1052 [inlined]
  [7] macro expansion
    @ ./logging/logging.jl:353 [inlined]
  [8] solve(::IntervalNonlinearProblem{…}, ::ITP{…}; maxiters::Int64, abstol::Nothing, verbose::Bool, kwargs::@Kwargs{})
    @ BracketingNonlinearSolve ~/.julia/packages/BracketingNonlinearSolve/1Lfiz/src/itp.jl:86
  [9] solve
    @ ~/.julia/packages/BracketingNonlinearSolve/1Lfiz/src/itp.jl:59 [inlined]
 [10] nb
    @ ~/Applications/Julia/RealisticSeismology-main/src/sim.jl:153 [inlined]
 [11] ε(sim::Sim{…}, p::Float64)
    @ Main ~/Applications/Julia/RealisticSeismology-main/scripts/preprofile.jl:22
 [12] shtructure!(dy_dr::Vector{Float64}, y::Vector{Float64}, param::Tuple{Sim{…}, Tuple{…}, Float64, Float64}, r::Float64)
    @ Main ~/Applications/Julia/RealisticSeismology-main/src/RealMod/src/shtarMfreeFIRK.jl:59
 [13] BVPFunction
    @ ~/.julia/packages/SciMLBase/LGLmH/src/scimlfunctions.jl:2524 [inlined]
 [14] Φ!(residual::Vector{…}, fᵢ_cache::BoundaryValueDiffEqCore.FakeDiffCache{…}, k_discrete::Vector{…}, f!::BVPFunction{…}, TU::BoundaryValueDiffEqFIRK.FIRKTableau{…}, y::Vector{…}, u::Vector{…}, p::Tuple{…}, mesh::Vector{…}, mesh_dt::Vector{…}, stage::Int64)
    @ BoundaryValueDiffEqFIRK ~/.julia/packages/BoundaryValueDiffEqFIRK/xca6M/src/collocation.jl:33
 [15] Φ!
    @ ~/.julia/packages/BoundaryValueDiffEqFIRK/xca6M/src/collocation.jl:2 [inlined]
 [16] __firk_loss_collocation!(resid::Vector{…}, u::Vector{…}, p::Tuple{…}, y::Vector{…}, mesh::Vector{…}, residual::Vector{…}, cache::BoundaryValueDiffEqFIRK.FIRKCacheExpand{…})
    @ BoundaryValueDiffEqFIRK ~/.julia/packages/BoundaryValueDiffEqFIRK/xca6M/src/firk.jl:759
 [17] #117
    @ ~/.julia/packages/BoundaryValueDiffEqFIRK/xca6M/src/firk.jl:411 [inlined]
 [18] FixTail
    @ ~/.julia/packages/DifferentiationInterface/7eD1K/src/utils/context.jl:169 [inlined]
 [19] finite_difference_jacobian!(J::Matrix{…}, f::DifferentiationInterface.FixTail{…}, x::Vector{…}, cache::FiniteDiff.JacobianCache{…}, f_in::Nothing; relstep::Float64, absstep::Float64, colorvec::UnitRange{…}, sparsity::Nothing, dir::Bool)
    @ FiniteDiff ~/.julia/packages/FiniteDiff/EBPBu/src/jacobians.jl:444
 [20] finite_difference_jacobian! (repeats 2 times)
    @ ~/.julia/packages/FiniteDiff/EBPBu/src/jacobians.jl:406 [inlined]
 [21] jacobian
    @ ~/.julia/packages/DifferentiationInterface/7eD1K/ext/DifferentiationInterfaceFiniteDiffExt/twoarg.jl:375 [inlined]
 [22] __construct_nlproblem(cache::BoundaryValueDiffEqFIRK.FIRKCacheExpand{…}, y::Vector{…}, loss_bc::BoundaryValueDiffEqFIRK.var"#115#121"{…}, loss_collocation::BoundaryValueDiffEqFIRK.var"#117#123"{…}, loss::BoundaryValueDiffEqFIRK.var"#119#125"{…}, ::SciMLBase.StandardBVProblem)
    @ BoundaryValueDiffEqFIRK ~/.julia/packages/BoundaryValueDiffEqFIRK/xca6M/src/firk.jl:483
 [23] __construct_nlproblem
    @ ~/.julia/packages/BoundaryValueDiffEqFIRK/xca6M/src/firk.jl:426 [inlined]
 [24] __perform_firk_iteration(cache::BoundaryValueDiffEqFIRK.FIRKCacheExpand{…}, abstol::Float64, adaptive::Bool; nlsolve_kwargs::@NamedTuple{}, kwargs::@Kwargs{…})
    @ BoundaryValueDiffEqFIRK ~/.julia/packages/BoundaryValueDiffEqFIRK/xca6M/src/firk.jl:349
 [25] __perform_firk_iteration
    @ ~/.julia/packages/BoundaryValueDiffEqFIRK/xca6M/src/firk.jl:347 [inlined]
 [26] solve!(cache::BoundaryValueDiffEqFIRK.FIRKCacheExpand{…})
    @ BoundaryValueDiffEqFIRK ~/.julia/packages/BoundaryValueDiffEqFIRK/xca6M/src/firk.jl:302
 [27] __solve(::BVProblem{…}, ::RadauIIa5{…}; kwargs::@Kwargs{…})
    @ BoundaryValueDiffEqCore ~/.julia/packages/BoundaryValueDiffEqCore/Q7n7W/src/BoundaryValueDiffEqCore.jl:37
 [28] __solve
    @ ~/.julia/packages/BoundaryValueDiffEqCore/Q7n7W/src/BoundaryValueDiffEqCore.jl:34 [inlined]
 [29] #solve_call#35
    @ ~/.julia/packages/DiffEqBase/zYZst/src/solve.jl:635 [inlined]
 [30] solve_call
    @ ~/.julia/packages/DiffEqBase/zYZst/src/solve.jl:592 [inlined]
 [31] #solve_up#44
    @ ~/.julia/packages/DiffEqBase/zYZst/src/solve.jl:1142 [inlined]
 [32] solve_up
    @ ~/.julia/packages/DiffEqBase/zYZst/src/solve.jl:1120 [inlined]
 [33] solve(prob::BVProblem{…}, args::RadauIIa5{…}; sensealg::Nothing, u0::Nothing, p::Nothing, wrap::Val{…}, kwargs::@Kwargs{…})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/zYZst/src/solve.jl:1057
 [34] Shtar(eos::Sim{…}, r0i::Float64, Pr0::Float64, pf::Float64)
    @ Main ~/Applications/Julia/RealisticSeismology-main/src/RealMod/src/shtarMfreeFIRK.jl:256
 [35] top-level scope
    @ REPL[82]:1
Some type information was truncated. Use `show(err)` to see complete types.
(I managed to convert those warnings into Tracebacking errors via a trick using TransformerLogger in packages LoggingExtras, Logging.)
So my question is:
Is there some (convenient) way to limit the function range of exploration by finite_difference_jacobian ?
Placing hard limits or unphysical extrapolations on my derivative function would seem to risk corrupting the jacobian.
thanks