9 |
|
|
10 |
contains |
contains |
11 |
|
|
12 |
subroutine invert_zoom_x(xf, xtild, G, xlon, xprim, xuv) |
subroutine invert_zoom_x(beta, xf, xtild, G, xlon, xprim, xuv) |
13 |
|
|
14 |
use coefpoly_m, only: coefpoly, a1, a2, a3 |
use coefpoly_m, only: coefpoly, a1, a2, a3 |
15 |
USE dimens_m, ONLY: iim |
USE dimens_m, ONLY: iim |
16 |
use dynetat0_m, only: clon |
use dynetat0_m, only: clon, grossismx |
17 |
use nr_util, only: pi_d, twopi_d |
use nr_util, only: pi_d, twopi_d |
18 |
use numer_rec_95, only: hunt, rtsafe |
use numer_rec_95, only: hunt, rtsafe |
19 |
|
|
20 |
DOUBLE PRECISION, intent(in):: Xf(0:), xtild(0:), G(0:) ! (0:nmax) |
DOUBLE PRECISION, intent(in):: beta, Xf(0:), xtild(0:), G(0:) ! (0:nmax) |
21 |
|
|
22 |
real, intent(out):: xlon(:), xprim(:) ! (iim) |
real, intent(out):: xlon(:), xprim(:) ! (iim) |
23 |
|
|
36 |
|
|
37 |
!------------------------------------------------------------------ |
!------------------------------------------------------------------ |
38 |
|
|
39 |
|
print *, "Call sequence information: invert_zoom_x" |
40 |
it = 0 ! initial guess |
it = 0 ! initial guess |
41 |
h = twopi_d / iim |
h = twopi_d / iim |
42 |
|
|
45 |
! - pi <= y < pi |
! - pi <= y < pi |
46 |
abs_y = abs(y) |
abs_y = abs(y) |
47 |
|
|
48 |
call hunt(xf, abs_y, it, my_lbound = 0) |
! Distinguish boundaries in order to avoid roundoff error. |
49 |
! {0 <= it <= nmax - 1} |
! funcd should be exactly equal to 0 at xtild(it) or xtild(it + |
50 |
|
! 1) and could be very small with the wrong sign so rtsafe |
51 |
|
! would fail. |
52 |
|
if (abs_y == 0d0) then |
53 |
|
xvrai(i) = 0d0 |
54 |
|
gvrai(i) = grossismx |
55 |
|
else if (abs_y == pi_d) then |
56 |
|
xvrai(i) = pi_d |
57 |
|
gvrai(i) = 2d0 * beta - grossismx |
58 |
|
else |
59 |
|
call hunt(xf, abs_y, it, my_lbound = 0) |
60 |
|
! {0 <= it <= nmax - 1} |
61 |
|
|
62 |
|
! Calcul de xvrai(i) et Gvrai(i) |
63 |
|
CALL coefpoly(Xf(it), Xf(it + 1), G(it), G(it + 1), xtild(it), & |
64 |
|
xtild(it + 1)) |
65 |
|
xvrai(i) = rtsafe(funcd, xtild(it), xtild(it + 1), xacc = 1d-6) |
66 |
|
Gvrai(i) = a1 + xvrai(i) * (2d0 * a2 + xvrai(i) * 3d0 * a3) |
67 |
|
end if |
68 |
|
|
|
! Calcul de xvrai(i) et Gvrai(i) |
|
|
CALL coefpoly(Xf(it), Xf(it + 1), G(it), G(it + 1), xtild(it), & |
|
|
xtild(it + 1)) |
|
|
xvrai(i) = rtsafe(funcd, xtild(it), xtild(it + 1), xacc = 1d-6) |
|
|
Gvrai(i) = a1 + xvrai(i) * (2d0 * a2 + xvrai(i) * 3d0 * a3) |
|
69 |
if (y < 0d0) xvrai(i) = - xvrai(i) |
if (y < 0d0) xvrai(i) = - xvrai(i) |
70 |
end DO |
end DO |
71 |
|
|