V3FIT
read_boozer.f
1  SUBROUTINE read_boozer(extension)
2  USE read_boozer_mod
3  USE parambs
4  IMPLICIT NONE
5 C-----------------------------------------------
6 C D u m m y A r g u m e n t s
7 C-----------------------------------------------
8  CHARACTER*(*) :: extension
9 C-----------------------------------------------
10 C L o c a l P a r a m e t e r s
11 C-----------------------------------------------
12  REAL(rprec), PARAMETER :: zero = 0, one = 1
13 C-----------------------------------------------
14 C L o c a l V a r i a b l e s
15 C-----------------------------------------------
16  INTEGER :: istat
17 C-----------------------------------------------
18 !
19 ! NOTE: read_boozer_deallocate is called later, after bmn_b are assigned
20 !
21  CALL read_boozer_file(extension, istat)
22  IF (istat .ne. 0) THEN
23  print *,'Error reading boozer file in BOOTSJ, istat = ', istat
24  stop
25  END IF
26 
27  irdim = ns_b
28  irup = ns_b - 1 !No. points in radial (half-mesh) profiles
29  periods = nfp_b !No. field periods
30 
31 c now that we know the number of radial points, radial quantites
32 c can be ALLOCATED
33 
34  CALL allocate_radial
35 
36 c LAB--change the indexing on aipsi and gpsi to relect half mesh status
37  aipsi(1:irup) = buco_b(2:ns_b) !Boozer I
38  gpsi(1:irup) = bvco_b(2:ns_b) !Boozer g
39  qsafety(1:irup) = one/(iota_b(2:ns_b) +
40  1 sign(1.0e-14_dp,iota_b(2:ns_b)))
41  pres1(1:irup) = pres_b(2:ns_b)
42  betar(1:irup) = beta_b(2:ns_b)
43  idx(1:irup) = idx_b(2:ns_b)
44  flux(2:ns_b) = phi_b(2:ns_b)
45  phip(1:irup) = phip_b(2:ns_b)
46 
47  sign_jacobian = one !version 6.1 phi_b has the sign of the physical flux
48 c phip_b retains the internal vmec convention.
49  IF( gpsi(irup)*phip_b(ns_b) <= zero) sign_jacobian = -one
50  flux(1) = zero
51 
52  END SUBROUTINE read_boozer