You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@inlinefunctiondydtreactor!(dydt::RC,y::U,t::Z,domains::Q,interfaces::B;p::RV=DiffEqBase.NullParameters(),sensitivity::Bool=true) where {RC,RV,B,Z,U,Q<:Tuple}
Copy file name to clipboardExpand all lines: src/Simulation.jl
+61-15Lines changed: 61 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -354,6 +354,9 @@ based alternative algorithm is slower, but avoids this concern.
354
354
"""
355
355
functiongetadjointsensitivities(bsol::Q,target::String,solver::W;sensalg::W2=InterpolatingAdjoint(autojacvec=ReverseDiffVJP(false)),abstol::Float64=1e-6,reltol::Float64=1e-3,kwargs...) where {Q,W,W2}
356
356
@assert target in bsol.names || target in ["T","V","P"]
357
+
358
+
pethane =160
359
+
357
360
if target in ["T","V","P"]
358
361
ifhaskey(bsol.domain.thermovariabledict, target)
359
362
ind = bsol.domain.thermovariabledict[target]
@@ -362,14 +365,16 @@ function getadjointsensitivities(bsol::Q,target::String,solver::W;sensalg::W2=In
elseif!(target in ["T","V","P"]) &&!isempty(bsol.interfaces)
448
+
dpadj ./= bsol.sol(bsol.sol.t[end])[ind]
449
+
end
450
+
return dpadj
451
+
end
452
+
453
+
functiongetadjointsensitivities(syssim::Q,bsol::W3,target::String,solver::W;sensalg::W2=InterpolatingAdjoint(autojacvec=ReverseDiffVJP(false)),abstol::Float64=1e-6,reltol::Float64=1e-3,kwargs...) where {Q,W,W2,W3}
454
+
@assert target in bsol.names || target in ["T","V","P"]
455
+
if target in ["T","V","P"]
456
+
ifhaskey(bsol.domain.thermovariabledict, target)
457
+
ind = bsol.domain.thermovariabledict[target]
458
+
else
459
+
throw(error("$(bsol.domain) doesn't have $target in its thermovariables"))
460
+
end
461
+
else
462
+
ind =findfirst(isequal(target),bsol.names)+bsol.domain.indexes[1]-1
463
+
end
464
+
domains =Tuple([x.domain for x in syssim.sims])
465
+
functiong(y::X,p::Array{Y,1},t::Z) where {Q,V,X,Y<:Float64,Z}
0 commit comments