VMEC 8.52
3D Equilibrium solver with nested flux surfaces.
Loading...
Searching...
No Matches
eqfor.f90
Go to the documentation of this file.
1
4
15SUBROUTINE eqfor(br, bz, bsubu, bsubv, tau, rzl_array, ier_flag)
16
17 USE vmec_main
18 USE vmec_params
19 USE realspace
20 USE vforces, r12 => armn_o, bsupu => crmn_e, bsupv => czmn_e, &
21 gsqrt => azmn_o, bsq => bzmn_o, izeta => azmn_e, &
22 brho => bzmn_e, bphi => czmn_o, curtheta => brmn_e
23 USE vacmod, only: bphiv, bsqvac, bsubvvac
24 USE vmec_io
25 USE mgrid_mod
26 USE stel_constants, ONLY: pi
27
28 use dbgout
29
30 IMPLICIT NONE
31
32 INTEGER :: ier_flag
33 REAL(rprec), DIMENSION(ns,nznt,0:1), INTENT(in) :: bsubu, bsubv
34 REAL(rprec), DIMENSION(nrzt), INTENT(out) :: br, bz
35 REAL(rprec), DIMENSION(nrzt), INTENT(out) :: tau
36 REAL(rprec), DIMENSION(ns,0:ntor,0:mpol1,3*ntmax), TARGET, INTENT(in) :: rzl_array
37
38 INTEGER :: i, icount, itheta, js, l, loff, &
39 lpi, lt, n, n1, noff, &
40 iv, iu, lk, nplanes
41 REAL(rprec), DIMENSION(:), POINTER :: rmags, zmags, rmaga, zmaga
42 REAL(rprec), DIMENSION(:,:,:), POINTER :: rmncc,zmnsc
43 REAL(rprec), DIMENSION(ns) :: phi1, chi1, jPS2
44 REAL(rprec) :: modb(nznt)
45 REAL(rprec), DIMENSION(:), ALLOCATABLE :: &
46 btor_vac, btor1, dbtor, phat, t12u, guu_1u, surf_area, &
47 r3v, redge, rbps1u, bpol2vac, phipf_loc
48 REAL(rprec) :: aminr1, aminr2in, anorm, &
49 aspectratio, betai, betstr, scaling_ratio, &
50 bminz2, bminz2in, musubi, &
51 cur0, &
52 delphid_exact, delta1, delta2, delta3, lambda, &
53 er, es, fac, facnorm, factor, fgeo, &
54 flao, fpsi0, pavg, &
55 rcen, rcenin, rgeo, &
56 rlao, rshaf, rshaf1, rshaf2, s11, s12, &
57 s13, s2, s3, sigr0, sigr1, sigz1, smaleli, &
58 sumbpol, sumbtot, sumbtor, sump, &
59 sump2, sump20, t1, tz, jpar_perp=0, jparps_perp=0, &
60 toroidal_flux, vnorm, xmax, &
61 xmida, xmidb, xmin, rzmax, rzmin, zxmax, zxmin, &
62 zmax, zmin, yr1u, yz1u, waist(2), height(2)
63 REAL(rprec) d_of_kappa, loc_jpar_perp, loc_jparPs_perp
64 REAL(rprec), DIMENSION(:), ALLOCATABLE :: rax_symm, zax_symm, rax_asym, zax_asym
65
66
67 ! POINTER ASSOCIATIONS
68 rmags => rzl_array(1,:,0,rcc)
69 zmags => rzl_array(1,:,0,zcs+ntmax)
70 rmncc => rzl_array(:,:,:,rcc)
71 zmnsc => rzl_array(:,:,:,zsc+ntmax)
72 IF (lasym) THEN
73 rmaga => rzl_array(1,:,0,rcs)
74 zmaga => rzl_array(1,:,0,zcc+ntmax)
75 END IF
76
77 ! crmn_o == bss on half grid
78 ! r12 rs zs ru12 zu12 bsubs bsupu bsupv br bphi bz
79 CALL bss (r12, bzmn, brmn, azmn, armn, crmn_o, bsupu, bsupv, br, bphi, bz)
80
81 ! STORE EDGE VALUES OF B-FIELD
82 IF (lfreeb .and. ivac.gt.1) THEN
83 IF (ALLOCATED(bredge)) DEALLOCATE (bredge, bpedge, bzedge)
84 ALLOCATE (bredge(2*nznt), bpedge(2*nznt), bzedge(2*nznt), stat=i)
85 IF (i .ne. 0) stop 'Error in EQFOR allocating bredge'
86 DO iv = 1,nzeta
87 DO iu = 1,ntheta3
88 lk = iv + nzeta*(iu-1)
89 n1 = ns*lk ! indices radially on LCFS
90 bredge(lk) = 1.5_dp*br(n1) - cp5*br(n1-1)
91 bpedge(lk) = 1.5_dp*bphi(n1) - cp5*bphi(n1-1)
92 bzedge(lk) = 1.5_dp*bz(n1) - cp5*bz(n1-1)
93 END DO
94 END DO
95 END IF
96
97 ! NOTE: JXBFORCE ROUTINE MUST BE CALLED TO COMPUTE IZETA, JDOTB
98 ! ON OUTPUT, J, IZETA, JDOTB ARE IN MKS UNITS (1/MU0 FACTOR)
99 !
100 ! CAUTION: THIS CALL WILL WRITE OVER br, bz
101 ! bsupu, bsupv, bsubu, bsubv, bsubsh, bsubsu, bsubsv
102 CALL jxbforce (bsupu, bsupv, bsubu, bsubv, crmn_o, rcon, zcon, &
103 gsqrt, bsq, curtheta, izeta, brho, ier_flag)
104 ! gsqrt, bsq, itheta, izeta, brho, ier_flag
105
106
107
108
109
110
111
112
113 ! HALF-MESH VOLUME-AVERAGED BETA
114 tau(1) = 0
115 tau(2:nrzt) = signgs*wint(2:nrzt)*gsqrt(2:nrzt) ! re-use tau for ready-to-integrate Jacobian
116 DO i = 2, ns
117 s2 = sum( bsq(i:nrzt:ns)*tau(i:nrzt:ns))/vp(i) - pres(i)
118 beta_vol(i) = pres(i)/s2
119
120 ! hijack loop to also compute overr ???
121 overr(i) = sum(tau(i:nrzt:ns)/r12(i:nrzt:ns)) / vp(i)
122 END DO
123
124 ! extrapolate surface-averaged beta profile to magnetic axis
125 betaxis = c1p5*beta_vol(2) - cp5*beta_vol(3)
126
127 WRITE (nthreed, 5)
1285 FORMAT(/,' NOTE: S=normalized toroidal flux (0 - 1)',/, &
129 ' U=poloidal angle (0 - 2*pi)',/, &
130 ' V=geometric toroidal angle (0 - 2*pi)',/, &
131 ' <RADIAL FORCE> = d(Ipol)/dPHI', &
132 ' - IOTA*d(Itor)/dPHI - dp/dPHI * d(VOL)/dPHI',/, &
133 ' = d(VOL)/dPHI*[<JSUPU>', &
134 ' - IOTA*<JSUPV> - SIGN(JAC)*dp/dPHI]',/, &
135 ' (NORMED TO SUM OF INDIVIDUAL TERMS)',//, &
136 ' S <RADIAL TOROIDAL IOTA ', &
137 ' <JSUPU> <JSUPV> d(VOL)/', &
138 ' d(PRES)/ <M> PRESF <BSUBU> <BSUBV>', &
139 ' <J.B> <B.B>',/, &
140 ' FORCE> FLUX ', &
141 ' d(PHI) ', &
142 ' d(PHI) ',/,148('-'),/)
143
144 ALLOCATE (phipf_loc(ns))
145
146 ! interpolate pressure and phip onto full grid
147 presf(1) = c1p5*pres(2) - cp5*pres(3)
148 phipf_loc(1) = twopi*signgs*(c1p5*phip(2) - cp5*phip(3))
149 DO i = 2,ns1
150 presf(i) = cp5 * (pres(i) + pres(i+1))
151 phipf_loc(i) = cp5*twopi*signgs*(phip(i) + phip(i+1))
152 END DO
153 presf(ns) = c1p5*pres(ns) - cp5*pres(ns1)
154 phipf_loc(ns) = twopi*signgs*(c1p5*phip(ns) - cp5*phip(ns1))
155
156 ! integrate flux differentials to get flux profiles
157 phi1(1) = zero
158 chi1(1) = zero
159 DO i = 2, ns
160 phi1(i) = phi1(i-1) + hs*phip(i)
161 chi1(i) = chi1(i-1) + hs*(phip(i)*iotas(i))
162 END DO
163 chi = twopi*chi1
164
165
166
167
168 CALL calc_fbal(bsubu, bsubv)
169
170 ! NOTE: jcuru, jcurv on FULL radial mesh coming out of calc_fbal
171 ! They are local (surface-averaged) current densities (NOT integrated in s)
172 ! jcurX = (dV/ds)/twopi**2 <JsupX> for X=u,v
173 bucof(1) = 0
174 bvcof(1) = c1p5*bvco(2) - cp5*bvco(3)
175 DO i = 2,ns1
176 equif(i) = equif(i)*vpphi(i) / &
177 ( abs(jcurv(i)*chipf(i)) &
178 + abs(jcuru(i)*phipf(i)) &
179 + abs(presgrad(i)*vpphi(i)))
180 bucof(i) = cp5*(buco(i) + buco(i+1))
181 bvcof(i) = cp5*(bvco(i) + bvco(i+1))
182 END DO
183 bucof(ns) = c1p5*buco(ns) - cp5*buco(ns1)
184 bvcof(ns) = c1p5*bvco(ns) - cp5*bvco(ns1)
185
186
187 ! extrapolate full-grid quantites to axis and LCFS
188 equif(1) = c2p0*equif(2) - equif(3)
189 equif(ns) = c2p0*equif(ns1) - equif(ns1-1)
190
191 jcurv(1) = c2p0*jcurv(2) - jcurv(3)
192 jcurv(ns) = c2p0*jcurv(ns1) - jcurv(ns1-1)
193
194 jcuru(1) = c2p0*jcuru(2) - jcuru(3)
195 jcuru(ns) = c2p0*jcuru(ns1) - jcuru(ns1-1)
196
197 presgrad(1) = c2p0*presgrad(2) - presgrad(3)
198 presgrad(ns) = c2p0*presgrad(ns1) - presgrad(ns1-1)
199
200 vpphi(1) = c2p0*vpphi(2) - vpphi(3)
201 vpphi(ns) = c2p0*vpphi(ns1) - vpphi(ns1-1)
202
203
204
205
206 ! NOTE: phipf = phipf_loc/(twopi), phipf_loc ACTUAL (twopi factor) Toroidal flux derivative
207 ! SPH/JDH (060211): remove twopi factors from <JSUPU,V> (agree with output in JXBOUT file)
208 fac = twopi*signgs
209 DO js = 1, ns
210 es = (js - 1)*hs ! full-grid s value
211 cur0 = fac*vpphi(js)*twopi ! == dV/ds = dV/dPHI * d(PHI/ds) (V=actual volume)
212 WRITE (nthreed, 30) &
213 es, & ! S
214 equif(js), & ! <RADIAL FORCE>
215 fac*phi1(js), & ! TOROIDAL FLUX
216 iotaf(js), & ! IOTA
217 jcuru(js)/vpphi(js)/mu0, & ! <JSUPU>
218 jcurv(js)/vpphi(js)/mu0, & ! <JSUPV>
219 cur0/phipf_loc(js), & ! d(VOL)/d(PHI)
220 presgrad(js)/phipf_loc(js)/mu0, & ! d(PRES)/d(PHI)
221 specw(js), & ! <M>
222 presf(js)/mu0, & ! PRESF
223 bucof(js), & ! <BSUBU>
224 bvcof(js), & ! <BSUBV>
225 jdotb(js), & ! <J.B>
226 bdotb(js) ! <B.B>
227 END DO
22830 FORMAT(1p,2e10.2,2e12.4,4e11.3,0p,f7.3,1p,5e11.3)
229
230 if (open_dbg_context("threed1_firstTable", id=0)) then
231
232 call add_real_1d("beta_vol", ns-1, beta_vol(2:ns))
233 call add_real_1d("overr", ns-1, overr(2:ns))
234
235 call add_real("betaxis", betaxis)
236
237 call add_real_1d("presf", ns, presf)
238 call add_real_1d("phipf_loc", ns, phipf_loc)
239 call add_real_1d("phi1", ns, phi1)
240 call add_real_1d("chi1", ns, chi1)
241 call add_real_1d("chi", ns, chi)
242
243 call add_real_1d("iotaf", ns, iotaf)
244
245 call add_real_1d("specw", ns, specw)
246
247 call add_real_1d("equif", ns, equif)
248
249 call add_real_1d("bucof", ns, bucof)
250 call add_real_1d("bvcof", ns, bvcof)
251
252 call add_real_1d("jcurv", ns, jcurv)
253 call add_real_1d("jcuru", ns, jcuru)
254
255 call add_real_1d("presgrad", ns, presgrad)
256 call add_real_1d("vpphi", ns, vpphi)
257
258 call add_real_1d("jdotb", ns, jdotb)
259 call add_real_1d("bdotb", ns, bdotb)
260
261 call close_dbg_out()
262 end if
263
264 DEALLOCATE (phipf_loc)
265
266
267
268
269
270
271
272
273 ! MAKE SURE WOUT FILE DOES NOT REQUIRE ANY STUFF COMPUTED BELOW....
274
275 ! Calculate mean (toroidally averaged) poloidal cross section area & toroidal flux
276 anorm = twopi*hs
277 vnorm = twopi*anorm
278 toroidal_flux = anorm * sum(bsupv(2:nrzt)*tau(2:nrzt))
279
280 ! Calculate poloidal circumference and normal surface area and aspect ratio
281 ! Normal is | dr/du X dr/dv | = SQRT [R**2 guu + (RuZv - RvZu)**2]
282 ALLOCATE (guu_1u(nznt), surf_area(nznt))
283 guu_1u(:nznt) = ru0(ns:nrzt:ns)*ru0(ns:nrzt:ns) + zu0(ns:nrzt:ns)*zu0(ns:nrzt:ns)
284
285 surf_area(:nznt) = wint(ns:nrzt:ns)*sqrt(guu_1u(:nznt)) ! re-use surf_area to compute circumference
286 circum_p = twopi*sum(surf_area(:nznt))
287
288 surf_area(:nznt) = wint(ns:nrzt:ns)*sqrt( &
289 + (r1(ns:nrzt:ns,0) + r1(ns:nrzt:ns,1))**2 * guu_1u(:nznt) &
290 +((rv(ns:nrzt:ns,0) + rv(ns:nrzt:ns,1))*zu0(ns:nrzt:ns) &
291 - (zv(ns:nrzt:ns,0) + zv(ns:nrzt:ns,1))*ru0(ns:nrzt:ns))**2 )
292 surf_area_p = twopi**2*sum(surf_area(:nznt))
293 DEALLOCATE (guu_1u)
294
295 aspect = aspectratio()
296
297 ! Also, estimate mean elongation of plasma from the following relations
298 ! for an axisymmetric torus with elliptical cross section and semi-axes
299 ! a and a * kappa (kappa >= 1)
300 !
301 ! surf_area _p = 2*pi*R * 2*pi*a ctwiddle(kappa_p)
302 ! volume_p = 2*pi*R * pi*a ** 2 * kappa_p
303 ! cross_area _p = pi*a ** 2 * kappa_p
304 !
305 ! The cirumference of an ellipse of semi-axes a and a * kappa_p is
306 ! 2 * pi * a ctwiddle(kappa_p)
307 ! The exact form for ctwiddle is 4 E(1 - kappa_p^2) / (2 pi), where
308 ! E is the complete elliptic integral of the second kind
309 ! (with parameter argument m, not modulus argument k)
310 !
311 ! The coding below implements an approximate inverse of the function
312 ! d(kappa) = ctwiddle(kappa) / sqrt(kappa)
313 ! The approximate inverse is
314 ! kappa = 1 + (pi^2/8) * (d^2+sqrt(d^4-1)-1)
315 ! Note that the variable aminor_p, for an elliptic cross section,
316 ! would be a * sqrt(kappa)
317 d_of_kappa = surf_area_p * aminor_p / ( 2 * volume_p)
318 kappa_p = 1 + (pi * pi / 8) * (d_of_kappa ** 2 + sqrt(abs(d_of_kappa ** 4 - 1)) -1)
319
320 ! TODO: is this used anywhere or directly overwritten below?
321 aminr1 = 2*volume_p/surf_area_p
322
323 ! OUTPUT BETAS, INDUCTANCES, SAFETY FACTORS, ETC.
324 ! (EXTRACTED FROM FQ-CODE, 9-10-92)
325 !
326 ! b poloidals (cylindrical estimates)
327 rcen = cp5*(router + rinner) !geometric center
328 n = 0
329 n1 = n + 1
330 rcenin = dot_product(rmncc(ns,n1,:mpol1+1:2), mscale(:mpol1:2)*nscale(n)) ! TODO: used anywhere?
331
332 l = (mpol1+1)/2
333 ALLOCATE (t12u(l))
334 t12u(:l) = mscale(1:mpol1:2)*nscale(n)
335 aminr2in = dot_product(rmncc(ns,n1,2:mpol1+1:2),t12u(:l)) ! TODO: used anywhere?
336 bminz2in = dot_product(zmnsc(ns,n1,2:mpol1+1:2),t12u(:l)) ! TODO: used anywhere?
337 bminz2 = dot_product(zmnsc(ns,n1,2:mpol1+1:2),t12u(:l)) ! TODO: used anywhere?
338 DEALLOCATE (t12u)
339
340 ! vol av minor radius
341 aminr1 = sqrt(c2p0*volume_p/(twopi*twopi*r00))
342
343 ! cylindrical estimates for beta poloidal
344 sump = vnorm*sum(vp(2:ns)*pres(2:ns))
345 pavg = sump/volume_p
346 factor = 2*pavg
347
348 ! delphid_exact = Integral[ (Bvac - B) * dSphi ]
349 ! rshaf [= RT in Eq.(12), Phys Fluids B 5 (1993) 3119]
350 !
351 ! Note: tau = |gsqrt|*wint
352 ALLOCATE (btor_vac(nznt), btor1(nznt), dbtor(nznt), phat(nznt), redge(nznt))
353 ! Eq. 20 in Shafranov
354 delphid_exact = zero
355 musubi = zero
356 rshaf1 = zero
357 rshaf2 = zero
358 DO js = 2, ns
359 btor_vac(:nznt) = rbtor/r12(js:nrzt:ns) ! TODO: assumes B_tor ~ 1/R ???
360 delphid_exact = delphid_exact + sum( (btor_vac(:nznt)/r12(js:nrzt:ns) - bsupv(js:nrzt:ns))*tau(js:nrzt:ns) )
361
362 btor1(:nznt) = r12(js:nrzt:ns)*bsupv(js:nrzt:ns)
363 dbtor(:nznt) = btor1(:nznt)**2 - btor_vac(:nznt)**2
364 musubi = musubi - sum(dbtor(:nznt)*tau(js:nrzt:ns))
365
366 ! phat is temporarily re-used for something else...
367 phat(:nznt) = bsq(js:nrzt:ns) - cp5*btor_vac(:nznt)**2
368 phat(:nznt) = (phat(:nznt) - dbtor(:nznt))*tau(js:nrzt:ns)
369 rshaf1 = rshaf1 + sum(phat(:nznt))
370 rshaf2 = rshaf2 + sum(phat(:nznt)/r12(js:nrzt:ns))
371 END DO
372 delphid_exact = anorm*delphid_exact
373 rshaf = rshaf1/rshaf2
374 fpsi0 = c1p5*bvco(2) - cp5*bvco(3)
375 b0 = fpsi0/r00
376
377 redge(:nznt) = r1(ns:nrzt:ns,0) + r1(ns:nrzt:ns,1)
378 IF (lfreeb .and. ivac.gt.1) THEN
379 phat = bsqvac - cp5*(bsubvvac/redge)**2
380 ELSE
381 phat = c1p5*bsq(ns:nrzt:ns) - cp5*bsq(ns-1:nrzt:ns) &
382 - cp5*(rbtor/redge(:))**2
383 END IF
384
385 DEALLOCATE (btor_vac, btor1, dbtor)
386
387 rmax_surf = maxval(r1(ns:nrzt:ns,0)+r1(ns:nrzt:ns,1))
388 rmin_surf = minval(r1(ns:nrzt:ns,0)+r1(ns:nrzt:ns,1))
389 zmax_surf = maxval(abs(z1(ns:nrzt:ns,0)+z1(ns:nrzt:ns,1)))
390
391 DO js = 2, ns
392 modb(:nznt) = sqrt(c2p0*(bsq(js:nrzt:ns) - pres(js)))
393 CALL bextrema (modb, bmin(1,js), bmax(1,js), nzeta, ntheta2)
394 END DO
395
396 WRITE (nthreed, 75) bmin(1,ns), bmax(1,ns), bmin(ntheta2,ns), bmax(ntheta2,ns)
39775 FORMAT(/' Magnetic field modulation (averaged over toroidal angle)',/, &
398 1x,71('-')/,' BMIN(u=0) = ',f14.6/ &
399 ' BMAX(u=0) = ',f14.6/' BMIN(u=pi) = ', &
400 f14.6/' BMAX(u=pi) = ',f14.6/)
401
402 ! output geometrical, |B| quantities
403 CALL elongation (r1, z1, waist, height)
404
405 sumbtot = 2*(vnorm*sum(bsq(2:nrzt)*tau(2:nrzt)) - sump)
406 sumbtor = vnorm*sum(tau(2:nrzt)*(r12(2:nrzt)*bsupv(2:nrzt))**2)
407 sumbpol = sumbtot - sumbtor
408 betapol = 2*sump/sumbpol
409 sump20 = 2*sump
410 sump2 = sum(pres(2:ns)*pres(2:ns)*vp(2:ns)*vnorm)
411 betatot = sump20/sumbtot
412 betator = sump20/sumbtor
413 volavgb = sqrt(abs(sumbtot/volume_p))
414 ionlarmor = 0.0032_dp/volavgb ! TODO: which ion is assumed here ?
415
416 jps2(2:ns1) = jpar2(2:ns1) - jdotb(2:ns1)**2/bdotb(2:ns1)
417 jpar_perp = sum( jpar2(2:ns1)*(vp(2:ns1) + vp(3:ns)))
418 jparps_perp = sum( jps2(2:ns1)*(vp(2:ns1) + vp(3:ns)))
419 s2 = sum(jperp2(2:ns1)*(vp(2:ns1) + vp(3:ns)))
420 IF (s2 .ne. zero) THEN
421 jpar_perp = jpar_perp /s2
422 jparps_perp = jparps_perp/s2
423 END IF
424
425 IF (ntor .gt. 1) THEN ! lthreed ?? ntor>1 means ntor .ge. 2 --> ntor=1 is already non-axisymmetric!
426 WRITE (nthreed, 80) aspect, kappa_p, volume_p, cross_area_p, &
428 rmax_surf, zmax_surf, waist(1), height(1), waist(2), height(2)
429 ELSE ! axisymmetric
430 WRITE (nthreed, 80) aspect, kappa_p, volume_p, cross_area_p, &
432 rmax_surf, zmax_surf, waist(1), height(1)
433 END IF
43480 FORMAT(/,' Geometric and Magnetic Quantities',/,1x,71('-')/, &
435 ' Aspect Ratio = ',f14.6, / &
436 ' Mean Elongation = ',f14.6, / &
437 ' Plasma Volume = ',f14.6,' [M**3]',/ &
438 ' Cross Sectional Area = ',f14.6,' [M**2]',/ &
439 ' Normal Surface Area = ',f14.6,' [M**2]',/ &
440 ' Poloidal Circumference= ',f14.6,' [M]',/ &
441 ' Major Radius = ',f14.6,' [M]', &
442 ' (from Volume and Cross Section)',/ &
443 ' Minor Radius = ',f14.6,' [M]', &
444 ' (from Cross Section)',/ &
445 ' Minimum (inboard) R = ',f14.6,' [M]',/ &
446 ' Maximum (outboard) R = ',f14.6,' [M]',/ &
447 ' Maximum height Z = ',f14.6,' [M]',/ &
448 ' Waist (v = 0) in R = ',f14.6,' [M]',/ &
449 ' Full Height(v = 0) = ',f14.6,' [M]',:,/ &
450 ' Waist (v = pi) in R = ',f14.6,' [M]',:,/ &
451 ' Full Height(v = pi) = ',f14.6,' [M]')
452 ! TODO: : means optional in above format?
453
454 WRITE (nthreed, 85) toroidal_flux, 1.e-6_dp/mu0 * ctor, rbtor, &
455 rbtor0, volavgb, ionlarmor, jpar_perp, jparps_perp
45685 FORMAT(' Toroidal Flux = ',f14.6,' [Wb]',/ &
457 ' Toroidal Current = ',f14.6,' [MA]',/ &
458 ' RBtor(s=1) = ',f14.6,' [T-m]',/ &
459 ' RBtor(s=0) = ',f14.6,' [T-m]',/ &
460 ' Volume Average B = ',f14.6,' [T]',/ &
461 ' Ion Larmor Radius = ',f14.6,' [M] X Ti(keV)**0.5',/ &
462 ' <J||**2>/<J-perp**2> = ',f14.6,' (Vol. Averaged)',/ &
463 ' <JPS**2>/<J-perp**2> = ',f14.6,' (Vol. Averaged)',/ )
464
465 WRITE (nthreed, 90)
46690 FORMAT(/,71('-'),/,&
467 ' MORE GEOMETRIC AND PHYSICS QUANTITIES',/,71('-'),/,&
468 ' Toroidal Plane: Phi = 0',/, &
469 5x,'j',3x,'psi-psiaxis',9x,'a [M]',3x,'ellipticity',3x,'indentation',&
470 7x,'d-shape',4x,'rel. shift',6x,'<J||**2>/',4x,'<JPS**2>/',/, &
471 95x, '<J-perp**2>',3x,'<J-perp**2>'/, &
472 ' -----',8(2x,12('-')))
473
474 fac = twopi*hs*signgs
475 psi(1) = zero
476 ALLOCATE (r3v(ns-1))
477 r3v(:ns-1) = fac*phip(2:ns)*iotas(2:ns)
478 DO i = 1, ns - 1
479 psi(1+i) = psi(i) + r3v(i)
480 END DO
481 DEALLOCATE (r3v)
482
483 ! initialize to known conents for dbgout of axisymmetric run
484 ygeo = 0.0_dp
485 yinden = 0.0_dp
486 yellip = 0.0_dp
487 ytrian = 0.0_dp
488 yshift = 0.0_dp
489
490 ! nphi-plane, noff = 1,....,nzeta
491 planes: DO nplanes = 1, 2
492
493 IF (nplanes .eq. 1) THEN
494 ! nphi=0
495 noff = 1
496 ELSE
497 IF (nzeta .eq. 1) EXIT
498 WRITE (nthreed, 95)
499 ! nphi=180
500 noff = 1+nzeta/2
501 END IF
502
503 ygeo(nplanes, 1) = zero
504 DO js = 2, ns
505
506 zmin = huge(zmin)
507 zmax = -huge(zmax)
508 xmin = huge(xmin)
509 xmax = -huge(xmax)
510
511 rzmax = zero
512
513 ! Theta = 0 to pi in upper half of X-Z plane
514 DO icount = 1,2 ! TODO: why second loop over toroidal offset ?
515 ! nphi-plane, n1 = noff,...,nzeta
516 n1 = noff
517 IF (icount .eq. 2) then
518 ! (twopi-v), reflected plane
519 n1 = mod(nzeta-(noff-1),nzeta)+1
520 end if
521 loff = js + ns*(n1-1)
522
523 t1 = one
524 IF (icount .eq. 2) t1 = -one
525
526 DO itheta = 1,ntheta2
527 yr1u = r1(loff,0) + sqrts(js)*r1(loff,1)
528 yz1u = z1(loff,0) + sqrts(js)*z1(loff,1)
529 yz1u = t1*yz1u
530
531 IF (yz1u .ge. zmax) THEN
532 zmax = abs(yz1u)
533 rzmax = yr1u
534 ELSEIF (yz1u .le. zmin) THEN
535 zmin = yz1u
536 rzmin = yr1u
537 END IF
538
539 IF (yr1u .ge. xmax) THEN
540 xmax = yr1u
541 zxmax = yz1u
542 ELSEIF (yr1u .le. xmin) THEN
543 xmin = yr1u
544 zxmin = yz1u
545 END IF
546
547 loff = loff + ns*nzeta
548 END DO ! itheta
549 END DO ! icount
550
551 ! ----------
552
553 ! theta=180
554 lpi = ns*((noff-1) + nzeta*(ntheta2-1))
555
556 ! theta=0
557 lt = ns*(noff-1)
558
559 xmida = r1(js+lpi,0) + sqrts(js)*r1(js+lpi,1)
560 xmidb = r1(js+lt,0) + sqrts(js)*r1(js+lt,1)
561
562 ! ----------
563
564 ! Geometric major radius
565 rgeo = cp5*(xmidb + xmida)
566
567 ! Geometric minor radius
568 ygeo(nplanes, js) = cp5*(xmidb - xmida)
569
570 ! Geometric indentation
571 yinden(nplanes, js) = (xmida - xmin)/(xmax - xmin)
572
573 ! Geometric ellipticity
574 yellip(nplanes, js) = ( zmax - zmin)/(xmax - xmin)
575
576 ! Geometric triangularity
577 ytrian(nplanes, js) = (rgeo - rzmax)/(xmax - xmin)
578
579 ! Geometric shift measured from magnetic axis
580 yshift(nplanes, js) = (r1(1+lt,0)-rgeo)/(xmax - xmin)
581
582 ! --- start independent stuff
583 IF (jperp2(js) .eq. zero) &
584 jperp2(js) = epsilon(jperp2(js))
585
586 loc_jpar_perp = jpar2(js)/jperp2(js)
587 IF (js .lt. ns) THEN
588 loc_jparps_perp = jps2(js)/jperp2(js)
589 ELSE
590 loc_jparps_perp = zero
591 END IF
592 ! --- end independent stuff
593
594 IF (nplanes .eq. 1) THEN
595 WRITE (nthreed, 120) js, psi(js), &
596 ygeo(nplanes, js), yellip(nplanes, js), &
597 yinden(nplanes, js), ytrian(nplanes, js), &
598 yshift(nplanes, js), loc_jpar_perp, &
599 loc_jparps_perp
600 ELSE
601 WRITE (nthreed, 120) js, psi(js), &
602 ygeo(nplanes, js), yellip(nplanes, js), &
603 yinden(nplanes, js), ytrian(nplanes, js), &
604 yshift(nplanes, js)
605 END IF
606 END DO ! js
607 END DO planes
608
609 95 FORMAT(/,71('-'),/,' Toroidal Plane: Phi = 180/Nfp',/,71('-'),/)
610120 FORMAT(1x,i5,6f14.5,1p,3e14.2)
611
612 if (open_dbg_context("threed1_geomag", id=0)) then
613
614 call add_real("anorm", anorm)
615 call add_real("vnorm", vnorm)
616 call add_real("toroidal_flux", toroidal_flux)
617
618 call add_real_2d("surf_area", nzeta, ntheta3, surf_area)
619
620 call add_real("circum_p", circum_p)
621 call add_real("surf_area_p", surf_area_p)
622
623 call add_real("volume_p", volume_p)
624 call add_real("cross_area_p", cross_area_p)
625 call add_real("Rmajor_p", rmajor_p)
626 call add_real("Aminor_p", aminor_p)
627 call add_real("aspect", aspect)
628
629 call add_real("kappa_p", kappa_p)
630 call add_real("rcen", rcen)
631 call add_real("rcenin", rcenin)
632 call add_real("aminr2in", aminr2in)
633 call add_real("bminz2in", bminz2in)
634 call add_real("bminz2", bminz2)
635 call add_real("aminr1", aminr1)
636 call add_real("sump", sump)
637 call add_real("pavg", pavg)
638
639 call add_real("delphid_exact", delphid_exact)
640 call add_real("musubi", musubi)
641 call add_real("rshaf1", rshaf1)
642 call add_real("rshaf2", rshaf2)
643 call add_real("rshaf", rshaf)
644 call add_real("fpsi0", fpsi0)
645 call add_real("b0", b0)
646
647 call add_real_2d("redge", nzeta, ntheta3, redge)
648 call add_real_2d("phat", nzeta, ntheta3, phat)
649
650 call add_real("rmax_surf", rmax_surf)
651 call add_real("rmin_surf", rmin_surf)
652 call add_real("zmax_surf", zmax_surf)
653
654 call add_real("bmin_1_ns", bmin(1,ns))
655 call add_real("bmax_1_ns", bmax(1,ns))
656 call add_real("bmin_ntheta2_ns", bmin(ntheta2,ns))
657 call add_real("bmax_ntheta2_ns", bmax(ntheta2,ns))
658
659 IF (ntor .gt. 1) THEN
660 call add_real_1d("waist", 2, waist)
661 call add_real_1d("height", 2, height)
662 else
663 call add_real_1d("waist", 1, waist(1))
664 call add_real_1d("height", 1, height(1))
665 end if
666
667 call add_real("sumbtot", sumbtot)
668 call add_real("sumbtor", sumbtor)
669 call add_real("sumbpol", sumbpol)
670 call add_real("betapol", betapol)
671 call add_real("sump20", sump20)
672 call add_real("sump2", sump2)
673 call add_real("betatot", betatot)
674 call add_real("betator", betator)
675 call add_real("VolAvgB", volavgb)
676 call add_real("IonLarmor", ionlarmor)
677
678 call add_real_1d("jPS2", ns-2, jps2(2:ns1))
679
680 call add_real("s2", s2)
681 call add_real("jpar_perp", jpar_perp)
682 call add_real("jparPS_perp", jparps_perp)
683
684 call add_real_1d("psi", ns, psi)
685
686 call add_real_2d("ygeo", 2, ns, ygeo)
687 call add_real_2d("yinden", 2, ns-1, yinden(:,2:ns))
688 call add_real_2d("yellip", 2, ns-1, yellip(:,2:ns))
689 call add_real_2d("ytrian", 2, ns-1, ytrian(:,2:ns))
690 call add_real_2d("yshift", 2, ns-1, yshift(:,2:ns))
691
692 call close_dbg_out()
693 end if
694
695 WRITE (nthreed, 130)
696130 FORMAT(//,' Magnetic Fields and Pressure',/,1x,71('-'))
697 fac = cp5/mu0
698 WRITE (nthreed, 140) &
699 sump/mu0, pavg/mu0, &
700 fac*sumbpol, fac*sumbpol/volume_p, &
701 fac*sumbtor, fac*sumbtor/volume_p, &
702 fac*sumbtot, fac*sumbtot/volume_p, &
703 c1p5*sump/mu0, c1p5*pavg/mu0
704140 FORMAT(' Volume Integrals (Joules) and Volume Averages (Pascals)',/,&
705 24x,'Integral',6x,'Average',/, &
706 ' pressure = ',1p,2e14.6,/,&
707 ' bpol**2 /(2 mu0) = ',2e14.6,/, &
708 ' btor**2/(2 mu0) = ',2e14.6,/, &
709 ' b**2/(2 mu0) = ',2e14.6,/,&
710 ' EKIN (3/2p) = ',2e14.6,/)
711
712 if (open_dbg_context("threed1_volquant", id=0)) then
713
714 call add_real("int_p", sump/mu0)
715 call add_real("avg_p", pavg/mu0)
716
717 call add_real("int_bpol", fac*sumbpol)
718 call add_real("avg_bpol", fac*sumbpol/volume_p)
719
720 call add_real("int_btor", fac*sumbtor)
721 call add_real("avg_btor", fac*sumbtor/volume_p)
722
723 call add_real("int_modb", fac*sumbtot)
724 call add_real("avg_modb", fac*sumbtot/volume_p)
725
726 call add_real("int_ekin", c1p5*sump/mu0)
727 call add_real("avg_ekin", c1p5*pavg/mu0)
728
729 call close_dbg_out()
730 end if
731
732 WRITE (nthreed, 800)
733800 FORMAT(/,' MAGNETIC AXIS COEFFICIENTS'/, &
734 ' n rmag zmag rmag zmag',/, &
735 ' (cos nv) (sin nv) (sin nv) (cos nv)',/)
736 loff = lbound(rmags,1)
737
738 allocate(rax_symm(0:ntor), zax_symm(0:ntor), rax_asym(0:ntor), zax_asym(0:ntor))
739
740 DO n = 0, ntor
741 n1 = n + loff
742
743 t1 = mscale(0)*nscale(n)
744
745 tz = t1
746 IF (.not.lthreed) tz = 0
747
748 rax_symm(n) = t1*rmags(n1)
749 zax_symm(n) = -tz*zmags(n1)
750 IF (lasym) THEN
751 rax_asym(n) = -tz*rmaga(n1)
752 zax_asym(n) = t1*zmaga(n1)
753 else
754 rax_asym(n) = 0.0_dp
755 zax_asym(n) = 0.0_dp
756 end if
757
758 IF (lasym) THEN
759 WRITE (nthreed, 820) n, t1*rmags(n1), (-tz*zmags(n1)), -tz*rmaga(n1), t1*zmaga(n1)
760 ELSE
761 WRITE (nthreed, 820) n, t1*rmags(n1), (-tz*zmags(n1))
762 END IF
763 END DO
764820 FORMAT(i5,1p,4e12.4)
765
766 if (open_dbg_context("threed1_axis", id=0)) then
767
768 call add_real_1d("rax_symm", ntor+1, rax_symm)
769 call add_real_1d("zax_symm", ntor+1, zax_symm)
770 call add_real_1d("rax_asym", ntor+1, rax_asym)
771 call add_real_1d("zax_asym", ntor+1, zax_asym)
772
773 call close_dbg_out()
774 end if
775
776 betstr = c2p0*sqrt(sump2/volume_p)/(sumbtot/volume_p)
777
778 WRITE (nthreed, 150) betatot, betapol, betator
779150 FORMAT(/,' From volume averages over plasma, betas are',/, &
780 ' beta total = ',f14.6,/, &
781 ' beta poloidal = ',f14.6,/, &
782 ' beta toroidal = ',f14.6,/ )
783
784 WRITE (nthreed, 160) rbtor, betaxis, betstr ! TODO: should this maybe be bsubvvac ?
785160 FORMAT(' R * Btor-vac = ',f14.6,' [Wb/M]',/, &
786 ' Peak Beta = ',f14.6,/, &
787 ' Beta-star = ',f14.6,/)
788
789 if (open_dbg_context("threed1_beta", id=0)) then
790
791 call add_real("betatot", betatot)
792 call add_real("betapol", betapol)
793 call add_real("betator", betator)
794
795 call add_real("rbtor", rbtor)
796 call add_real("betaxis", betaxis)
797 call add_real("betstr", betstr)
798
799 call close_dbg_out()
800 end if
801
802 ! Shafranov surface integrals s1,s2
803 ! Plasma Physics vol 13, pp 757-762 (1971)
804 ! Also, s3 = .5*S3, defined in Lao, Nucl. Fusion 25, p.1421 (1985)
805 ! Note: if ctor = 0, use Int(Bsupu*Bsubu dV) for ctor*ctor/R
806 ! Phys. Fluids B, Vol 5 (1993) p 3121, Eq. 9a-9d
807 ALLOCATE (rbps1u(nznt), bpol2vac(nznt))
808 IF (lfreeb .and. ivac.gt.1) THEN
809 bpol2vac = 2*bsqvac - bphiv*bphiv
810 ELSE
811 bpol2vac = 2*(c1p5*bsq(ns:nrzt:ns) - cp5*bsq(ns-1:nrzt:ns)) &
812 - ((c1p5*bsupv(ns:nrzt:ns) - cp5*bsupv(ns-1:nrzt:ns)) &
813 * redge)**2
814 END IF
815
816 ! Compute current-like norm (factor) in Eq.(8), <a> * int(Bpol**2 * dA)
817 ! where <a> == 2*pi*Rs in Eq. 8 is the effective minor radius = Vol/Asurf
818 ! (corrects wrong description of Rs in paper, which is NOT the major radius)
819 ! This aminr1 = 1/2 the "correct" aminr1
820 aminr1 = volume_p/surf_area_p
821 factor = twopi**2 * aminr1 * sum(bpol2vac*surf_area)
822 factor = one/factor
823 facnorm = factor * twopi**2
824
825 ! Lao's definition of normalization factor
826 scaling_ratio = (mu0*curtor/circum_p)**2 * volume_p
827 scaling_ratio = scaling_ratio*factor
828
829 rbps1u(:nznt) = facnorm*redge(:nznt)*phat(:nznt)*wint(ns:nznt*ns:ns) ! TODO: why not use nrzt instead of nznt*ns ?
830 sigr0 = sum(rbps1u(:nznt)*zu0(ns:nrzt:ns))
831 sigr1 = sum(rbps1u(:nznt)*zu0(ns:nrzt:ns)*redge(:nznt))
832 sigz1 =-sum(rbps1u(:nznt)*ru0(ns:nrzt:ns)*(z1(ns:nrzt:ns,0) + z1(ns:nrzt:ns,1)))
833 DEALLOCATE (redge, phat, rbps1u, bpol2vac, surf_area)
834
835 er = sigr1 + sigz1
836
837 ! LAO, NUCL.FUS. 25 (1985) 1421
839 flao = rshaf/rlao
840 fgeo = rshaf/rcen
841
842 smaleli = factor*sumbpol
843 betai = 2*factor*sump
844 musubi = vnorm*factor*musubi
845 lambda = cp5*smaleli + betai
846
847 ! Shafranov def. based on RT, Eq.(12)
848 s11 = er - rshaf*sigr0
849
850 ! R = Rgeometric
851 s12 = er - rcen*sigr0
852
853 ! R = RLao
854 s13 = er - rlao*sigr0
855 s2 = sigr0*rshaf
856
857 ! 1/2 S3 in Eq.(14c)
858 s3 = sigz1
859
860 delta1 = zero
861 delta2 = one - fgeo
862 delta3 = one - flao
863
864 WRITE (nthreed, 168)
865168 FORMAT(' Shafranov Surface Integrals',/ &
866 ' Ref: S. P. Hirshman, Phys. Fluids B, 5, (1993) 3119',/, &
867 ' Note: s1 = S1/2, s2 = S2/2, where ', &
868 ' s1,s2 are the Shafranov definitions,',/, &
869 ' and s3 = S3/2, where S3 is Lao''s definition.',/, &
870 ' The quantity lsubi gives the ratio of volume poloidal', &
871 /,' field energy to the field energy estimated from the', &
872 /,' surface integral in Eq.8.',/,1x,22('-'),/)
873
874 WRITE (nthreed, 170) rshaf, rcen, rlao, scaling_ratio, &
875 s3, smaleli, musubi, betai, lambda
876170 FORMAT(' RT (Pressure-weighted) = ',f14.6,' [M]',/, &
877 ' RG (Geometric) = ',f14.6,' [M]',/, &
878 ' RL (Vol/2*pi*Area-Lao) = ',f14.6,' [M]',/, &
879 ' Poloidal Field Energy',/, &
880 ' Normalization Ratio = ',f14.6,' (Lao/Hirshman)',//, &
881 ' s3 = ',f14.6,/, &
882 ' lsubi = ',f14.6,/, &
883 ' musubi = ',f14.6,/, &
884 ' betai = ',f14.6,/, &
885 ' lambda = ',f14.6,/)
886
887 WRITE (nthreed, 174) &
888 delta1, delta2, delta3, & ! delta = 1 - RT/R
889 s11, s12, s13, & ! s1
890 s2, s2/fgeo, s2/flao, & ! s2
891 musubi + s11, musubi + s12, musubi + s13, & ! betai (Mui + s1)
892 cp5*s11 + s2, cp5*s12 + s2/fgeo, cp5*s13 + s2/flao, & ! lambda (s1/2 + s2)
893 cp5*(3*betai+smaleli-musubi)/(s11+s2 ) - one, & ! 1st Shafr''v relation
894 cp5*(3*betai+smaleli-musubi)/(s12+s2/fgeo) - one, & ! (3*Betai + Li - Mui)/[2*(s1+s2)] - 1
895 cp5*(3*betai+smaleli-musubi)/(s13+s2/flao) - one, &
896 cp5 *(betai+smaleli+musubi)/s2 - one, & ! Radial force balance
897 cp5*fgeo*(betai+smaleli+musubi)/s2 - one, & !(Betai + Li + Mui)/(2*s2) - 1
898 cp5*flao*(betai+smaleli+musubi)/s2 - one
899174 FORMAT(/,32x,'R = RT',12x,'R = RG',12x,'R = RL',/, &
900 20x,3(10x,8('-')),/, &
901 ' delta = 1 - RT/R = ',3(f14.6,4x),/, &
902 ' s1 = ',3(f14.6,4x),/, &
903 ' s2 = ',3(f14.6,4x),/, &
904 ' betai (Mui + s1) = ',3(f14.6,4x),/, &
905 ' lambda (s1/2 + s2) = ',3(f14.6,4x),/, &
906 ' 1st Shafr''v relation = ',3(f14.6,4x),/, &
907 ' (3*Betai + Li - Mui)/[2*(s1+s2)] - 1',/, &
908 ' Radial force balance = ',3(f14.6,4x),/, &
909 ' (Betai + Li + Mui)/(2*s2) - 1',/)
910
911
912 if (open_dbg_context("threed1_shafrint", id=0)) then
913
914 call add_real("scaling_ratio", scaling_ratio)
915
916 call add_real("rlao", rlao)
917 call add_real("flao", flao)
918 call add_real("fgeo", fgeo)
919
920 call add_real("smaleli", smaleli)
921 call add_real("betai", betai)
922 call add_real("musubi", musubi)
923 call add_real("lambda", lambda)
924
925 call add_real("s11", s11)
926 call add_real("s12", s12)
927 call add_real("s13", s13)
928 call add_real("s2", s2)
929 call add_real("s3", s3)
930
931 call add_real("delta1", delta1)
932 call add_real("delta2", delta2)
933 call add_real("delta3", delta3)
934
935 call close_dbg_out()
936 end if
937
938END SUBROUTINE eqfor
subroutine bextrema(modb, bmin, bmax, nzeta, ntheta)
Computes minimum and maximum along between two angle lines ( ).
Definition bextrema.f90:12
subroutine bss(r12, rs, zs, ru12, zu12, bsubs, bsupu, bsupv, br, bphi, bz)
Computes br, bphi, bz, bsubs on half-radial mesh.
Definition bss.f90:18
subroutine calc_fbal(bsubu, bsubv)
Compute flux-surface averaged radial force balance .
Definition calc_fbal.f90:9
subroutine elongation(r1, z1, waist, height)
Compute Waist thickness and height in symmetry planes.
subroutine eqfor(br, bz, bsubu, bsubv, tau, rzl_array, ier_flag)
Basis physics analysis and evaluaton of force balance. This is where most of the contents of the thre...
Definition eqfor.f90:16
subroutine jxbforce(bsupu, bsupv, bsubu, bsubv, bsubsh, bsubsu, bsubsv, gsqrt, bsq, itheta, izeta, brho, ier_flag)
Program for computing local force balance.
Definition jxbforce.f90:22
logical function open_dbg_context(context_name, repetition, id)
check if any output is desired for the current iteration check if the given context should be openend...
Definition dbgout.f90:17
real(rprec), dimension(:,:), allocatable rv
Definition realspace.f90:10
real(rprec), dimension(:), allocatable zu0
, even-m and odd-m added together appropriately
Definition realspace.f90:25
real(rprec), dimension(:), allocatable wint
two-dimensional array for normalizing angle integrations
Definition realspace.f90:34
real(rprec), dimension(:,:), allocatable zv
Definition realspace.f90:13
real(rprec), dimension(:,:), allocatable zcon
spectral condensation term in
Definition realspace.f90:16
real(rprec), dimension(:), allocatable sqrts
sqrt(s), two-dimensional array on full-grid
Definition realspace.f90:32
real(rprec), dimension(:), allocatable ru0
, even-m and odd-m added together appropriately
Definition realspace.f90:24
real(rprec), dimension(:,:), allocatable, target z1
Definition realspace.f90:11
real(rprec), dimension(:,:), allocatable rcon
spectral condensation term in
Definition realspace.f90:15
real(rprec), dimension(:,:), allocatable r1
Definition realspace.f90:8
real(rprec), dimension(:), allocatable phip
radial derivative of phi/(2*pi) on half-grid
Definition realspace.f90:29
real(dp), parameter twopi
real(dp), parameter pi
real(dp), parameter mu0
real(dp), parameter one
real(dp), parameter zero
real(rprec), dimension(:), allocatable bsqvac
Definition vacmod.f90:43
real(rprec), dimension(:), allocatable bphi
Definition vacmod.f90:95
real(rprec) bsubvvac
Definition vacmod.f90:16
real(rprec), dimension(:), allocatable bphiv
Definition vacmod.f90:40
real(rprec), dimension(:), allocatable, target azmn
Definition vforces.f90:12
real(rprec), dimension(:), pointer azmn_o
Definition vforces.f90:27
real(rprec), dimension(:), allocatable, target brmn
Definition vforces.f90:9
real(rprec), dimension(:), pointer bzmn_e
Definition vforces.f90:28
real(rprec), dimension(:), allocatable, target armn
Definition vforces.f90:8
real(rprec), dimension(:), pointer brmn_e
Definition vforces.f90:21
real(rprec), dimension(:), pointer azmn_e
Definition vforces.f90:26
real(rprec), dimension(:), pointer czmn_e
Definition vforces.f90:30
real(rprec), dimension(:), pointer bzmn_o
Definition vforces.f90:29
real(rprec), dimension(:), pointer crmn_e
Definition vforces.f90:23
real(rprec), dimension(:), pointer czmn_o
Definition vforces.f90:31
real(rprec), dimension(:), pointer armn_o
Definition vforces.f90:20
real(rprec), dimension(:), pointer crmn_o
Definition vforces.f90:24
real(rprec), dimension(:), allocatable, target bzmn
Definition vforces.f90:13
real(rprec) ionlarmor
Definition vmec_io.f90:9
real(rprec) rmax_surf
Definition vmec_io.f90:22
real(rprec) aminor_p
Definition vmec_io.f90:10
real(rprec) betapol
Definition vmec_io.f90:13
real(rprec) zmax_surf
Definition vmec_io.f90:24
real(rprec) betator
Definition vmec_io.f90:14
real(rprec) circum_p
Definition vmec_io.f90:20
real(rprec) surf_area_p
Definition vmec_io.f90:19
real(rprec) betaxis
Definition vmec_io.f90:15
real(rprec) cross_area_p
Definition vmec_io.f90:18
real(rprec) rmin_surf
Definition vmec_io.f90:23
real(rprec) betatot
Definition vmec_io.f90:12
real(rprec) b0
Definition vmec_io.f90:16
real(rprec) volavgb
Definition vmec_io.f90:8
real(rprec) volume_p
Definition vmec_io.f90:17
real(rprec) kappa_p
Definition vmec_io.f90:21
real(rprec) rmajor_p
Definition vmec_io.f90:11
real(rprec), dimension(:), allocatable bredge
Definition vmec_main.f90:75
real(rprec), dimension(:), allocatable equif
radial force balance error: grad(p) - <j x B>
Definition vmec_main.f90:45
real(rprec) rbtor
poloidal current at LCFS
real(rprec), dimension(:,:), allocatable ygeo
Definition vmec_main.f90:53
real(rprec), dimension(:), allocatable vp
radial derivative of enclosed volume
Definition vmec_main.f90:56
real(rprec), dimension(:), allocatable bvco
enclosed poloidal current profile
Definition vmec_main.f90:43
real(rprec), dimension(:), allocatable buco
enclosed toroidal current profile
Definition vmec_main.f90:42
real(rprec), dimension(:), allocatable jcuru
poloidal current density
Definition vmec_main.f90:39
real(rprec) hs
radial mesh size increment
Definition vmec_main.f90:84
real(rprec), dimension(:,:), allocatable ytrian
Definition vmec_main.f90:51
real(rprec), dimension(:,:), allocatable bmax
Definition vmec_main.f90:32
real(rprec) ctor
toroidal current (?)
real(rprec), dimension(:), allocatable presf
pressure profile on full-grid, mass/phip**gamma
Definition vmec_main.f90:66
real(rprec), dimension(:), allocatable overr
Definition vmec_main.f90:54
real(rprec) router
real(rprec), dimension(:,:), allocatable bmin
Definition vmec_main.f90:31
real(rprec), dimension(:), allocatable jdotb
Definition vmec_main.f90:41
real(rprec) aspect
Definition vmec_main.f90:86
real(rprec), dimension(:,:), allocatable yinden
Definition vmec_main.f90:50
real(rprec) r00
Definition vmec_main.f90:89
integer ivac
counts number of free-boundary iterations
real(rprec), dimension(:), allocatable specw
spectral width (diagnostic)
Definition vmec_main.f90:46
real(rprec), dimension(:), allocatable iotaf
rotational transform (full grid)
Definition vmec_main.f90:34
real(rprec), dimension(:,:), allocatable yshift
Definition vmec_main.f90:52
real(rprec) rbtor0
poloidal current at magnetic axis
real(rprec), dimension(:), allocatable psi
Definition vmec_main.f90:48
real(rprec), dimension(:), allocatable pres
pressure profile
Definition vmec_main.f90:55
real(rprec) rinner
real(rprec), dimension(:), allocatable chipf
radial derivative of poloidal magnetic flux (full grid)
Definition vmec_main.f90:36
real(rprec), dimension(:), allocatable bpedge
Definition vmec_main.f90:76
real(rprec), dimension(:), allocatable jpar2
Definition vmec_main.f90:57
real(rprec), dimension(:), allocatable presgrad
pressure gradient: dp/ds
Definition vmec_main.f90:61
real(rprec), dimension(:), allocatable bvcof
Definition vmec_main.f90:63
logical lthreed
real(rprec), dimension(:), allocatable chi
poloidal magnetic flux
Definition vmec_main.f90:64
real(rprec), dimension(:), allocatable bdotb
Definition vmec_main.f90:59
real(rprec), dimension(:), allocatable bzedge
Definition vmec_main.f90:77
real(rprec), dimension(:), allocatable bucof
Definition vmec_main.f90:62
real(rprec), dimension(:), allocatable beta_vol
Definition vmec_main.f90:38
real(rprec), dimension(:), allocatable iotas
rotational transform , on half radial mesh
Definition vmec_main.f90:69
real(rprec), dimension(:), allocatable jperp2
Definition vmec_main.f90:58
real(rprec), dimension(:), allocatable phipf
radial derivative of toroidal magnetic flux (full grid)
Definition vmec_main.f90:35
real(rprec), dimension(:,:), allocatable yellip
Definition vmec_main.f90:49
real(rprec), dimension(:), allocatable vpphi
Definition vmec_main.f90:60
real(rprec), dimension(:), allocatable jcurv
toroidal current density
Definition vmec_main.f90:40
real(rprec) signgs
sign of Jacobian : must be =1 (right-handed) or =-1 (left-handed)
real(rprec), dimension(:), allocatable mscale
array for norming theta-trig functions (internal use only) so that the discrete SUM[cos(mu)*cos(m'u)]...
real(rprec), dimension(:), allocatable nscale
array for norming zeta -trig functions (internal use only)
integer ntmax
number of contributing Fourier basis function (can be 1, 2 or 4); assigned in read_indata()