forked from landreman/regcoil_pm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
regcoil.f90
52 lines (38 loc) · 1.37 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
! Main program
program regcoil
use regcoil_variables
use regcoil_init_plasma_mod
implicit none
integer :: tic, toc, countrate
print "(a)","This is REGCOIL_PM,"
print "(a)","a regularized least-squares method for designing permanent magnets for stellarators."
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_init_ports()
call regcoil_read_bnorm()
call regcoil_init_basis_functions()
call regcoil_build_matrices()
call regcoil_prepare_solve()
select case (trim(lambda_option))
case (lambda_option_single,lambda_option_scan)
call regcoil_lambda_scan()
case (lambda_option_search)
call regcoil_auto_regularization_solve()
case default
print *,"Invalid lambda_option:",lambda_option
stop
end select
call system_clock(toc)
total_time = real(toc-tic)/countrate
call regcoil_evaluate_outer_surface()
call regcoil_write_output()
if (write_mgrid) call regcoil_write_mgrid()
print *,"REGCOIL_PM complete. Total time=",total_time,"sec."
print *,"You can run regcoilPlot ",trim(output_filename)," to plot results."
end program regcoil