Skip to content

Commit 7d015b1

Browse files
committed
Use thermovariabledict to find thermo variable indexes
1 parent 4533e29 commit 7d015b1

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/Simulation.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,11 @@ end
455455
function getadjointsensitivities(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}
456456
@assert target in bsol.names || target in ["T","V","P"]
457457
if target in ["T","V","P"]
458-
ind = bsol.domain.indexes[end]
458+
if haskey(bsol.domain.thermovariabledict, target)
459+
ind = bsol.domain.thermovariabledict[target]
460+
else
461+
throw(error("$(bsol.domain) doesn't have $target in its thermovariables"))
462+
end
459463
else
460464
ind = findfirst(isequal(target),bsol.names)+bsol.domain.indexes[1]-1
461465
end

0 commit comments

Comments
 (0)