Skip to content

Commit

Permalink
fix bug with normalization of transitory sensitivities with interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mjohnson541 committed Feb 4, 2024
1 parent a3b22d5 commit b3d12d8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/TransitorySensitivities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ function normalizefulltransitorysensitivities!(dSdt,ssys::SystemSimulation,t)
@views ns = y[sim.domain.indexes[1]:sim.domain.indexes[2]]
@views dSdt[sim.domain.indexes[1]:sim.domain.indexes[2],:] ./= ns
end
for (i,inter) in enumerate(ssys.interfaces)
if isa(inter, AbstractReactiveInternalInterface)
@views dSdt[:,inter.parameterindexes[1]:inter.parameterindexes[2]] .*= ssys.p[inter.parameterindexes[1]:inter.parameterindexes[2]]'
end
end
return dSdt
end

Expand Down Expand Up @@ -205,6 +210,11 @@ function normalizeadjointtransitorysensitivities!(dSdt,ssys::SystemSimulation,t,
dSdt ./= y[ind]
end
end
for (i,inter) in enumerate(ssys.interfaces)
if isa(inter, AbstractReactiveInternalInterface)
@views dSdt[inter.parameterindexes[1]:inter.parameterindexes[2]] .*= ssys.p[inter.parameterindexes[1]:inter.parameterindexes[2]]
end
end
return dSdt
end

Expand Down

0 comments on commit b3d12d8

Please sign in to comment.