@@ -608,10 +608,9 @@ def jacp(*args, **kwargs):
608
608
609
609
# if we have changed the equations to include the explicit sensitivity
610
610
# equations, then we also need to update the mass matrix
611
- n_state_without_sens = model .len_rhs_and_alg
612
611
if calculate_sensitivities_explicit :
613
612
n_inputs = model .len_rhs_sens // model .len_rhs
614
- if model .mass_matrix .shape [0 ] == n_state_without_sens :
613
+ if model .mass_matrix .shape [0 ] == model . len_rhs_and_alg :
615
614
model .mass_matrix_inv = pybamm .Matrix (
616
615
block_diag (
617
616
[model .mass_matrix_inv .entries ] * (n_inputs + 1 ),
@@ -625,14 +624,14 @@ def jacp(*args, **kwargs):
625
624
)
626
625
else :
627
626
# take care if calculate_sensitivites used then not used
628
- if model .mass_matrix .shape [0 ] > n_state_without_sens :
627
+ if model .mass_matrix .shape [0 ] > model . len_rhs_and_alg :
629
628
model .mass_matrix_inv = pybamm .Matrix (
630
- model .mass_matrix_inv .entries [:n_state_without_sens ,
631
- :n_state_without_sens ]
629
+ model .mass_matrix_inv .entries [:model . len_rhs_and_alg ,
630
+ :model . len_rhs_and_alg ]
632
631
)
633
632
model .mass_matrix = pybamm .Matrix (
634
- model .mass_matrix .entries [:n_state_without_sens ,
635
- :n_state_without_sens ]
633
+ model .mass_matrix .entries [:model . len_rhs_and_alg ,
634
+ :model . len_rhs_and_alg ]
636
635
)
637
636
638
637
# Save CasADi functions for the CasADi solver
0 commit comments