forked from landreman/regcoil_pm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
regcoil_variables.f90
193 lines (159 loc) · 8.34 KB
/
regcoil_variables.f90
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
module regcoil_variables
use stel_kinds
implicit none
logical :: verbose = .true.
character(len=*), parameter :: &
lambda_option_single = "single", &
lambda_option_scan = "scan", &
lambda_option_search = "search"
character(len=200) :: lambda_option = lambda_option_scan
integer :: ntheta_plasma=64, nzeta_plasma=64, nzetal_plasma
integer :: ntheta_coil=64, nzeta_coil=64, nzetal_coil
integer :: geometry_option_plasma = 0
integer :: geometry_option_coil = 0
real(dp) :: R0_plasma = 10.0, R0_coil = 10.0
real(dp) :: a_plasma = 0.5, a_coil = 1.0
real(dp) :: separation=0.2
character(len=200) :: wout_filename=""
character(len=200) :: shape_filename_plasma=""
character(len=200) :: nescin_filename="nescin.out"
character(len=200) :: efit_filename=""
character(len=200) :: output_filename
real(dp), dimension(:), allocatable :: theta_plasma, zeta_plasma, zetal_plasma
real(dp), dimension(:,:,:), allocatable :: r_plasma, drdtheta_plasma, drdzeta_plasma, normal_plasma
real(dp), dimension(:,:,:,:), allocatable :: g, inductance
real(dp), dimension(:,:), allocatable :: Bnormal_from_TF_and_plasma_current
real(dp), dimension(:,:), allocatable :: matrix_B, matrix_regularization
real(dp), dimension(:), allocatable :: RHS_B, RHS_regularization
real(dp), dimension(:,:,:), allocatable :: Bnormal_total
real(dp), dimension(:), allocatable :: chi2_B, chi2_M, max_Bnormal, max_M, min_M
real(dp), dimension(:,:,:,:), allocatable :: abs_M
real(dp), dimension(:,:,:,:,:), allocatable :: magnetization_vector
real(dp), dimension(:,:,:,:), allocatable :: magnetization_vector_mn
real(dp), dimension(:), allocatable :: theta_coil, zeta_coil, zetal_coil
real(dp), dimension(:,:,:), allocatable :: r_coil, drdtheta_coil, drdzeta_coil, normal_coil
real(dp), dimension(:,:,:), allocatable :: d2rdtheta2_coil, d2rdthetadzeta_coil, d2rdzeta2_coil
real(dp), dimension(:), allocatable :: rmnc_outer, rmns_outer, zmnc_outer, zmns_outer
real(dp), dimension(:,:), allocatable :: norm_normal_plasma, norm_normal_coil
real(dp), dimension(:,:), allocatable :: basis_functions_R, basis_functions_zeta_Z
real(dp) :: dtheta_plasma, dzeta_plasma, dtheta_coil, dzeta_coil
integer :: mpol_magnetization=12
integer :: ntor_magnetization=12
integer :: mnmax_plasma, mnmax_coil, mnmax_magnetization
integer :: num_basis_functions, system_size
integer, dimension(:), allocatable :: xm_plasma, xn_plasma, xm_coil, xn_coil, xm_magnetization, xn_magnetization
real(dp), dimension(:), allocatable :: rmns_plasma, zmnc_plasma, rmnc_plasma, zmns_plasma
real(dp), dimension(:), allocatable :: rmns_coil, zmnc_coil, rmnc_coil, zmns_coil
integer :: nfp
logical :: lasym
integer :: max_mpol_coil = 24, max_ntor_coil = 24 ! These variables are upper limits on the # of Fourier modes used to describe a uniform-offset coil surface.
integer :: mpol_coil_filter = 9999, ntor_coil_filter = 9999
integer :: save_level = 3
integer :: nfp_imposed = 1
integer :: symmetry_option = 1
real(dp) :: total_time
integer :: efit_num_modes = 10
real(dp) :: efit_psiN = 0.98
real(dp) :: constant_arclength_tolerance = 1.0e-6
real(dp) :: mpol_transform_refinement=5, ntor_transform_refinement=1
real(dp) :: area_plasma, area_coil, volume_plasma, volume_coil
real(dp), dimension(:), allocatable :: volume_magnetization
logical :: load_bnorm = .false.
character(len=200) :: bnorm_filename=""
real(dp) :: curpol = 1 ! number which multiplies data in bnorm file.
real(dp) :: net_poloidal_current_Amperes = 0
integer :: nbf ! number of Fourier harmonics in FOCUS format boundary.
integer, dimension(:), allocatable :: bfn, bfm
real(dp), dimension(:), allocatable :: bfs, bfc
integer :: nlambda = 4
real(dp) :: lambda_min = 1.0d-19, lambda_max = 1.0d-13
real(dp) :: lambda_single = 0
real(dp), dimension(:), allocatable :: lambda
real(dp), dimension(:,:), allocatable :: matrix
real(dp), dimension(:), allocatable :: RHS, solution
! Variables needed by LAPACK:
integer :: LAPACK_INFO, LAPACK_LWORK
real(dp), dimension(:), allocatable :: LAPACK_WORK
integer, dimension(:), allocatable :: LAPACK_IPIV
real(dp) :: target_value = 8.0d+6
real(dp) :: lambda_search_tolerance = 1.0d-5
integer :: exit_code = 0
real(dp) :: chi2_B_target = 0
real(dp), dimension(:,:,:), allocatable :: Jacobian_coil
real(dp), dimension(:,:), allocatable :: Jacobian_ssquared_term
real(dp), dimension(:,:), allocatable :: mean_curvature_coil
real(dp), dimension(:,:), allocatable :: d
integer :: ns_magnetization = 1
integer :: ns_integration = 2
real(dp) :: d_initial = 0.01d+0
integer :: nd = 10
real(dp), dimension(:), allocatable :: s_integration, s_weights, s_magnetization, s_magnetization_weights
real(dp), dimension(:,:), allocatable :: interpolate_magnetization_to_integration
real(dp), dimension(:,:), allocatable :: last_d
real(dp), dimension(:,:,:), allocatable :: s_averaged_abs_M, d_iterations
integer :: sign_normal = 1
real(dp) :: target_mu0_M = 1.4d+0
integer :: nsaved
character(len=*), parameter :: &
target_option_max_M = "max_M", &
target_option_chi2_M = "chi2_M", &
target_option_max_Bnormal = "max_Bnormal", &
target_option_rms_Bnormal = "rms_Bnormal", &
target_option_chi2_B = "chi2_B"
character(len=200) :: target_option = target_option_max_M
character(len=*), parameter :: &
s_integration_option_Gaussian = "Gaussian", &
s_integration_option_Chebyshev = "Chebyshev"
character(len=200) :: s_integration_option = s_integration_option_Gaussian
character(len=*), parameter :: &
d_option_uniform = "uniform", &
d_option_Picard = "Picard", &
d_option_Anderson_old = "Anderson_old", &
d_option_Anderson = "Anderson"
character(len=200) :: d_option = d_option_uniform
integer :: Anderson_depth = 2
real(dp), dimension(:,:,:), allocatable :: Anderson_G, Anderson_u_tilde
real(dp) :: Anderson_alpha = 1
real(dp) :: Picard_alpha = 1
real(dp) :: min_d = 0
logical :: write_mgrid = .false.
integer :: mgrid_ir = 99
integer :: mgrid_jz = 101
integer :: mgrid_kp = 20
real(dp) :: mgrid_rmin = 0.9
real(dp) :: mgrid_rmax = 2.0
real(dp) :: mgrid_zmin = -0.75
real(dp) :: mgrid_zmax = 0.75
logical :: include_Bnormal_from_TF = .false.
real(dp), dimension(:), allocatable :: cos_zetal, sin_zetal
real(dp), dimension(:,:,:), allocatable :: d_times_unit_normal_coil
real(dp), dimension(:,:), allocatable :: max_d_before_singularity
integer :: regularization_d_exponent = 1
real(dp) :: d0
real(dp), dimension(:), allocatable :: dmnc, dmns
logical :: filter_d = .true.
logical :: include_constant_basis_function = .true.
integer, parameter :: max_nports = 10
integer :: nports
real(dp), dimension(max_nports) :: ports_theta0, ports_zeta0, ports_theta_width, ports_zeta_width
real(dp) :: ports_sharpness = 5
real(dp) :: ports_magnitude = 1.0d+6
real(dp), dimension(:,:), allocatable :: ports_weight
namelist / regcoil_nml / ntheta_plasma, nzeta_plasma, ntheta_coil, nzeta_coil, &
geometry_option_plasma, geometry_option_coil, &
R0_plasma, R0_coil, a_plasma, a_coil, &
separation, wout_filename, &
save_level, nfp_imposed, symmetry_option, &
mpol_magnetization, ntor_magnetization, mpol_coil_filter, ntor_coil_filter, &
nescin_filename, efit_filename, efit_psiN, efit_num_modes, &
mpol_transform_refinement, ntor_transform_refinement, max_mpol_coil, max_ntor_coil, &
bnorm_filename, &
shape_filename_plasma, nlambda, lambda_min, lambda_max, lambda_option, verbose, &
target_option, target_value, lambda_search_tolerance, &
ns_magnetization, ns_integration, d_initial, s_integration_option, lambda_single, sign_normal, &
d_option, nd, target_mu0_M, Anderson_depth, Anderson_alpha, Picard_alpha, min_d, &
write_mgrid, mgrid_ir, mgrid_jz, mgrid_kp, mgrid_rmin, mgrid_rmax, mgrid_zmin, mgrid_zmax, &
include_bnormal_from_TF, net_poloidal_current_Amperes, regularization_d_exponent, &
ports_theta0, ports_zeta0, ports_theta_width, ports_zeta_width, ports_sharpness, ports_magnitude, &
filter_d, include_constant_basis_function
end module regcoil_variables