Coverage for pySDC/projects/PinTSimE/piline_model.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.6.9, created at 2024-12-20 14:51 +0000

1from pySDC.implementations.problem_classes.Piline import piline 

2from pySDC.implementations.sweeper_classes.imex_1st_order import imex_1st_order 

3 

4from pySDC.projects.PinTSimE.battery_model import runSimulation 

5 

6from pySDC.implementations.hooks.log_solution import LogSolution 

7 

8 

9def main(): 

10 r""" 

11 Executes the simulation. 

12 

13 Note 

14 ---- 

15 Hardcoded solutions for battery models in `pySDC.projects.PinTSimE.hardcoded_solutions` are only computed for 

16 ``dt_list=[1e-2, 1e-3]`` and ``M_fix=4``. Hence changing ``dt_list`` and ``M_fix`` to different values could arise 

17 an ``AssertionError``. 

18 """ 

19 

20 # --- defines parameters for sweeper ---- 

21 M_fix = 3 

22 sweeper_params = { 

23 'num_nodes': M_fix, 

24 'quad_type': 'LOBATTO', 

25 'QI': 'IE', 

26 } 

27 

28 # --- defines parameters for event detection ---- 

29 handling_params = { 

30 'restol': 1e-12, 

31 'maxiter': 8, 

32 'max_restarts': None, 

33 'recomputed': None, 

34 'tol_event': None, 

35 'alpha': None, 

36 'exact_event_time_avail': None, 

37 } 

38 

39 # ---- all parameters are stored in this dictionary - note: defaults are used for the problem ---- 

40 all_params = { 

41 'problem_params': {}, 

42 'sweeper_params': sweeper_params, 

43 'handling_params': handling_params, 

44 } 

45 

46 hook_class = [LogSolution] 

47 

48 use_detection = [False] 

49 use_adaptivity = [False] 

50 

51 _ = runSimulation( 

52 problem=piline, 

53 sweeper=imex_1st_order, 

54 all_params=all_params, 

55 use_adaptivity=use_adaptivity, 

56 use_detection=use_detection, 

57 hook_class=hook_class, 

58 interval=(0.0, 15.0), 

59 dt_list=[5e-2, 1e-2], 

60 nnodes=[M_fix], 

61 ) 

62 

63 

64if __name__ == "__main__": 

65 main()