-
Notifications
You must be signed in to change notification settings - Fork 0
/
gc2d_dict.py
78 lines (69 loc) · 2.13 KB
/
gc2d_dict.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
###################################################################################################
## Dictionary of parameters: https://github.com/cchandre/Guiding-Center ##
###################################################################################################
import numpy as xp
Potential = 'turbulent'
Method = 'poincare_gc'
FLR = ('all', 'all')
A = 0.7
rho = xp.array([0.1, 0.3])
eta = 0
Ntraj = 100
Tf = 700
threshold = 4
TwoStepIntegration = False
Tmid = 1500
TimeStep = 5e-2 # recommended values (gc: 5e-3, fo: 5e-4)
check_energy = True
init = 'fixed'
SaveData = True
PlotResults = True
Parallelization = (False, 1)
modulo = False
grid = False
darkmode = True
fig_extension = '.pdf'
M = 25 if Potential == 'turbulent' else 5
N = 2**10
###################################################################################################
## DO NOT EDIT BELOW ##
###################################################################################################
if (FLR[0] == 'none') and (FLR[1] == 'none'):
rho = 0
if xp.all((rho == 0)):
FLR = ('none', 'none')
if xp.all((eta == 0)):
GCorder = 1
else:
GCorder = 2
val_params = xp.meshgrid(A, rho, eta, indexing='ij')
num_dict = len(val_params[0].flatten())
dict_list = [{'Potential': Potential} for _ in range(num_dict)]
if Tmid >= Tf:
Tmid = Tf // 2 if TwoStepIntegration else Tf
for _, dict in enumerate(dict_list):
dict.update({
'A': val_params[0].flatten()[_],
'rho': val_params[1].flatten()[_],
'eta': val_params[2].flatten()[_],
'FLR': FLR,
'GCorder': GCorder,
'Method': Method,
'modulo': modulo,
'threshold': threshold,
'grid': grid,
'Ntraj': Ntraj,
'Tf': Tf,
'TwoStepIntegration': TwoStepIntegration,
'Tmid': Tmid,
'init': init,
'TimeStep': TimeStep,
'check_energy': check_energy,
'SaveData': SaveData,
'PlotResults': PlotResults,
'dpi': 200 if Method == 'potentials' else 800,
'darkmode': darkmode,
'extension': fig_extension,
'M': M,
'N': N})
###################################################################################################