-
Notifications
You must be signed in to change notification settings - Fork 6
/
regcoil.f90
68 lines (52 loc) · 1.8 KB
/
regcoil.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
! Main program
program regcoil
use regcoil_variables, only: total_time, output_filename, general_option, &
sensitivity_option, exit_code, fixed_norm_sensitivity_option
use regcoil_init_plasma_mod
implicit none
integer :: tic, toc, countrate
print *,"This is REGCOIL,"
print *,"a regularized least-squares method for computing stellarator coil shapes."
call system_clock(tic,countrate)
call regcoil_read_input()
call regcoil_validate_input()
call regcoil_compute_lambda()
! Define the position vector and normal vector at each grid point for the surfaces:
call regcoil_init_plasma()
call regcoil_init_coil_surface()
! Initialize some of the vectors and matrices needed:
call regcoil_read_bnorm()
!Initialize sensitivity arrays
if (sensitivity_option > 1) then
call regcoil_init_sensitivity()
endif
call regcoil_build_matrices()
call regcoil_prepare_solve()
select case (general_option)
case (1)
call regcoil_lambda_scan()
if (sensitivity_option > 1) then
call regcoil_adjoint_solve()
end if
case (2)
call regcoil_compute_diagnostics_for_nescout_potential()
case (3)
call regcoil_svd_scan()
case (4,5)
call regcoil_auto_regularization_solve()
if (sensitivity_option > 1 .and. exit_code == 0) then
call regcoil_adjoint_solve()
end if
case default
print *,"Invalid general_option:",general_option
stop
end select
if (fixed_norm_sensitivity_option .and. sensitivity_option > 1 .and. exit_code == 0) then
call regcoil_fixed_norm_sensitivity()
end if
call system_clock(toc)
total_time = real(toc-tic)/countrate
call regcoil_write_output()
print *,"REGCOIL complete. Total time=",total_time,"sec."
print *,"You can run regcoilPlot ",trim(output_filename)," to plot results."
end program regcoil