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 8, 2024
1 parent be21539 commit be40355
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]]'

Check warning on line 168 in src/TransitorySensitivities.jl

View check run for this annotation

Codecov / codecov/patch

src/TransitorySensitivities.jl#L166-L168

Added lines #L166 - L168 were not covered by tests
end
end

Check warning on line 170 in src/TransitorySensitivities.jl

View check run for this annotation

Codecov / codecov/patch

src/TransitorySensitivities.jl#L170

Added line #L170 was not covered by tests
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]]

Check warning on line 215 in src/TransitorySensitivities.jl

View check run for this annotation

Codecov / codecov/patch

src/TransitorySensitivities.jl#L213-L215

Added lines #L213 - L215 were not covered by tests
end
end

Check warning on line 217 in src/TransitorySensitivities.jl

View check run for this annotation

Codecov / codecov/patch

src/TransitorySensitivities.jl#L217

Added line #L217 was not covered by tests
return dSdt
end

Expand Down

0 comments on commit be40355

Please sign in to comment.