1 SUBROUTINE write_dcon (rzl_array)
2 USE vmec_main, fpsi=>bvcof
3 USE vmec_params,
ONLY: ntmax, rcc, rsc, zsc, zcc, mscale, nscale
9 REAL(rprec),
DIMENSION(ns,0:ntor,0:mpol1,3*ntmax),
10 1
TARGET,
INTENT(in) :: rzl_array
15 REAL(rprec),
ALLOCATABLE,
DIMENSION(:,:,:) :: rmncc, rmnsc, zmnsc,
17 REAL(rprec) :: t1(0:mpol1)
18 CHARACTER*(256) :: dcon_file
20 t1 = nscale(0)*mscale(0:mpol1)
22 ALLOCATE (rmncc(ns,0:0,0:mpol1), zmnsc(ns,0:0,0:mpol1),
23 & lmnsc(ns,0:0,0:mpol1), stat=istat)
24 IF (istat .ne. 0) stop
'Allocation error in write_dcon'
26 rmncc(:,0,m) = rzl_array(:,0,m,rcc)*t1(m)
27 zmnsc(:,0,m) = rzl_array(:,0,m,zsc+ntmax)*t1(m)
28 lmnsc(:,0,m) = rzl_array(:,0,m,zsc+2*ntmax)*t1(m)
32 ALLOCATE (rmnsc(ns,0:0,0:mpol1), zmncc(ns,0:0,0:mpol1),
33 & lmncc(ns,0:0,0:mpol1), stat=istat)
34 IF (istat .ne. 0) stop
'Allocation error in write_dcon'
36 rmnsc(:,0,m) = rzl_array(:,0,m,rsc)*t1(m)
37 zmncc(:,0,m) = rzl_array(:,0,m,zcc+ntmax)*t1(m)
38 lmncc(:,0,m) = rzl_array(:,0,m,zcc+2*ntmax)*t1(m)
45 dcon_file =
"dcon_" // trim(input_extension) //
".txt"
46 OPEN (unit=51,file=dcon_file,form=
'FORMATTED',iostat=istat)
47 IF (istat .ne. 0) stop
'Error writing dcon output file'
49 IF (mnmax .ne. mpol) stop
'THIS IS NOT AXISYMMETRIC!'
54 WRITE (51, *) rmncc(1:ns,0,0:mpol1)
55 WRITE (51, *) zmnsc(1:ns,0,0:mpol1)
56 WRITE (51, *) lmnsc(1:ns,0,0:mpol1)
59 WRITE (51, *) rmnsc(1:ns,0,0:mpol1)
60 WRITE (51, *) zmncc(1:ns,0,0:mpol1)
61 WRITE (51, *) lmncc(1:ns,0,0:mpol1)
63 WRITE (51, *) chi(1:ns)
64 WRITE (51, *) fpsi(1:ns)
65 WRITE (51, *) presf(1:ns)/mu0
66 WRITE (51, *) 1/iotaf(1:ns)
70 DEALLOCATE (rmncc, zmnsc, lmnsc, stat=istat)
71 IF (lasym)
DEALLOCATE (rmnsc, zmncc, lmncc, stat=istat)
73 END SUBROUTINE write_dcon