/[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 150 - (hide annotations)
Thu Jun 18 13:49:26 2015 UTC (8 years, 11 months ago) by guez
Original Path: trunk/Sources/dyn3d/invert_zoom_x.f
File size: 2102 byte(s)
Removed unused arguments of groupe, cv3_undilute2, cv_undilute2,
interfsur_lim, drag_noro, orodrag, gwprofil

Chickened out of revision 148: back to double precision in
invert_zoom_x (and overloaded rtsafe).

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 150 DOUBLE PRECISION xvrai(iim), Gvrai(iim)
34 guez 148 ! 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 guez 150 xvrai(i) = rtsafe(funcd, xtild(it), xtild(it + 1), xacc = 1d-6)
52 guez 149 Gvrai(i) = a1 + xvrai(i) * (2d0 * a2 + xvrai(i) * 3d0 * a3)
53 guez 148 if (y < 0d0) xvrai(i) = - xvrai(i)
54 guez 121 end DO
55    
56     DO i = 1, iim -1
57     IF (xvrai(i + 1) < xvrai(i)) THEN
58 guez 124 print *, 'xvrai(', i + 1, ') < xvrai(', i, ')'
59 guez 121 STOP 1
60     END IF
61     END DO
62    
63 guez 127 xlon = xvrai + clon
64 guez 148 xprim = twopi_d / (iim * Gvrai)
65 guez 121
66 guez 131 end subroutine invert_zoom_x
67 guez 121
68 guez 149 !**********************************************************************
69    
70     SUBROUTINE funcd(x, fval, fderiv)
71    
72     use coefpoly_m, only: a0, a1, a2, a3
73    
74 guez 150 DOUBLE PRECISION, INTENT(IN):: x
75     DOUBLE PRECISION, INTENT(OUT):: fval, fderiv
76 guez 149
77     fval = a0 + x * (a1 + x * (a2 + x * a3)) - abs_y
78 guez 150 fderiv = a1 + x * (2d0 * a2 + x * 3d0 * a3)
79 guez 149
80     END SUBROUTINE funcd
81    
82 guez 131 end module invert_zoom_x_m

  ViewVC Help
Powered by ViewVC 1.1.21