File tree 2 files changed +12
-5
lines changed
2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -299,11 +299,8 @@ def event_fun(t):
299
299
300
300
# assign temporary solve time
301
301
current_step_sol .solve_time = np .nan
302
- if solution is None :
303
- solution = current_step_sol
304
- else :
305
- # append solution from the current step to solution
306
- solution .append (current_step_sol )
302
+ # append solution from the current step to solution
303
+ solution .append (current_step_sol )
307
304
solution .termination = "event"
308
305
solution .t_event = t_event
309
306
solution .y_event = y_event
Original file line number Diff line number Diff line change @@ -306,6 +306,16 @@ def test_model_solver_with_inputs(self):
306
306
self .assertLess (len (solution .t ), len (t_eval ))
307
307
np .testing .assert_allclose (solution .y [0 ], np .exp (- 0.1 * solution .t ), rtol = 1e-04 )
308
308
309
+ # Without grid
310
+ solver = pybamm .CasadiSolver (mode = "safe without grid" , rtol = 1e-8 , atol = 1e-8 )
311
+ t_eval = np .linspace (0 , 10 , 100 )
312
+ solution = solver .solve (model , t_eval , inputs = {"rate" : 0.1 })
313
+ self .assertLess (len (solution .t ), len (t_eval ))
314
+ np .testing .assert_allclose (solution .y [0 ], np .exp (- 0.1 * solution .t ), rtol = 1e-04 )
315
+ solution = solver .solve (model , t_eval , inputs = {"rate" : 1.1 })
316
+ self .assertLess (len (solution .t ), len (t_eval ))
317
+ np .testing .assert_allclose (solution .y [0 ], np .exp (- 1.1 * solution .t ), rtol = 1e-04 )
318
+
309
319
def test_model_solver_dae_inputs_in_initial_conditions (self ):
310
320
# Create model
311
321
model = pybamm .BaseModel ()
You can’t perform that action at this time.
0 commit comments