File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -610,7 +610,8 @@ def jacp(*args, **kwargs):
610
610
# equations, then we also need to update the mass matrix
611
611
if calculate_sensitivities_explicit :
612
612
n_inputs = model .len_rhs_sens // model .len_rhs
613
- if model .mass_matrix .shape [0 ] == model .len_rhs_and_alg :
613
+ if (model .mass_matrix is not None
614
+ and model .mass_matrix .shape [0 ] == model .len_rhs_and_alg ):
614
615
model .mass_matrix_inv = pybamm .Matrix (
615
616
block_diag (
616
617
[model .mass_matrix_inv .entries ] * (n_inputs + 1 ),
@@ -624,10 +625,11 @@ def jacp(*args, **kwargs):
624
625
)
625
626
else :
626
627
# take care if calculate_sensitivites used then not used
627
- if model .mass_matrix .shape [0 ] > model .len_rhs_and_alg :
628
+ if (model .mass_matrix is not None and
629
+ model .mass_matrix .shape [0 ] > model .len_rhs_and_alg ):
628
630
model .mass_matrix_inv = pybamm .Matrix (
629
- model .mass_matrix_inv .entries [:model .len_rhs_and_alg ,
630
- :model .len_rhs_and_alg ]
631
+ model .mass_matrix_inv .entries [:model .len_rhs ,
632
+ :model .len_rhs ]
631
633
)
632
634
model .mass_matrix = pybamm .Matrix (
633
635
model .mass_matrix .entries [:model .len_rhs_and_alg ,
You can’t perform that action at this time.
0 commit comments