Skip to content

Commit d5d8873

Browse files
TorkelEisaacsas
andcommitted
Update src/spatial_reaction_systems/spatial_ODE_systems.jl
Co-authored-by: Sam Isaacson <[email protected]>
1 parent 2b5b6bf commit d5d8873

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/spatial_reaction_systems/spatial_ODE_systems.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,11 @@ end
171171
function (jac_func::LatticeTransportODEjac)(J, u, p, t)
172172
J .= 0.0
173173

174-
# Updates for non-spatial reactions.
175-
for vert_i in 1:(jac_func.num_verts) # Loops through all vertexes and applies the (non-spatial) Jacobian to the species in that vertex.
176-
jac_func.ofunc.jac((@view J[get_indexes(vert_i, jac_func.num_species),
177-
get_indexes(vert_i, jac_func.num_species)]),
178-
(@view u[get_indexes(vert_i, jac_func.num_species)]),
179-
view_vert_ps_vector!(jac_func.work_vert_ps, p, vert_i, jac_func.enum_v_ps_idx_types), t) # These inputs are the same as when f_func.ofunc was applied in the previous block.
174+
# Update the Jacobian from reaction terms
175+
for vert_i in 1:(jac_func.num_verts)
176+
idxs = get_indexes(vert_i, jac_func.num_species)
177+
vert_ps = view_vert_ps_vector!(jac_func.work_vert_ps, p, vert_i, jac_func.enum_v_ps_idx_types)
178+
jac_func.ofunc.jac((@view J[idxs, idxs], (@view u[idxs]), vert_ps, t)
180179
end
181180

182181
# Updates for the spatial reactions (adds the Jacobian values from the diffusion reactions).

0 commit comments

Comments
 (0)