8 integer(itm_i4),
parameter,
private :: iu6 = 6
13 function identity(a, x, xr, xs, yr, ys, psi, psir, F_dia) result(f_identity)
20 real(r8),
intent(in) :: a
21 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
22 real(r8),
intent(in) :: f_dia
23 real(r8) :: f_identity
30 function rh_side(a, x, xr, xs, yr, ys, psi, psir, F_dia) result(f_rh_side)
40 real(r8),
intent(in) :: a
41 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
42 real(r8),
intent(in) :: f_dia
47 f_rh_side =
dgamma_dpsi(psi) + b * x * (1._r8 + eps * x / 2._r8) &
50 f_rh_side =
dgamma_dpsi(psi) + b * (1._r8 + eps * x)**2 &
53 f_rh_side = a * f_rh_side / (1._r8 + eps * x)
55 if (isol == 1) f_rh_side = a * (1._r8 + b * x * (1._r8 + eps * x &
56 / 2._r8)) / (1._r8 + eps * x)
61 function one_over_r(a, x, xr, xs, yr, ys, psi, psir, F_dia) &
71 real(r8),
intent(in) :: a
72 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
73 real(r8),
intent(in) :: f_dia
74 real(r8) :: f_one_over_r
76 f_one_over_r = 1._r8 / (1._r8 + eps * x)
82 result(f_rquad_minus_1_over_2_r)
91 real(r8),
intent(in) :: a
92 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
93 real(r8),
intent(in) :: f_dia
94 real(r8) :: f_rquad_minus_1_over_2_r
96 f_rquad_minus_1_over_2_r = x * (1._r8 + eps * x / 2._r8) &
102 function r_major(a, x, xr, xs, yr, ys, psi, psir, F_dia) result(f_R_major)
111 real(r8),
intent(in) :: a
112 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
113 real(r8),
intent(in) :: f_dia
114 real(r8) :: f_r_major
116 f_r_major = 1._r8 + eps * x
121 function r2(a, x, xr, xs, yr, ys, psi, psir, F_dia) result(f_R2)
130 real(r8),
intent(in) :: a
131 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
132 real(r8),
intent(in) :: f_dia
135 f_r2 =
r_major(a, x, xr, xs, yr, ys, psi, psir, f_dia)**2
141 result(f_one_over_r2)
150 real(r8),
intent(in) :: a
151 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
152 real(r8),
intent(in) :: f_dia
153 real(r8) :: f_one_over_r2
155 f_one_over_r2 = 1._r8 /
r2(a, x, xr, xs, yr, ys, psi, psir, f_dia)
160 function gradpsi2(a, x, xr, xs, yr, ys, psi, psir, F_dia) &
171 real(r8),
intent(in) :: a
172 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
173 real(r8),
intent(in) :: f_dia
176 real(r8) :: f_gradpsi2
178 jacobian = xr * ys - xs * yr
180 if (jacobian /= 0._r8)
then
181 f_gradpsi2 = psir**2 * (xs**2 + ys**2) / jacobian**2
183 if (psir /= 0._r8 .and. (xs /= 0._r8 .or. ys /= 0._r8))
then
184 write(iu6, *)
'ERROR: Division by zero in function gradpsi2! '
191 f_gradpsi2 = f_gradpsi2 / twopi**2
196 function gradpsi(a, x, xr, xs, yr, ys, psi, psir, F_dia) &
207 real(r8),
intent(in) :: a
208 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
209 real(r8),
intent(in) :: f_dia
211 real(r8) :: f_gradpsi
213 f_gradpsi = sqrt(
gradpsi2(a, x, xr, xs, yr, ys, psi, psir, f_dia))
219 result(f_gradpsi2_over_r2)
230 real(r8),
intent(in) :: a
231 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
232 real(r8),
intent(in) :: f_dia
234 real(r8) :: f_gradpsi2_over_r2
236 f_gradpsi2_over_r2 =
gradpsi2(a, x, xr, xs, yr, ys, psi, psir, f_dia) &
237 /
r2(a, x, xr, xs, yr, ys, psi, psir, f_dia)
243 result(f_f2_plus_gradpsi2)
253 real(r8),
intent(in) :: a
254 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
255 real(r8),
intent(in) :: f_dia
257 real(r8) :: f_f2_plus_gradpsi2
259 f_f2_plus_gradpsi2 = f_dia**2 +
gradpsi2(a, x, xr, xs, yr, ys, psi, &
265 function b_fun(a, x, xr, xs, yr, ys, psi, psir, F_dia) &
277 real(r8),
intent(in) :: a
278 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
279 real(r8),
intent(in) :: f_dia
283 f_b2 = sqrt((f_dia**2 +
gradpsi2(a, x, xr, xs, yr, ys, psi, psir, f_dia)) &
284 /
r2(a, x, xr, xs, yr, ys, psi, psir, f_dia))
289 function b2(a, x, xr, xs, yr, ys, psi, psir, F_dia) &
301 real(r8),
intent(in) :: a
302 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
303 real(r8),
intent(in) :: f_dia
307 f_b2 = (f_dia**2 +
gradpsi2(a, x, xr, xs, yr, ys, psi, psir, f_dia)) &
308 /
r2(a, x, xr, xs, yr, ys, psi, psir, f_dia)
314 result(f_one_over_b2)
325 real(r8),
intent(in) :: a
326 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
327 real(r8),
intent(in) :: f_dia
329 real(r8) :: f_one_over_b2
331 f_one_over_b2 = 1._r8 /
b2(a, x, xr, xs, yr, ys, psi, psir, f_dia)
337 result(f_gradrho2_over_b2)
348 real(r8),
intent(in) :: a
349 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
350 real(r8),
intent(in) :: f_dia
352 real(r8) :: f_gradrho2_over_b2
354 f_gradrho2_over_b2 =
gradpsi2(a, x, xr, xs, yr, ys, psi, psir, f_dia) &
355 /
b2(a, x, xr, xs, yr, ys, psi, psir, f_dia)
360 function bp2(a, x, xr, xs, yr, ys, psi, psir, F_dia) &
372 real(r8),
intent(in) :: a
373 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
374 real(r8),
intent(in) :: f_dia
383 function p(a, x, xr, xs, yr, ys, psi, psir, F_dia) result(f_p)
388 use mod_dat, only : b, alfa, bvac, p_sep, hbt, eps, pscale, bmag
393 real(r8),
intent(in) :: a
394 real(r8),
intent(in) :: x, xr, xs, yr, ys, psi, psir
395 real(r8),
intent(in) :: f_dia
399 f_p = 0.5_r8 * a * b *
pressure(psi) * sign(1.0_r8, -alfa) &
402 f_p = eps * a * b *
pressure(psi) * sign(1.0_r8, -alfa) &
407 f_p = f_p * bmag**2 / mu0
427 real(r8),
intent(in) ::
flux
428 real(r8) :: f_pressure
430 real(r8),
dimension(3) :: ablt
435 if (
flux > 1._r8)
then
439 f_pressure =
spwert(npts, flux_tmp, p_spline, psivec, ablt, 0)
real(r8) function bp2(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function b_fun(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function gradpsi2(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function one_over_r2(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function gradpsi(a, x, xr, xs, yr, ys, psi, psir, F_dia)
subroutine flux(psitok, rk, zk, nk)
REAL *8 function spwert(N, XWERT, A, B, C, D, X, ABLTG)
real(r8) function rh_side(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function f2_plus_gradpsi2(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function one_over_b2(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function dgamma_dpsi(flux)
real(r8) function b2(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function gradrho2_over_b2(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function p(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function identity(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function r2(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function rquad_minus_1_over_2_r(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function one_over_r(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function r_major(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function dp_dpsi(flux)
real(r8) function pressure(flux)
real(r8) function gradpsi2_over_r2(a, x, xr, xs, yr, ys, psi, psir, F_dia)