Coverage for pySDC/projects/Second_orderSDC/penningtrap_params.py: 100%

27 statements  

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

1import numpy as np 

2 

3from pySDC.implementations.problem_classes.PenningTrap_3D import penningtrap 

4from pySDC.implementations.sweeper_classes.boris_2nd_order import boris_2nd_order 

5 

6 

7def penningtrap_params(): 

8 """ 

9 Define the penning trap probem params 

10 Returns: 

11 controller params 

12 description 

13 """ 

14 

15 # initialize level parameters 

16 level_params = dict() 

17 level_params['restol'] = 1e-16 

18 # It needs to be changed according to the axis that you are choosing 

19 level_params['dt'] = 0.015625 

20 

21 # initialize sweeper parameters 

22 sweeper_params = dict() 

23 sweeper_params['quad_type'] = 'GAUSS' 

24 sweeper_params['num_nodes'] = 5 

25 sweeper_params['do_coll_update'] = True 

26 # initial guess can be changed and it affects the convergence order of the SDC method 

27 sweeper_params['initial_guess'] = 'random' # 'zero', 'spread' 

28 

29 # initialize problem parameters for the penning trap 

30 problem_params = dict() 

31 problem_params['omega_E'] = 4.9 # amplititude of electric field 

32 problem_params['omega_B'] = 25.0 # amplititude of magnetic field 

33 problem_params['u0'] = np.array( 

34 [[10, 0, 0], [100, 0, 100], [1], [1]], dtype=object 

35 ) # initial condition together q and m values 

36 problem_params['nparts'] = 1 # number of particles 

37 problem_params['sig'] = 0.1 # sigma 

38 

39 # initialize controller parameters 

40 controller_params = dict() 

41 controller_params['logger_level'] = 30 

42 

43 # Fill description dictionary for easy hierarchy creation 

44 description = dict() 

45 description['problem_class'] = penningtrap 

46 description['problem_params'] = problem_params 

47 description['sweeper_params'] = sweeper_params 

48 description['sweeper_class'] = boris_2nd_order 

49 description['level_params'] = level_params 

50 

51 return controller_params, description