/[lmdze]/trunk/dyn3d/invert_zoom_x.f
ViewVC logotype

Annotation of /trunk/dyn3d/invert_zoom_x.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 149 - (hide annotations)
Thu Jun 18 12:23:44 2015 UTC (8 years, 11 months ago) by guez
Original Path: trunk/Sources/dyn3d/invert_zoom_x.f
File size: 2090 byte(s)
In invert_zoom_x, call rtsafe instead of the equivalent coding that
was there. funcd needs to access a[0-4] and abs_y so we upgrade a[0-4]
from arguments of coefpoly to variables of module coefpoly_m and abs_y
from local variable of invert_zoom_x to private variable of module
invert_zoom_x_m.

Removed unused arguments t10m and q10m of hbtm.

1 guez 131 module invert_zoom_x_m
2 guez 121
3     implicit none
4    
5     INTEGER, PARAMETER:: nmax = 30000
6 guez 149 DOUBLE PRECISION abs_y
7 guez 121
8 guez 149 private abs_y, funcd
9    
10 guez 121 contains
11    
12 guez 148 subroutine invert_zoom_x(xf, xtild, G, xlon, xprim, xuv)
13 guez 121
14 guez 149 use coefpoly_m, only: coefpoly, a1, a2, a3
15 guez 121 USE dimens_m, ONLY: iim
16 guez 139 use dynetat0_m, only: clon
17 guez 124 use nr_util, only: pi_d, twopi_d
18 guez 149 use numer_rec_95, only: hunt, rtsafe
19 guez 121
20 guez 146 DOUBLE PRECISION, intent(in):: Xf(0:), xtild(0:), G(0:) ! (0:nmax)
21    
22 guez 148 real, intent(out):: xlon(:), xprim(:) ! (iim)
23 guez 121
24     DOUBLE PRECISION, intent(in):: xuv
25 guez 145 ! between - 0.25 and 0.5
26 guez 121 ! 0. si calcul aux points scalaires
27 guez 145 ! 0.5 si calcul aux points U
28 guez 121
29     ! Local:
30 guez 149 DOUBLE PRECISION Y
31     integer i, it
32 guez 121
33 guez 148 real xvrai(iim), Gvrai(iim)
34     ! intermediary variables because xlon and xprim are simple precision
35 guez 126
36 guez 121 !------------------------------------------------------------------
37    
38 guez 145 it = 0 ! initial guess
39    
40 guez 126 DO i = 1, iim
41 guez 148 Y = - pi_d + (i + xuv - 0.75d0) * twopi_d / iim
42     ! - pi <= y < pi
43     abs_y = abs(y)
44 guez 121
45 guez 148 call hunt(xf, abs_y, it, my_lbound = 0)
46 guez 146 ! {0 <= it <= nmax - 1}
47 guez 121
48 guez 148 ! Calcul de xvrai(i) et Gvrai(i)
49 guez 146 CALL coefpoly(Xf(it), Xf(it + 1), G(it), G(it + 1), xtild(it), &
50 guez 149 xtild(it + 1))
51     xvrai(i) = rtsafe(funcd, real(xtild(it)), real(xtild(it + 1)), &
52     xacc = 1e-6)
53     Gvrai(i) = a1 + xvrai(i) * (2d0 * a2 + xvrai(i) * 3d0 * a3)
54 guez 148 if (y < 0d0) xvrai(i) = - xvrai(i)
55 guez 121 end DO
56    
57     DO i = 1, iim -1
58     IF (xvrai(i + 1) < xvrai(i)) THEN
59 guez 124 print *, 'xvrai(', i + 1, ') < xvrai(', i, ')'
60 guez 121 STOP 1
61     END IF
62     END DO
63    
64 guez 127 xlon = xvrai + clon
65 guez 148 xprim = twopi_d / (iim * Gvrai)
66 guez 121
67 guez 131 end subroutine invert_zoom_x
68 guez 121
69 guez 149 !**********************************************************************
70    
71     SUBROUTINE funcd(x, fval, fderiv)
72    
73     use coefpoly_m, only: a0, a1, a2, a3
74    
75     REAL, INTENT(IN):: x
76     REAL, INTENT(OUT):: fval, fderiv
77    
78     fval = a0 + x * (a1 + x * (a2 + x * a3)) - abs_y
79     fderiv = a1 + x * (2. * a2 + x * 3. * a3)
80    
81     END SUBROUTINE funcd
82    
83 guez 131 end module invert_zoom_x_m

  ViewVC Help
Powered by ViewVC 1.1.21