File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,8 @@ function assemble_drift(rs)
7979 for (spec,stoich) in rx. netstoich
8080 i = species_to_idx[spec]
8181 if iszero (eqs[i]. rhs)
82- rhs = isone (stoich) ? rl : stoich * rl
82+ signedrl = (stoich > zero (stoich)) ? rl : - rl
83+ rhs = isone (abs (stoich)) ? signedrl : stoich * rl
8384 else
8485 Δspec = isone (abs (stoich)) ? rl : abs (stoich) * rl
8586 rhs = (stoich > zero (stoich)) ? (eqs[i]. rhs + Δspec) : (eqs[i]. rhs - Δspec)
@@ -97,8 +98,9 @@ function assemble_diffusion(rs)
9798 for (j,rx) in enumerate (rs. eqs)
9899 rlsqrt = sqrt (oderatelaw (rx))
99100 for (spec,stoich) in rx. netstoich
100- i = species_to_idx[spec]
101- eqs[i,j] = isone (stoich) ? rlsqrt : stoich * rlsqrt
101+ i = species_to_idx[spec]
102+ signedrlsqrt = (stoich > zero (stoich)) ? rlsqrt : - rlsqrt
103+ eqs[i,j] = isone (abs (stoich)) ? signedrlsqrt : stoich * rlsqrt
102104 end
103105 end
104106 eqs
You can’t perform that action at this time.
0 commit comments