Open
Description
We'd like to get this code working
using TEQUILA, MillerExtendedHarmonic, ForwardDiff
shotd3d = Shot(11, 11, 7, "../sample/g_chease_mxh_d3d")
bnd = shotd3d.surfaces[:,end]
dP_dψ = shotd3d.dP_dψ
F_dF_dψ = shotd3d.F_dF_dψ
Pbnd = shotd3d.Pbnd
Fbnd = shotd3d.Fbnd
function solve_from_bnd(bnd)
# initialize TEQUILA
shot = Shot(11, 11, MXH(bnd); dP_dψ, F_dF_dψ, Pbnd, Fbnd);
# solve TEQUILA equilibrium
refill = solve(shot, 3; debug=false)
return refill
end
@time refill = solve_from_bnd(bnd); # runs fine
ForwardDiff.jacobian(solve_from_bnd, bnd);
Currently, jacobian
errors with the following, but I'm sure that's just the beginning:
MethodError: no method matching Float64(::ForwardDiff.Dual{ForwardDiff.Tag{typeof(solve_from_bnd), Float64}, Float64, 10})
Closest candidates are:
(::Type{T})(::Real, ::RoundingMode) where T<:AbstractFloat
@ Base rounding.jl:207
(::Type{T})(::T) where T<:Number
@ Core boot.jl:792
(::Type{T})(::AbstractChar) where T<:Union{AbstractChar, Number}
@ Base char.jl:50
...
Stacktrace:
[1] _broadcast_getindex_evalf
@ ./broadcast.jl:683 [inlined]
[2] _broadcast_getindex
@ ./broadcast.jl:656 [inlined]
[3] getindex
@ ./broadcast.jl:610 [inlined]
[4] copy
@ ./broadcast.jl:912 [inlined]
[5] materialize
@ ./broadcast.jl:873 [inlined]
[6] surfaces_FE(ρ::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, surfaces::Matrix{ForwardDiff.Dual{ForwardDiff.Tag{typeof(solve_from_bnd), Float64}, Float64, 10}})
@ TEQUILA ~/.julia/dev/TEQUILA/src/surfaces.jl:89
[7] Shot(N::Int64, M::Int64, boundary::MXH{ForwardDiff.Dual{ForwardDiff.Tag{typeof(solve_from_bnd), Float64}, Float64, 10}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(solve_from_bnd), Float64}, Float64, 10}}}; Raxis::ForwardDiff.Dual{ForwardDiff.Tag{typeof(solve_from_bnd), Float64}, Float64, 10}, Zaxis::ForwardDiff.Dual{ForwardDiff.Tag{typeof(solve_from_bnd), Float64}, Float64, 10}, P::Nothing, dP_dψ::FiniteElementHermite.FE_rep{Vector{Float64}, Vector{Float64}}, F_dF_dψ::FiniteElementHermite.FE_rep{Vector{Float64}, Vector{Float64}}, Jt_R::Nothing, Jt::Nothing, Pbnd::Float64, Fbnd::Float64, Ip_target::Nothing, approximate_psi::Bool)
@ TEQUILA ~/.julia/dev/TEQUILA/src/shot.jl:101
[8] solve_from_bnd(bnd::Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(solve_from_bnd), Float64}, Float64, 10}})
@ Main ./In[9]:3
[9] chunk_mode_jacobian(f::typeof(solve_from_bnd), x::Vector{Float64}, cfg::ForwardDiff.JacobianConfig{ForwardDiff.Tag{typeof(solve_from_bnd), Float64}, Float64, 10, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(solve_from_bnd), Float64}, Float64, 10}}})
@ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/jacobian.jl:183
[10] jacobian(f::Function, x::Vector{Float64}, cfg::ForwardDiff.JacobianConfig{ForwardDiff.Tag{typeof(solve_from_bnd), Float64}, Float64, 10, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(solve_from_bnd), Float64}, Float64, 10}}}, ::Val{true})
@ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/jacobian.jl:23
[11] jacobian(f::Function, x::Vector{Float64}, cfg::ForwardDiff.JacobianConfig{ForwardDiff.Tag{typeof(solve_from_bnd), Float64}, Float64, 10, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(solve_from_bnd), Float64}, Float64, 10}}})
@ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/jacobian.jl:19
[12] jacobian(f::Function, x::Vector{Float64})
@ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/jacobian.jl:19
[13] top-level scope
@ In[12]:1