V3FIT
All Classes Namespaces Files Functions Variables Enumerations Macros Pages
init_tf_coils.f
1  SUBROUTINE init_tf_coils (nvariables, xvariables)
2 !-----------------------------------------------
3 ! M o d u l e s
4 !-----------------------------------------------
5  USE tf_coils
6  IMPLICIT NONE
7 !-----------------------------------------------
8 ! L o c a l V a r i a b l e s
9 !-----------------------------------------------
10  INTEGER :: nvariables, nx_max, ny_max, nx, ny, ntf
11  REAL(rprec) :: xvariables(*)
12  REAL(rprec) :: tfc_xmin, tfc_xmax
13  REAL(rprec) :: tfc_ymin, tfc_ymax
14  REAL(rprec) :: tfc_zmin, tfc_zmax
15  REAL(rprec) :: tfc_dphi, tfc_phi, tfc_rad
16  REAL(rprec) :: tfc_dx, tfc_dy, tfc_scl
17 !-----------------------------------------------
18  mtfcoil = 1
19  mtfwire = 2
20 
21 ! Model QPS tf coil with RETURN legs ...
22  nx_max = 6
23  ny_max = 2
24  tfc_dphi = twopi/(nx_max*ny_max)
25  tfc_phi = 0.5_dp*tfc_dphi
26 ! tfc_scl = 0.9_dp ! since the following are engineering values
27  tfc_scl = 1.0_dp ! for vmec input based on actual plasma SIZE
28  tfc_rad = 2.15_dp/tfc_scl
29  tfc_xmin = -0.375_dp/tfc_scl
30  tfc_xmax = 0.375_dp/tfc_scl
31  tfc_dx = 0.150_dp/tfc_scl
32  tfc_ymin = 0._dp
33  tfc_ymax = 0.013_dp/tfc_scl
34  tfc_dy = 0.026_dp/tfc_scl
35  tfc_zmin = -2.48_dp/tfc_scl
36  tfc_zmax = 2.48_dp/tfc_scl
37  IF (lqos) THEN
38  mtfwire = 5
39 ! distribute straight tf filaments in a rectangle in x-y plane
40  mtfcoil = nx_max*ny_max
41  ntf = 0
42  DO ny = 1, ny_max
43  DO nx = 1, nx_max
44  ntf = ntf + 1
45  IF (ny .eq. 1) THEN
46  tfc_x(ntf,1) = (tfc_xmax - (nx-1)*tfc_dx)
47  ELSE
48  tfc_x(ntf,1) = (tfc_xmin + (nx-1)*tfc_dx)
49  END IF
50  tfc_x(ntf,2) = tfc_x(ntf,1)
51  tfc_x(ntf,3) = tfc_rad*cos(tfc_phi)
52  tfc_x(ntf,4) = tfc_x(ntf,3)
53  tfc_x(ntf,5) = tfc_x(ntf,1)
54  tfc_y(ntf,1) = (tfc_ymax - (ny-1)*tfc_dy)
55  tfc_y(ntf,2) = tfc_y(ntf,1)
56  tfc_y(ntf,3) = tfc_rad*sin(tfc_phi)
57  tfc_y(ntf,4) = tfc_y(ntf,3)
58  tfc_y(ntf,5) = tfc_y(ntf,1)
59  tfc_z(ntf,1) = tfc_zmax
60  tfc_z(ntf,2) = tfc_zmin
61  tfc_z(ntf,3) = tfc_zmin
62  tfc_z(ntf,4) = tfc_zmax
63  tfc_z(ntf,5) = tfc_zmax
64  tfc_cur(ntf) = i_tfc/mtfcoil
65  tfc_phi = tfc_phi + tfc_dphi
66  END DO
67  END DO
68  ELSE
69 ! single filament at x=0, y=0
70  tfc_zmin = -1000
71  tfc_zmax = 1000
72  tfc_x(1,1) = 0
73  tfc_x(1,2) = 0
74  tfc_y(1,1) = 0
75  tfc_y(1,2) = 0
76  tfc_z(1,1) = tfc_zmax
77  tfc_z(1,2) = tfc_zmin
78  tfc_cur(1) = i_tfc
79  END IF
80 
81  xvariables(1) = i_tfc
82  nvariables = 1
83 
84  END SUBROUTINE init_tf_coils