32 CHARACTER(LEN=*),
PARAMETER ::
94 CHARACTER(LEN=*),
PARAMETER ::
115 1
ln_mse =
'Number of MSE points',
116 1
ln_thom =
'Number of Thompson scattering points',
117 1
ln_am =
'Specification parameters for mass(s)',
118 1
ln_ac =
'Specification parameters for <J>(s)',
119 1
ln_ai =
'Specification parameters for iota(s)',
123 1
ln_am_aux_s =
'Auxiliary-s parameters for mass(s)',
124 1
ln_am_aux_f =
'Auxiliary-f parameters for mass(s)',
125 1
ln_ac_aux_s =
'Auxiliary-s parameters for <J>(s)',
126 1
ln_ac_aux_f =
'Auxiliary-f parameters for <J>(s)',
127 1
ln_ai_aux_s =
'Auxiliary-s parameters for iota(s)',
128 1
ln_ai_aux_f =
'Auxiliary-f parameters for iota(s)',
129 4
ln_pmod =
'Poloidal mode numbers',
130 5
ln_tmod =
'Toroidal mode numbers',
136 7
ln_qfact =
'q-factor on full mesh',
137 8
ln_presf =
'pressure on full mesh',
138 8
ln_phi =
'Toroidal flux on full mesh',
139 9
ln_phipf =
'd(phi)/ds: Toroidal flux deriv on full mesh',
140 9
ln_chi =
'Poloidal flux on full mesh',
141 9
ln_chipf =
'd(chi)/ds: Poroidal flux deriv on full mesh',
148 6
ln_phip =
'tor flux deriv over 2pi half',
153 1
ln_fsq =
'Residual decay',
155 2
ln_fsqr =
'Residual decay - radial',
156 2
ln_fsqz =
'Residual decay - vertical',
157 2
ln_fsql =
'Residual decay - hoop',
158 2
ln_ftolv =
'Residual decay - requested',
161 3
ln_rmnc =
'cosmn component of cylindrical R, full mesh',
162 4
ln_zmns =
'sinmn component of cylindrical Z, full mesh',
163 4
ln_lmns =
'sinmn component of lambda, half mesh',
164 5
ln_gmnc =
'cosmn component of jacobian, half mesh',
165 6
ln_bmnc =
'cosmn component of mod-B, half mesh',
166 6
ln_bsubumnc =
'cosmn covariant u-component of B, half mesh',
167 6
ln_bsubvmnc =
'cosmn covariant v-component of B, half mesh',
168 7
ln_bsubsmns =
'sinmn covariant s-component of B, full mesh',
178 3
ln_rmns =
'sinmn component of cylindrical R, full mesh',
179 4
ln_zmnc =
'cosmn component of cylindrical Z, full mesh',
180 4
ln_lmnc =
'cosmn component of lambda, half mesh',
181 5
ln_gmns =
'sinmn component of jacobian, half mesh',
182 6
ln_bmns =
'sinmn component of mod-B, half mesh',
183 6
ln_bsubumns =
'sinmn covariant u-component of B, half mesh',
184 6
ln_bsubvmns =
'sinmn covariant v-component of B, half mesh',
185 7
ln_bsubsmnc =
'cosmn covariant s-component of B, full mesh',
193 6
ln_rbc =
'Initial boundary R cos(mu-nv) coefficients',
194 7
ln_zbs =
'Initial boundary Z sin(mu-nv) coefficients',
195 8
ln_rbs =
'Initial boundary R sin(mu-nv) coefficients',
196 9
ln_zbc =
'Initial boundary Z cos(mu-nv) coefficients',
197 1
ln_potvac =
'Vacuum Potential on Boundary'
212 REAL(
rprec),
DIMENSION(:,:),
ALLOCATABLE ::
216 REAL(
rprec),
DIMENSION(:,:),
ALLOCATABLE ::
219 REAL(
rprec),
DIMENSION(:),
ALLOCATABLE ::
234 INTEGER,
PARAMETER :: norm_term_flag=0,
235 1 bad_jacobian_flag=1, more_iter_flag=2, jac75_flag=4
243 PRIVATE :: read_wout_nc
244 PRIVATE :: norm_term_flag, bad_jacobian_flag,
245 1 more_iter_flag, jac75_flag
255 INTEGER,
INTENT(out) :: ierr
256 INTEGER,
OPTIONAL :: iopen
257 CHARACTER(LEN=*),
INTENT(in) :: file_or_extension
261 INTEGER,
PARAMETER :: iunit_init = 10
263 CHARACTER(len=LEN_TRIM(file_or_extension)+10) :: filename
276 CALL read_wout_nc(filename, ierr)
279 IF (
PRESENT(iopen)) iopen = ierr
285 IF (
ALLOCATED(
xn))
THEN
293 SUBROUTINE read_wout_nc(filename, ierr)
300 INTEGER,
INTENT(out) :: ierr
301 CHARACTER(LEN=*),
INTENT(in) :: filename
305 INTEGER :: nwout, ierror
306 INTEGER,
DIMENSION(3) :: dimlens
308 REAL(rprec),
DIMENSION(:),
ALLOCATABLE :: raxis_cc, raxis_cs,
312 CALL cdf_open(nwout,filename,
'r', ierr)
313 IF (ierr .ne. 0)
THEN
314 print *,
' Error opening wout .nc file'
349 CALL cdf_read(nwout,
vn_free, lfreeb)
355 CALL cdf_read(nwout,
vn_b0,
b0)
376 CALL cdf_inquire(nwout,
vn_mgmode, dimlens, ier=ierror)
381 CALL cdf_inquire(nwout,
vn_pmod, dimlens)
382 ALLOCATE (
xm(dimlens(1)), stat = ierror)
383 CALL cdf_inquire(nwout,
vn_tmod, dimlens)
384 ALLOCATE (
xn(dimlens(1)), stat = ierror)
387 ALLOCATE (
xm_nyq(dimlens(1)), stat = ierror)
389 ALLOCATE (
xn_nyq(dimlens(1)), stat = ierror)
392 CALL cdf_inquire(nwout,
vn_racc, dimlens)
393 ALLOCATE (raxis_cc(0:dimlens(1)-1), stat = ierror)
394 CALL cdf_inquire(nwout,
vn_zacs, dimlens)
395 ALLOCATE (zaxis_cs(0:dimlens(1)-1), stat = ierror)
397 CALL cdf_inquire(nwout,
vn_racs, dimlens)
398 ALLOCATE (raxis_cs(0:dimlens(1)-1), stat = ierror)
399 CALL cdf_inquire(nwout,
vn_zacc, dimlens)
400 ALLOCATE (zaxis_cc(0:dimlens(1)-1), stat = ierror)
404 CALL cdf_inquire(nwout,
vn_am, dimlens)
405 ALLOCATE (
am(0:dimlens(1)-1), stat = ierror)
406 CALL cdf_inquire(nwout,
vn_ac, dimlens)
407 ALLOCATE (
ac(0:dimlens(1)-1), stat = ierror)
408 CALL cdf_inquire(nwout,
vn_ai, dimlens)
409 ALLOCATE (
ai(0:dimlens(1)-1), stat = ierror)
412 ALLOCATE (
ac_aux_s(dimlens(1)), stat = ierror)
414 ALLOCATE (
ac_aux_f(dimlens(1)), stat = ierror)
416 ALLOCATE (
ai_aux_s(dimlens(1)), stat = ierror)
418 ALLOCATE (
ai_aux_f(dimlens(1)), stat = ierror)
420 ALLOCATE (
am_aux_s(dimlens(1)), stat = ierror)
422 ALLOCATE (
am_aux_f(dimlens(1)), stat = ierror)
424 CALL cdf_inquire(nwout,
vn_iotaf, dimlens)
425 ALLOCATE (
iotaf(dimlens(1)), stat = ierror)
426 CALL cdf_inquire(nwout,
vn_qfact, dimlens)
427 ALLOCATE (
qfact(dimlens(1)), stat = ierror)
428 CALL cdf_inquire(nwout,
vn_presf, dimlens)
429 ALLOCATE (
presf(dimlens(1)), stat = ierror)
430 CALL cdf_inquire(nwout,
vn_phi, dimlens)
431 ALLOCATE (
phi(dimlens(1)), stat = ierror)
432 CALL cdf_inquire(nwout,
vn_chi, dimlens)
433 ALLOCATE (
chi(dimlens(1)), stat = ierror)
434 CALL cdf_inquire(nwout,
vn_phipf, dimlens)
435 ALLOCATE (
phipf(dimlens(1)), stat = ierror)
436 CALL cdf_inquire(nwout,
vn_chipf, dimlens)
437 ALLOCATE (
chipf(dimlens(1)), stat = ierror)
438 CALL cdf_inquire(nwout,
vn_jcuru, dimlens)
439 ALLOCATE (
jcuru(dimlens(1)), stat = ierror)
440 CALL cdf_inquire(nwout,
vn_jcurv, dimlens)
441 ALLOCATE (
jcurv(dimlens(1)), stat = ierror)
442 CALL cdf_inquire(nwout,
vn_iotah, dimlens)
443 ALLOCATE (
iotas(dimlens(1)), stat = ierror)
444 CALL cdf_inquire(nwout,
vn_mass, dimlens)
445 ALLOCATE (
mass(dimlens(1)), stat = ierror)
446 CALL cdf_inquire(nwout,
vn_presh, dimlens)
447 ALLOCATE (
pres(dimlens(1)), stat = ierror)
448 CALL cdf_inquire(nwout,
vn_betah, dimlens)
449 ALLOCATE (
beta_vol(dimlens(1)), stat = ierror)
450 CALL cdf_inquire(nwout,
vn_buco, dimlens)
451 ALLOCATE (
buco(dimlens(1)), stat = ierror)
452 CALL cdf_inquire(nwout,
vn_bvco, dimlens)
453 ALLOCATE (
bvco(dimlens(1)), stat = ierror)
454 CALL cdf_inquire(nwout,
vn_vp, dimlens)
455 ALLOCATE (
vp(dimlens(1)), stat = ierror)
456 CALL cdf_inquire(nwout,
vn_specw, dimlens)
457 ALLOCATE (
specw(dimlens(1)), stat = ierror)
458 CALL cdf_inquire(nwout,
vn_phip, dimlens)
459 ALLOCATE (
phip(dimlens(1)), stat = ierror)
460 CALL cdf_inquire(nwout,
vn_overr, dimlens)
461 ALLOCATE (
overr(dimlens(1)), stat = ierror)
463 CALL cdf_inquire(nwout,
vn_jdotb, dimlens)
464 ALLOCATE (
jdotb(dimlens(1)), stat = ierror)
465 CALL cdf_inquire(nwout,
vn_bgrv, dimlens)
466 ALLOCATE (
bdotgradv(dimlens(1)), stat = ierror)
468 CALL cdf_inquire(nwout,
vn_merc, dimlens)
469 ALLOCATE (
dmerc(dimlens(1)), stat = ierror)
470 CALL cdf_inquire(nwout,
vn_mshear, dimlens)
471 ALLOCATE (
dshear(dimlens(1)), stat = ierror)
472 CALL cdf_inquire(nwout,
vn_mwell, dimlens)
473 ALLOCATE (
dwell(dimlens(1)), stat = ierror)
474 CALL cdf_inquire(nwout,
vn_mcurr, dimlens)
475 ALLOCATE (
dcurr(dimlens(1)), stat = ierror)
476 CALL cdf_inquire(nwout,
vn_mgeo, dimlens)
477 ALLOCATE (
dgeod(dimlens(1)), stat = ierror)
478 CALL cdf_inquire(nwout,
vn_equif, dimlens)
479 ALLOCATE (
equif(dimlens(1)), stat = ierror)
481 CALL cdf_inquire(nwout,
vn_fsq, dimlens)
482 ALLOCATE (
fsqt(dimlens(1)), stat = ierror)
483 CALL cdf_inquire(nwout,
vn_wdot, dimlens)
484 ALLOCATE (
wdot(dimlens(1)), stat = ierror)
487 CALL cdf_inquire(nwout,
vn_extcur, dimlens)
488 ALLOCATE (
extcur(dimlens(1)), stat = ierror)
491 CALL cdf_inquire(nwout,
vn_curlab, dimlens)
492 ALLOCATE (
curlabel(dimlens(2)), stat = ierror)
494 CALL cdf_inquire(nwout,
vn_potvac, dimlens, ier = ierror)
495 IF (ierror == 0)
ALLOCATE (
potvac(1:dimlens(1)), stat = ierror)
499 CALL cdf_inquire(nwout,
vn_rmnc, dimlens)
500 ALLOCATE (
rmnc(dimlens(1),dimlens(2)), stat = ierror)
501 CALL cdf_inquire(nwout,
vn_zmns, dimlens)
502 ALLOCATE (
zmns(dimlens(1),dimlens(2)), stat = ierror)
503 CALL cdf_inquire(nwout,
vn_lmns, dimlens)
504 ALLOCATE (
lmns(dimlens(1),dimlens(2)), stat = ierror)
505 CALL cdf_inquire(nwout,
vn_gmnc, dimlens)
506 ALLOCATE (
gmnc(dimlens(1),dimlens(2)), stat = ierror)
507 CALL cdf_inquire(nwout,
vn_bmnc, dimlens)
508 ALLOCATE (
bmnc(dimlens(1),dimlens(2)), stat = ierror)
510 ALLOCATE (
bsubumnc(dimlens(1),dimlens(2)), stat = ierror)
512 ALLOCATE (
bsubvmnc(dimlens(1),dimlens(2)), stat = ierror)
514 ALLOCATE (
bsubsmns(dimlens(1),dimlens(2)), stat = ierror)
518 ALLOCATE (
bsupumnc(dimlens(1),dimlens(2)), stat = ierror)
520 ALLOCATE (
bsupvmnc(dimlens(1),dimlens(2)), stat = ierror)
522 IF (.NOT.
lasym)
GO TO 800
524 CALL cdf_inquire(nwout,
vn_rmns, dimlens)
525 ALLOCATE (
rmns(dimlens(1),dimlens(2)), stat = ierror)
526 CALL cdf_inquire(nwout,
vn_zmnc, dimlens)
527 ALLOCATE (
zmnc(dimlens(1),dimlens(2)), stat = ierror)
528 CALL cdf_inquire(nwout,
vn_lmnc, dimlens)
529 ALLOCATE (
lmnc(dimlens(1),dimlens(2)), stat = ierror)
530 CALL cdf_inquire(nwout,
vn_gmns, dimlens)
531 ALLOCATE (
gmns(dimlens(1),dimlens(2)), stat = ierror)
532 CALL cdf_inquire(nwout,
vn_bmns, dimlens)
533 ALLOCATE (
bmns(dimlens(1),dimlens(2)), stat = ierror)
535 ALLOCATE (
bsubumns(dimlens(1),dimlens(2)), stat = ierror)
537 ALLOCATE (
bsubvmns(dimlens(1),dimlens(2)), stat = ierror)
539 ALLOCATE (
bsubsmnc(dimlens(1),dimlens(2)), stat = ierror)
543 ALLOCATE (
bsupumns(dimlens(1),dimlens(2)), stat = ierror)
545 ALLOCATE (
bsupvmns(dimlens(1),dimlens(2)), stat = ierror)
563 CALL cdf_read(nwout,
vn_racc, raxis_cc)
564 CALL cdf_read(nwout,
vn_zacs, zaxis_cs)
566 IF (
SIZE(raxis_cc) .ne.
ntor+1)
567 1 stop
'WRONG SIZE(raxis_cc) in READ_WOUT_NC'
571 DEALLOCATE (raxis_cc, zaxis_cs, stat=ierror)
585 CALL cdf_read(nwout,
vn_racs, raxis_cs)
586 CALL cdf_read(nwout,
vn_zacc, zaxis_cc)
588 DEALLOCATE (raxis_cs, zaxis_cc, stat=ierror)
602 CALL cdf_read(nwout,
vn_am,
am)
603 CALL cdf_read(nwout,
vn_ac,
ac)
604 CALL cdf_read(nwout,
vn_ai,
ai)
633 CALL cdf_read(nwout,
vn_vp,
vp)
660 CALL cdf_close(nwout, ierr)
662 IF (.not.
ALLOCATED(
bsubumnc))
RETURN
675 IF (ierr. ne. 0) print *,
"in read_wout_nc ierr=",ierr
676 IF (ierror. ne. 0) print *,
"in read_wout_nc ierror=",ierror
678 END SUBROUTINE read_wout_nc
683 INTEGER,
INTENT(out) :: ierror
688 REAL(rprec) :: ohs, hs, shalf(ns), sfull(ns)
689 REAL(rprec),
DIMENSION(mnmax_nyq) :: bu1, bu0, bv1, bv0, t1, t2,
704 shalf(js) = sqrt(hs*(js-1.5_dp))
705 sfull(js) = sqrt(hs*(js-1))
710 IF (ierror .ne. 0)
RETURN
713 WHERE (mod(int(
xm_nyq),2) .EQ. 1)
714 t1 = 0.5_dp*(shalf(js+1)*
bsubsmns(:,js+1) +
715 & shalf(js) *
bsubsmns(:,js)) /sfull(js)
718 t2 = ohs*(bu1-bu0)*sfull(js)+0.25_dp*(bu0+bu1)/sfull(js)
721 t3 = ohs*(bv1-bv0)*sfull(js)+0.25_dp*(bv0+bv1)/sfull(js)
743 IF (.NOT.
lasym)
RETURN
749 WHERE (mod(int(
xm_nyq),2) .EQ. 1)
750 t1 = 0.5_dp*(shalf(js+1)*
bsubsmnc(:,js+1)
751 & + shalf(js) *
bsubsmnc(:,js)) / sfull(js)
754 t2 = ohs*(bu1-bu0)*sfull(js) + 0.25_dp*(bu0+bu1)/sfull(js)
757 t3 = ohs*(bv1-bv0)*sfull(js)+0.25_dp*(bv0+bv1)/sfull(js)
794 IF (
ALLOCATED(
overr))
DEALLOCATE (
overr, stat = istat(2))
799 3
pres,
beta_vol,
phip,
buco,
bvco,
phi,
vp,
jcuru,
am,
ac,
ai,
819 IF (any(istat .ne. 0))
THEN
821 stop
'Deallocation error in read_wout_deallocate'
827 1 bsupu, bsupv, jsupu, jsupv, lam)
833 REAL(rprec),
INTENT(in) :: s_in, u_in, v_in
834 REAL(rprec),
INTENT(out),
OPTIONAL :: gsqrt, bsupu, bsupv,
839 REAL(rprec),
PARAMETER :: c1p5 = 1.5_dp
840 INTEGER :: m, n, n1, mn, ipresent, jslo, jshi
841 REAL(rprec) :: hs1, wlo, whi, wlo_odd, whi_odd
842 REAL(rprec),
DIMENSION(mnmax_nyq) :: gmnc1, gmns1, bsupumnc1,
843 1 bsupumns1, bsupvmnc1, bsupvmns1, jsupumnc1, jsupumns1,
844 2 jsupvmnc1, jsupvmns1, wmins, wplus, lammns1, lammnc1
845 REAL(rprec) :: cosu, sinu, cosv, sinv, tcosmn, tsinmn, sgn
846 REAL(rprec) :: cosmu(0:mnyq), sinmu(0:mnyq),
848 LOGICAL :: lgsqrt, lbsupu, lbsupv, ljsupu, ljsupv, llam
864 IF (s_in.lt.
zero .or. s_in.gt.
one)
THEN
866 1
' In tosuvspace, s(flux) must be between 0 and 1'
872 1
' tosuvspace can only be called AFTER opening wout file!'
879 cosu = cos(u_in); sinu = sin(u_in)
880 cosv = cos(v_in); sinv = sin(v_in)
882 cosmu(0) = 1; sinmu(0) = 0
883 cosnv(0) = 1; sinnv(0) = 0
885 cosmu(m) = cosmu(m-1)*cosu - sinmu(m-1)*sinu
886 sinmu(m) = sinmu(m-1)*cosu + cosmu(m-1)*sinu
890 cosnv(n) = cosnv(n-1)*cosv - sinnv(n-1)*sinv
891 sinnv(n) = sinnv(n-1)*cosv + cosnv(n-1)*sinv
901 jslo = int(c1p5 + s_in/hs1)
903 wlo = (hs1*(jshi-c1p5) - s_in)/hs1
905 IF (jslo .eq.
ns)
THEN
909 wlo = 1+whi; whi = -whi
910 ELSE IF (jslo .eq. 1)
THEN
917 whi_odd = whi*sqrt(s_in/(hs1*(jshi-c1p5)))
918 IF (jslo .ne. 1)
THEN
919 wlo_odd = wlo*sqrt(s_in/(hs1*(jslo-c1p5)))
922 whi_odd = sqrt(s_in/(hs1*(jshi-c1p5)))
925 WHERE (mod(nint(
xm_nyq(:)),2) .eq. 0)
934 lgsqrt =
PRESENT(gsqrt)
936 gsqrt = 0 ; ipresent = ipresent+1
937 gmnc1 = wmins*
gmnc(:,jslo) + wplus*
gmnc(:,jshi)
939 1 gmns1 = wmins*
gmns(:,jslo) + wplus*
gmns(:,jshi)
941 lbsupu =
PRESENT(bsupu)
943 bsupu = 0 ; ipresent = ipresent+1
948 lbsupv =
PRESENT(bsupv)
950 bsupv = 0 ; ipresent = ipresent+1
957 lam = 0 ; ipresent = ipresent+1
958 lammns1 = wmins*
lmns(:,jslo) + wplus*
lmns(:,jshi)
960 1 lammnc1 = wmins*
lmnc(:,jslo) + wplus*
lmnc(:,jshi)
963 IF (ipresent .eq. 0)
GOTO 1000
971 n1 = abs(n); sgn = sign(1,n)
972 tcosmn = cosmu(m)*cosnv(n1) + sgn*sinmu(m)*sinnv(n1)
973 tsinmn = sinmu(m)*cosnv(n1) - sgn*cosmu(m)*sinnv(n1)
974 IF (lgsqrt) gsqrt = gsqrt + gmnc1(mn)*tcosmn
975 IF (lbsupu) bsupu = bsupu + bsupumnc1(mn)*tcosmn
976 IF (lbsupv) bsupv = bsupv + bsupvmnc1(mn)*tcosmn
977 IF (llam) lam = lam + lammns1(mn)*tsinmn
980 IF (.not.
lasym)
GOTO 1000
984 n1 = abs(n); sgn = sign(1,n)
985 tcosmn = cosmu(m)*cosnv(n1) + sgn*sinmu(m)*sinnv(n1)
986 tsinmn = sinmu(m)*cosnv(n1) - sgn*cosmu(m)*sinnv(n1)
987 IF (lgsqrt) gsqrt = gsqrt + gmns1(mn)*tsinmn
988 IF (lbsupu) bsupu = bsupu + bsupumns1(mn)*tsinmn
989 IF (lbsupv) bsupv = bsupv + bsupvmns1(mn)*tsinmn
990 IF (llam) lam = lam + lammnc1(mn)*tcosmn
1002 jslo = 1+int(s_in/hs1)
1004 IF (jslo .eq.
ns) jshi =
ns
1005 wlo = (hs1*(jshi-1) - s_in)/hs1
1010 whi_odd = whi*sqrt(s_in/(hs1*(jshi-1)))
1011 IF (jslo .ne. 1)
THEN
1012 wlo_odd = wlo*sqrt(s_in/(hs1*(jslo-1)))
1015 whi_odd = sqrt(s_in/(hs1*(jshi-1)))
1018 WHERE (mod(nint(
xm_nyq(:)),2) .eq. 0)
1027 ljsupu =
PRESENT(jsupu)
1029 IF (.not.lgsqrt) stop
'MUST compute gsqrt for jsupu'
1030 jsupu = 0 ; ipresent = ipresent+1
1036 ljsupv =
PRESENT(jsupv)
1038 IF (.not.lgsqrt) stop
'MUST compute gsqrt for jsupv'
1039 jsupv = 0 ; ipresent = ipresent+1
1045 IF (ipresent .eq. 0)
RETURN
1049 n1 = abs(n); sgn = sign(1,n)
1050 tcosmn = cosmu(m)*cosnv(n1) + sgn*sinmu(m)*sinnv(n1)
1051 IF (ljsupu) jsupu = jsupu + jsupumnc1(mn)*tcosmn
1052 IF (ljsupv) jsupv = jsupv + jsupvmnc1(mn)*tcosmn
1055 IF (.not.
lasym)
GOTO 2000
1059 n1 = abs(n); sgn = sign(1,n)
1060 tsinmn = sinmu(m)*cosnv(n1) - sgn*cosmu(m)*sinnv(n1)
1061 IF (ljsupu) jsupu = jsupu + jsupumns1(mn)*tsinmn
1062 IF (ljsupv) jsupv = jsupv + jsupvmns1(mn)*tsinmn
1067 IF (ljsupu) jsupu = jsupu/gsqrt
1068 IF (ljsupv) jsupv = jsupv/gsqrt
1077 INTEGER :: rcc, rss, zsc, zcs, rsc, rcs, zcc, zss
1078 INTEGER :: mpol1, mn, m, n, n1
1090 IF (.not.
lasym)
THEN
1100 rss = 2; rsc = 3; rcs = 4
1101 zcs = 2; zcc = 3; zss = 4
1111 IF (n .ne. 0) stop
'Allocation error in LoadRZL'
1115 m = nint(
xm(mn)); n = nint(
xn(mn))/
nfp; n1 = abs(n)
1140 IF (.not.
ALLOCATED(
chi))
ALLOCATE(
chi(1:
ns))
character(len= *), parameter vn_mgmode
character(len=30), dimension(:), allocatable curlabel
character(len=1) mgrid_mode
character(len= *), parameter vn_nextcur
Reading of wout VMEC output file.
character(len= *), parameter vn_bmns
subroutine readw_and_open(file_or_extension, ierr, iopen)
character(len= *), parameter vn_piota_type
character(len= *), parameter vn_bsupumns_sur
character(len= *), parameter vn_bsubvmns_sur
character(len= *), parameter vn_aspect
real(rprec), dimension(:,:), allocatable lmns
character(len= *), parameter vn_bsupumnc
character(len= *), parameter ln_ctor
character(len= *), parameter ln_tmod
character(len= *), parameter ln_vp
character(len= *), parameter vn_rmns
character(len= *), parameter ln_beta
character(len= *), parameter vn_radnod
character(len= *), parameter ln_bsupumns_sur
character(len= *), parameter ln_curlab
real(rprec), dimension(:), allocatable qfact
character(len= *), parameter ln_pbeta
real(rprec), dimension(:), allocatable y2thom
character(len= *), parameter vn_zacs
character(len= *), parameter ln_am_aux_f
real(rprec), dimension(:), allocatable fsqt
character(len= *), parameter vn_rbt1
character(len= *), parameter ln_maxmod_nyq
character(len= *), parameter vn_bsupumns
character(len= *), parameter vn_bsubsmns
character(len= *), parameter ln_extcur
character(len= *), parameter vn_pmass_type
character(len= *), parameter ln_zbs
character(len= *), parameter ln_fsq
character(len= *), parameter ln_amin
character(len= *), parameter ln_bsubvmns
character(len= *), parameter ln_ftolv
character(len= *), parameter ln_chipf
subroutine tosuvspace(s_in, u_in, v_in, gsqrt, bsupu, bsupv, jsupu, jsupv, lam)
real(rprec), dimension(:,:), allocatable bsubvmnc
character(len= *), parameter ln_maxit
character(len= *), parameter vn_lmnc
real(rprec), dimension(:,:), allocatable currvmns
real(rprec), dimension(:,:), allocatable zmns
character(len= *), parameter ln_bsubumns
character(len= *), parameter ln_jcurv
character(len= *), parameter vn_tbeta
character(len= *), parameter ln_bsubvmnc
character(len= *), parameter ln_presh
character(len= *), parameter ln_bsupumnc_sur
real(rprec), dimension(:), allocatable presf
real(rprec), dimension(:), allocatable rthom
real(rprec), dimension(:,:), allocatable bsubumnc
character(len= *), parameter ln_merc
real(rprec), dimension(:,:), allocatable bsupumnc
character(len= *), parameter ln_zacc
real(rprec), dimension(:), allocatable extcur
real(rprec), dimension(:,:), allocatable zaxis
character(len= *), parameter ln_thom
character(len= *), parameter ln_rmns
character(len= *), parameter vn_overr
character(len= *), parameter vn_ftolv
character(len= *), parameter ln_therm
character(len= *), parameter ln_bsubumnc_sur
real(rprec), dimension(:), allocatable pres
character(len= *), parameter vn_curlab
real(rprec), dimension(:), allocatable datathom
character(len= *), parameter vn_specw
character(len= *), parameter ln_lmns
real(rprec), dimension(:,:), allocatable rmnc
character(len= *), parameter vn_vp
real(rprec), dimension(:), allocatable am_aux_f
character(len= *), parameter vn_vol
character(len= *), parameter vn_magen
real(rprec), dimension(:), allocatable presmid
real(rprec), dimension(:,:), allocatable rmns
character(len= *), parameter ln_fsql
character(len= *), parameter vn_maxz
character(len= *), parameter vn_bsupvmns_sur
real(rprec), dimension(:), allocatable xn_nyq
character(len= *), parameter ln_racc
character(len= *), parameter vn_ah
character(len= *), parameter vn_abeta
real(rprec), dimension(:), allocatable buco
real(rprec), dimension(:,:), allocatable currumnc
character(len= *), parameter vn_ac
character(len= *), parameter vn_presf
real(rprec), dimension(:,:), allocatable gmnc
character(len= *), parameter vn_chipf
real(rprec), dimension(:,:), allocatable bsupvmnc
character(len= *), parameter vn_jcuru
character(len= *), parameter ln_recon
character(len= *), parameter ln_ai_aux_s
real(rprec), dimension(:), allocatable xn
character(len= *), parameter vn_free
character(len= *), parameter vn_version
character(len= *), parameter vn_buco
character(len= *), parameter vn_mse
character(len= *), parameter vn_phipf
character(len= *), parameter ln_bsubsmns
character(len= *), parameter ln_pmod
real(rprec), dimension(:), allocatable dcurr
real(rprec), dimension(:), allocatable equif
real(rprec), dimension(:), allocatable phipf
character(len= *), parameter vn_ac_aux_f
character(len= *), parameter ln_radnod
character(len= *), parameter vn_bgrv
real(rprec), dimension(:,:), allocatable bmns
character(len= *), parameter vn_mgrid
character(len= *), parameter ln_extension
character(len= *), parameter vn_zmnc
real(rprec), dimension(:), allocatable pknots
character(len= *), parameter ln_chi
character(len= *), parameter vn_iotah
character(len= *), parameter vn_lmns
real(rprec), dimension(:), allocatable dsiobt
real(rprec), dimension(:), allocatable rstark
character(len= *), parameter ln_rbs
real(rprec), dimension(:), allocatable phip
character(len= *), parameter ln_ai
real(rprec), dimension(:,:), allocatable currumns
real(rprec), dimension(:), allocatable mass
character(len= *), parameter vn_bvco
character(len= *), parameter vn_fsqr
character(len= *), parameter vn_zacc
character(len= *), parameter ln_mse
character(len= *), parameter vn_bsubvmnc_sur
character(len= *), parameter vn_gam
real(rprec), dimension(:), allocatable ai
character(len= *), parameter ln_ac_aux_f
real(rprec), dimension(:), allocatable xm_nyq
real(rprec), dimension(:), allocatable bvco
character(len= *), parameter vn_betah
character(len= *), parameter ln_fsqr
real(rprec), dimension(:), allocatable jcurv
character(len= *), parameter ln_bsupvmns_sur
character(len= *), parameter ln_maxr
character(len= *), parameter vn_bsupvmnc
real(rprec), dimension(:), allocatable ystark
character(len= *), parameter ln_mgeo
real(rprec), dimension(:), allocatable y2stark
real(rprec), dimension(:), allocatable jdotb
character(len= *), parameter vn_mshear
character(len= *), parameter ln_bgrv
character(len= *), parameter vn_merc
character(len= *), parameter vn_b0
real(rprec), dimension(:), allocatable xm
real(rprec), dimension(:), allocatable vp
character(len= *), parameter ln_zmnc
real(rprec), dimension(:), allocatable ythom
character(len= *), parameter ln_ac_aux_s
character(len= *), parameter vn_ai_aux_s
real(rprec), dimension(:), allocatable iotaf
character(len= *), parameter ln_free
subroutine compute_currents(ierror)
character(len= *), parameter ln_zbc
character(len= *), parameter vn_rbc
character(len= *), parameter vn_zbs
character(len= *), parameter ln_phip
character(len= *), parameter ln_bsupvmns
character(len= *), parameter ln_buco
character(len= *), parameter vn_gmnc
character(len= *), parameter ln_potvac
real(rprec), dimension(:), allocatable chipf
real(rprec), dimension(:), allocatable beta_vol
real(rprec), dimension(:), allocatable specw
character(len= *), parameter vn_bsupumnc_sur
character(len= *), parameter vn_qfact
real(rprec), dimension(:), allocatable dwell
character(len= *), parameter ln_bmns
character(len= *), parameter vn_maxr
character(len= *), parameter vn_bsubsmnc
real(rprec), dimension(:), allocatable jcuru
character(len= *), parameter vn_jcurv
real(rprec), dimension(:,:), allocatable bmnc
character(len= *), parameter vn_zmns
character(len= *), parameter vn_jdotb
character(len= *), parameter ln_bsupvmnc
real(rprec), dimension(:), allocatable ac
character(len= *), parameter ln_equif
character(len= *), parameter ln_am
real(rprec), dimension(:), allocatable ac_aux_f
character(len= *), parameter vn_am_aux_s
real(rprec), dimension(:,:), allocatable currvmnc
character(len= *), parameter vn_tmod_nyq
character(len= *), parameter ln_gmns
real(rprec), dimension(:), allocatable overr
character(len= *), parameter ln_version
character(len= *), parameter vn_mwell
character(len= *), parameter ln_jcuru
character(len= *), parameter ln_bvco
character(len= *), parameter vn_fsql
character(len= *), parameter ln_ac
character(len= *), parameter vn_amin
character(len= *), parameter vn_rmnc
real(rprec), dimension(:), allocatable rmid
character(len= *), parameter ln_bsupvmnc_sur
real(rprec), dimension(:), allocatable chi
character(len= *), parameter vn_mgeo
character(len= *), parameter vn_bsubumns
character(len= *), parameter vn_bsupvmns
character(len= *), parameter vn_mass
character(len= *), parameter vn_modb
character(len= *), parameter ln_vol
character(len= *), parameter ln_racs
character(len= *), parameter vn_gmns
real(rprec), dimension(:,:), allocatable zmnc
character(len= *), parameter vn_atuname
character(len= *), parameter vn_am
character(len= *), parameter vn_fsq
character(len= *), parameter ln_rbt1
character(len= *), parameter vn_am_aux_f
character(len= *), parameter vn_lar
character(len= *), parameter vn_rmaj
character(len= *), parameter ln_specw
real(rprec), dimension(:), allocatable ac_aux_s
character(len= *), parameter vn_bmnc
character(len= *), parameter vn_ai
character(len= *), parameter ln_phipf
character(len= *), parameter ln_polmod
character(len= *), parameter ln_bmnc
character(len= *), parameter ln_mcurr
character(len= *), parameter vn_racc
real(rprec), dimension(:,:), allocatable bsupvmns
character(len= *), parameter ln_bsupumns
character(len= *), parameter vn_pmod
character(len= *), parameter ln_iotah
character(len= *), parameter ln_error
character(len= *), parameter ln_piota_type
real(rprec), dimension(:), allocatable dgeod
character(len= *), parameter vn_wdot
character(len= *), parameter vn_bsubumns_sur
character(len= *), parameter vn_asym
character(len= *), parameter vn_extension
character(len= *), parameter ln_maxz
real(rprec), dimension(:), allocatable phi
character(len= *), parameter vn_tmod
character(len= *), parameter ln_mwell
real(rprec), dimension(:), allocatable am
character(len= *), parameter ln_mshear
real(rprec), dimension(:,:), allocatable bbc
character(len= *), parameter ln_fsqz
real(rprec), dimension(:), allocatable wdot
real(rprec), dimension(:), allocatable am_aux_s
character(len= *), parameter vn_beta
character(len= *), parameter vn_pcurr_type
character(len= *), parameter ln_rmaj
character(len= *), parameter ln_rmnc
real(rprec), dimension(:), allocatable shear
character(len= *), parameter ln_lar
character(len= *), parameter vn_bsubvmns
character(len= *), parameter ln_pmass_type
real(rprec), dimension(:), allocatable curmid
character(len= *), parameter vn_tormod
real(rprec), dimension(:), allocatable anglemse
real(rprec), dimension(:), allocatable iotas
character(len= *), parameter ln_magen
character(len= *), parameter ln_minr
character(len= *), parameter ln_presf
character(len= *), parameter ln_b0
character(len= *), parameter vn_equif
real(rprec), dimension(:), allocatable potvac
real(rprec), dimension(:), allocatable datastark
character(len= *), parameter ln_rbt0
real(rprec), dimension(:), allocatable ai_aux_f
character(len= *), parameter ln_fp
real(rprec), dimension(:,:), allocatable bsubsmnc
character input_extension
character(len= *), parameter vn_error
character(len= *), parameter vn_minr
character(len= *), parameter vn_extcur
character(len= *), parameter vn_pmod_nyq
character(len= *), parameter ln_mass
character(len= *), parameter vn_bsubumnc
real(rprec), dimension(:), allocatable qmid
character(len= *), parameter vn_presh
real(rprec), dimension(:,:), allocatable bsubumns
character(len= *), parameter vn_sgs
character(len= *), parameter ln_pmod_nyq
character(len= *), parameter vn_phi
character(len= *), parameter ln_rbc
character(len= *), parameter ln_aspect
character(len= *), parameter ln_bsubumns_sur
subroutine read_wout_deallocate
character(len= *), parameter vn_ctor
character(len= *), parameter ln_ai_aux_f
character(len= *), parameter vn_racs
character(len= *), parameter vn_pbeta
character(len= *), parameter ln_bsubvmnc_sur
character(len= *), parameter vn_chi
character(len= *), parameter vn_polmod
real(rprec), dimension(:,:), allocatable bsubvmns
real(rprec), dimension(:), allocatable sknots
character(len= *), parameter vn_mcurr
character(len= *), parameter ln_zmns
real(rprec), dimension(:,:), allocatable bsupumns
real(rprec), dimension(:), allocatable dshear
character(len= *), parameter ln_bsubumnc
character(len= *), parameter vn_maxmod_nyq
character(len= *), parameter vn_bsubvmnc
character(len= *), parameter ln_bsupumnc
character(len= *), parameter ln_sgs
character(len= *), parameter ln_wdot
character(len= *), parameter ln_pcurr_type
character(len= *), parameter vn_thom
character(len= *), parameter ln_tbeta
real(rprec), dimension(:), allocatable qmeas
character(len= *), parameter ln_maxmod
character(len= *), parameter vn_maxit
character(len= *), parameter vn_ac_aux_s
character(len= *), parameter vn_rbt0
character(len= *), parameter ln_lmnc
real(rprec), dimension(:), allocatable alfa
character(len= *), parameter ln_tmod_nyq
character(len= *), parameter vn_fp
character(len= *), parameter ln_bsubsmnc
character(len= *), parameter ln_mgrid
real(rprec), dimension(:), allocatable dmerc
character(len= *), parameter ln_iotaf
real(rprec), dimension(:,:), allocatable lmnc
character(len= *), parameter vn_zbc
character(len= *), parameter vn_potvac
character(len= *), parameter ln_am_aux_s
character(len= *), parameter ln_phi
character(len= *), parameter ln_asym
character(len= *), parameter ln_tormod
character(len= *), parameter ln_abeta
character(len= *), parameter ln_qfact
character(len= *), parameter vn_maxmod
real(rprec), dimension(:), allocatable ai_aux_s
character(len= *), parameter vn_iotaf
character(len= *), parameter ln_betah
real(rprec), dimension(:,:,:,:), allocatable rzl_local
real(rprec), dimension(:,:), allocatable raxis
real(rprec), dimension(:), allocatable bdotgradv
character(len= *), parameter vn_therm
character(len= *), parameter vn_rbs
character(len= *), parameter ln_gmnc
character(len= *), parameter vn_phip
character(len= *), parameter vn_fsqz
character(len= *), parameter vn_bsupvmnc_sur
character(len= *), parameter ln_modb
character(len= *), parameter ln_bsubvmns_sur
character(len= *), parameter ln_gam
real(rprec), dimension(:,:), allocatable gmns
real(rprec), dimension(:,:), allocatable bsubsmns
character(len= *), parameter ln_jdotb
character(len= *), parameter ln_zacs
character(len= *), parameter vn_ai_aux_f
character(len= *), parameter vn_bsubumnc_sur
fault-tolerant file opening routines
subroutine parse_extension(file_to_parse, file_or_extension, lnc)
Parse the first command-line argument into a filename.