17 type(type_equilibrium
),
intent(inout) :: equilibrium
18 real(r8),
intent(in) :: a
19 real(r8),
dimension(nr),
intent(out) :: fcirc, b02av, b0max, rav
21 integer(itm_i4),
parameter :: nk = 101
23 real(r8),
dimension(nk) :: sumk
24 real(r8),
dimension(nr) :: p0tmp, ftmp, dptmp, dftmp
27 real(r8) :: radius, cpsurf
30 real(r8) :: sum1, sum2, sumr, sum
31 real(r8) :: b02max, b02, bm
32 real(r8) :: x, xr, xs, xrs, xrr, xss
33 real(r8) :: y, yr, ys, yrs, yrr, yss
34 real(r8) :: ps, psr, pss, psrs, psrr, psss
35 real(r8) :: xjac, bigr, gradps2, zjdchi, zlam
36 integer(itm_i4) :: i, j, k, ngs
37 integer(itm_i4) :: n1, n2, n3, n4
41 if (ias == 1) factas = 1._r8
46 cpsurf = radius**2 * b0 / alfa
48 call
profiles(p0tmp, ftmp, dptmp, dftmp, a)
53 ftmp(i) = ftmp(i) * rbscale
54 dftmp(i) = dftmp(i) * rbscale
72 call
interpolation(2, xx(1, n1), xx(1, n2), xx(1, n3), xx(1, n4), &
73 r, s, x, xr, xs, xrs, xrr, xss)
74 call
interpolation(2, yy(1, n1), yy(1, n2), yy(1, n3), yy(1, n4), &
75 r, s, y, yr, ys, yrs, yrr, yss)
76 call
interpolation(2, psi(4 * (n1 - 1) + 1), psi(4 * (n2 - 1) + 1), &
77 psi(4 * (n3 - 1) + 1), psi(4 * (n4 - 1) + 1), r, s, ps, &
78 psr, pss, psrs, psrr, psss)
79 xjac = xr * ys - xs * yr
80 bigr = 1._r8 + eps * x
81 gradps2 = psr**2 * (xs**2 + ys**2) / xjac**2
83 gradps2 = gradps2 * (cpsurf / radius)**2
84 xjac = xjac * radius**2
88 zjdchi = bigr * xjac / abs(psr)
89 b02 = (ftmp(nr - i + 1) / bigr)**2 + gradps2 / bigr**2
90 sum1 = sum1 - ws * zjdchi
91 sum2 = sum2 - ws * zjdchi * b02
92 sumr = sumr - ws * zjdchi * bigr
94 if (b02 > b02max) b02max = b02
98 sum1 = factas * sum1 / (2._r8 * pi)
99 sum2 = factas * sum2 / (2._r8 * pi)
100 sumr = factas * sumr / (2._r8 * pi)
101 b02av(ni) = sum2 / sum1
102 b0max(ni) = sqrt(abs(b02max))
103 rav(ni) = sumr / sum1
114 n1 = (i - 1) * np + j
122 call
interpolation(2, xx(1, n1), xx(1, n2), xx(1, n3), xx(1, n4), &
123 r, s, x, xr, xs, xrs, xrr, xss)
124 call
interpolation(2, yy(1, n1), yy(1, n2), yy(1, n3), yy(1, n4), &
125 r, s, y, yr, ys, yrs, yrr, yss)
126 call
interpolation(2, psi(4 * (n1 - 1) + 1), psi(4 * (n2 - 1) + 1), &
127 psi(4 * (n3 - 1) + 1), psi(4 * (n4 - 1) + 1), r, s, ps, &
128 psr, pss, psrs, psrr, psss)
130 xjac = xr * ys - xs * yr
131 bigr = 1._r8 + eps * x
132 gradps2 = psr**2 * (xs**2 + ys**2) / xjac**2
134 gradps2 = gradps2 * (cpsurf / radius)**2
135 xjac = xjac * radius**2
139 zjdchi = bigr * xjac / abs(psr)
140 b02 = (ftmp(nr - i + 1) / bigr)**2 + gradps2 / bigr**2
142 bm = b0max(nr - i + 1)
144 zlam = dble(k - 1) / dble(nk - 1)
145 sumk(k) = sumk(k) - ws * zjdchi * sqrt(abs(1._r8 - zlam &
148 sum1 = sum1 - ws * zjdchi
157 zlam = dble(k - 1) / dble(nk - 1)
158 sum = sum + zlam * sum1 / sumk(k)
160 fcirc(ni) = (sum + 0.5_r8 * sum1 / sumk(nk)) / dble(nk - 1)
161 fcirc(ni) = 0.75_r8 * fcirc(ni) * b02av(ni) / b0max(ni)**2
166 equilibrium%profiles_1d%ftrap(2 : nr) = 1.0_r8 - fcirc(2 : nr)
168 equilibrium%profiles_1d%ftrap(1) = 0._r8
170 if (verbosity > 2)
write(iu6, *)
' done passing particles'
subroutine profiles(p0, rbphi, dp0, drbphi, a)
subroutine interpolation(type_interp, xn1, xn2, xn3, xn4, r, s, x, xr, xs, xrs, xrr, xss, yn1, yn2, yn3, yn4, pn1, pn2, pn3, pn4, yr, ys, ps)
subroutine passing_particles(a, fcirc, b02av, b0max, rav, equilibrium)