Skip to content

Interaction between Adapt.jl and jacobian_ad #2473

@vchuravy

Description

@vchuravy

The semi itself is constructed with two arguments, RealT and uEltype, that determine the type of internal caches, etc. By default, they will be Float64, but there should be some clear interaction between all these types.

For example, how would you see the interaction with AD like in

function _jacobian_ad_forward(semi, t0, u0_ode, du_ode, config)
new_semi = remake(semi, uEltype = eltype(config))
# Create anonymous function passed as first argument to `ForwardDiff.jacobian` to match
# `ForwardDiff.jacobian(f!, y::AbstractArray, x::AbstractArray,
# cfg::JacobianConfig = JacobianConfig(f!, y, x), check=Val{true}())`
J = ForwardDiff.jacobian(du_ode, u0_ode, config) do du_ode, u_ode
Trixi.rhs!(du_ode, u_ode, new_semi, t0)
end
return J
end

Originally posted by @ranocha in #2212 (comment)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions