19 type(ne_te),
intent(in) :: dt
20 real(r8),
intent(in) :: psi
21 real(r8),
intent(out) :: f, df
22 real(r8),
intent(out),
optional :: const
23 real(r8),
intent(in),
optional :: df_in
25 real(r8) :: ex, ext, denom, ztmp
27 if (.not. present(df_in))
then
29 ex = exp(psi / dt%delta)
30 ext = exp(dt%psi_m / dt%delta)
31 denom = 2.0_r8 * dt%delta * (ex + ext)
32 ztmp = (dt%psi_m - psi) / (2.0_r8 * dt%delta)
34 f = (0.5_r8 * (dt%h - dt%h_0) * (((1.0_r8 + dt%slope * ztmp) &
35 * exp(ztmp) - exp(-ztmp)) / (exp(ztmp) + exp(-ztmp)) + 1.0_r8) &
38 df = (dt%h - dt%h_0) * ext * (dt%delta * ((4.0_r8 &
39 + dt%slope) * ex + dt%slope * ext) - dt%slope *ex &
40 * (psi - dt%psi_m)) / (denom * denom)
42 if (.not. present(const))
return
44 if (dt%shape == 1)
then
45 const = f + dt%fac * df * (dt%alpha(1) + (1._r8 - dt%alpha(1)) &
46 / (dt%alpha(2) + 1.0_r8)) * psi
48 const = f + dt%fac * df * ((2.0_r8 / 3.0_r8 * dt%alpha(1) &
49 + 0.5_r8 * dt%alpha(2)) / (dt%alpha(1) + dt%alpha(2)) &
50 + 0.5_r8 * dt%alpha(3))
55 if (dt%shape == 1)
then
58 df = df_in * (dt%alpha(1) + (1.0_r8 - dt%alpha(1)) * (psi &
59 / dt%psi_0) **dt%alpha(2))
60 f = -dt%fac * df_in * (dt%alpha(1) * psi + (1.0_r8 - dt%alpha(1)) &
61 / (dt%alpha(2) + 1.0_r8) / dt%psi_0**dt%alpha(2) &
62 * psi**(dt%alpha(2) + 1.0_r8)) + const
66 df = df_in / dt%psi_0 * ((dt%alpha(1) * (psi / dt%psi_0)**0.5_r8 &
67 + dt%alpha(2) * (psi / dt%psi_0)) / (dt%alpha(1) + dt%alpha(2)) &
68 + dt%alpha(3) * (1.0_r8 - psi / dt%psi_0))
69 f = -dt%fac * df_in * ((2.0_r8 / 3.0_r8 * dt%alpha(1) * (psi &
70 / dt%psi_0) **1.5_r8 + 0.5_r8 * dt%alpha(2) * (psi &
71 / dt%psi_0)**2) / (dt%alpha(1) + dt%alpha(2)) + dt%alpha(3) * (psi &
72 / dt%psi_0 - 0.5_r8 * (psi / dt%psi_0)**2)) + const
subroutine ne_te_profile(dt, psi, f, df, const, df_in)