V3FIT
All Classes Namespaces Files Functions Variables Enumerations Macros Pages
read_wout_curve.f
1  SUBROUTINE read_wout_curve (wout_file, ierr,
2  1 nphi20, rbdy_3d, zbdy_3d)
3  USE vname0
4  USE vname1, ONLY : mpol_in => mpol, nfp_in => nfp,
5  1 nphi2_in => nphi2
6  USE read_wout_mod
7  IMPLICIT NONE
8 
9  INTEGER, INTENT(out) :: ierr
10  INTEGER :: mn, m, n, nphi20
11  REAL(rprec) :: rbdy_3d(0:mu-1,-nphi20:nphi20,2),
12  1 zbdy_3d(0:mu-1,-nphi20:nphi20,2)
13  CHARACTER*(*) :: wout_file
14 
15  rbdy_3d = 0
16  zbdy_3d = 0
17 
18  ierr = -1
19  IF (index(wout_file,'wout') .eq. 1)
20  1 CALL read_wout_file(wout_file(6:), ierr)
21  IF (ierr .ne. 0) RETURN
22 
23  mpol_in = mpol
24  nfp_in = nfp
25  nphi2_in = ntor
26 
27  IF (mpol .gt. mu) stop 'mpol-input > mu'
28  IF (nfp .le. 0) nfp = 1
29 
30  DO mn = 1, mnmax
31  m = nint(xm(mn))
32  n = nint(xn(mn))/nfp
33  rbdy_3d(m,n,1) = rmnc(mn,ns)
34  zbdy_3d(m,n,1) = zmns(mn,ns)
35  rbdy_3d(m,n,2) = rmns(mn,ns)
36  zbdy_3d(m,n,2) = zmnc(mn,ns)
37  END DO
38 
39  END SUBROUTINE read_wout_curve