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

Diff of /trunk/dyn3d/fxhyp.f

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 145 by guez, Tue Jun 16 15:23:29 2015 UTC revision 167 by guez, Mon Aug 24 16:30:33 2015 UTC
# Line 10  contains Line 10  contains
10      ! Author: P. Le Van, from formulas by R. Sadourny      ! Author: P. Le Van, from formulas by R. Sadourny
11    
12      ! Calcule les longitudes et dérivées dans la grille du GCM pour      ! Calcule les longitudes et dérivées dans la grille du GCM pour
13      ! une fonction f(x) à dérivée tangente hyperbolique.      ! une fonction x_f(\tilde x) à dérivée tangente hyperbolique.
14    
15      ! Il vaut mieux avoir : grossismx \times dzoom < pi      ! Il vaut mieux avoir : grossismx \times delta < pi
16    
17      ! Le premier point scalaire pour une grille regulière (grossismx =      ! Le premier point scalaire pour une grille regulière (grossismx =
18      ! 1., taux = 0., clon = 0.) est à - 180 degrés.      ! 1) avec clon = 0 est à - 180 degrés.
19    
20      USE dimens_m, ONLY: iim      USE dimens_m, ONLY: iim
21      use dynetat0_m, only: clon, grossismx, dzoomx, taux      use dynetat0_m, only: clon, grossismx, dzoomx, taux
# Line 24  contains Line 24  contains
24      use principal_cshift_m, only: principal_cshift      use principal_cshift_m, only: principal_cshift
25      use tanh_cautious_m, only: tanh_cautious      use tanh_cautious_m, only: tanh_cautious
26    
27      REAL, intent(out):: xprimm025(:), rlonv(:), xprimv(:) ! (iim + 1)      REAL, intent(out):: xprimm025(:) ! (iim + 1)
28      real, intent(out):: rlonu(:), xprimu(:), xprimp025(:) ! (iim + 1)  
29        REAL, intent(out):: rlonv(:) ! (iim + 1)
30        ! longitudes of points of the "scalar" and "v" grid, in rad
31    
32        REAL, intent(out):: xprimv(:) ! (iim + 1)
33        ! 2 pi / iim * (derivative of the longitudinal zoom function)(rlonv)
34    
35        real, intent(out):: rlonu(:) ! (iim + 1)
36        ! longitudes of points of the "u" grid, in rad
37    
38        real, intent(out):: xprimu(:) ! (iim + 1)
39        ! 2 pi / iim * (derivative of the longitudinal zoom function)(rlonu)
40    
41        real, intent(out):: xprimp025(:) ! (iim + 1)
42    
43      ! Local:      ! Local:
44      real rlonm025(iim + 1), rlonp025(iim + 1)      real rlonm025(iim + 1), rlonp025(iim + 1), d_rlonv(iim)
45      REAL dzoom, step      REAL delta, h
46      real d_rlonv(iim)      DOUBLE PRECISION, dimension(0:nmax):: xtild, fhyp, G, Xf, ffdx
47      DOUBLE PRECISION xtild(0:2 * nmax)      DOUBLE PRECISION beta
     DOUBLE PRECISION fhyp(nmax:2 * nmax), ffdx, beta, Xprimt(0:2 * nmax)  
     DOUBLE PRECISION Xf(0:2 * nmax)  
48      INTEGER i, is2      INTEGER i, is2
49      DOUBLE PRECISION, dimension(nmax + 1:2 * nmax):: xxpr, xmoy, fxm      DOUBLE PRECISION xmoy(nmax), fxm(nmax)
50    
51      !----------------------------------------------------------------------      !----------------------------------------------------------------------
52    
53      print *, "Call sequence information: fxhyp"      print *, "Call sequence information: fxhyp"
54    
55      test_grossismx: if (grossismx == 1.) then      if (grossismx == 1.) then
56         step = twopi / iim         h = twopi / iim
57    
58         xprimm025(:iim) = step         xprimm025(:iim) = h
59         xprimp025(:iim) = step         xprimp025(:iim) = h
60         xprimv(:iim) = step         xprimv(:iim) = h
61         xprimu(:iim) = step         xprimu(:iim) = h
62    
63         rlonv(:iim) = arth(- pi + clon, step, iim)         rlonv(:iim) = arth(- pi + clon, h, iim)
64         rlonm025(:iim) = rlonv(:iim) - 0.25 * step         rlonm025(:iim) = rlonv(:iim) - 0.25 * h
65         rlonp025(:iim) = rlonv(:iim) + 0.25 * step         rlonp025(:iim) = rlonv(:iim) + 0.25 * h
66         rlonu(:iim) = rlonv(:iim) + 0.5 * step         rlonu(:iim) = rlonv(:iim) + 0.5 * h
67      else test_grossismx      else
68         dzoom = dzoomx * twopi_d         delta = dzoomx * twopi_d
69         xtild = arth(- pi_d, pi_d / nmax, 2 * nmax + 1)         xtild = arth(0d0, pi_d / nmax, nmax + 1)
70         forall (i = nmax + 1:2 * nmax) xmoy(i) = 0.5d0 * (xtild(i-1) + xtild(i))         forall (i = 1:nmax) xmoy(i) = 0.5d0 * (xtild(i-1) + xtild(i))
71    
72         ! Compute fhyp:         ! Compute fhyp:
73         fhyp(nmax + 1:2 * nmax - 1) = tanh_cautious(taux * (dzoom / 2. &         fhyp(1:nmax - 1) = tanh_cautious(taux * (delta / 2d0 &
74              - xtild(nmax + 1:2 * nmax - 1)), xtild(nmax + 1:2 * nmax - 1) &              - xtild(1:nmax - 1)), xtild(1:nmax - 1) &
75              * (pi_d - xtild(nmax + 1:2 * nmax - 1)))              * (pi_d - xtild(1:nmax - 1)))
76         fhyp(nmax) = 1d0         fhyp(0) = 1d0
77         fhyp(2 * nmax) = -1d0         fhyp(nmax) = -1d0
78    
79         fxm = tanh_cautious(taux * (dzoom / 2. - xmoy), xmoy * (pi_d - xmoy))         fxm = tanh_cautious(taux * (delta / 2d0 - xmoy), xmoy * (pi_d - xmoy))
80    
81         ! Calcul de beta         ! Compute \int_0 ^{\tilde x} F:
82    
83         ffdx = 0.         ffdx(0) = 0d0
84    
85         DO i = nmax + 1, 2 * nmax         DO i = 1, nmax
86            ffdx = ffdx + fxm(i) * (xtild(i) - xtild(i-1))            ffdx(i) = ffdx(i - 1) + fxm(i) * (xtild(i) - xtild(i-1))
87         END DO         END DO
88    
89         print *, "ffdx = ", ffdx         print *, "ffdx(nmax) = ", ffdx(nmax)
90         beta = (pi_d - grossismx * ffdx) / (pi_d - ffdx)         beta = (pi_d - grossismx * ffdx(nmax)) / (pi_d - ffdx(nmax))
91         print *, "beta = ", beta         print *, "beta = ", beta
92    
93         IF (2. * beta - grossismx <= 0.) THEN         IF (2d0 * beta - grossismx <= 0d0) THEN
94            print *, 'Bad choice of grossismx, taux, dzoomx.'            print *, 'Bad choice of grossismx, taux, dzoomx.'
95            print *, 'Decrease dzoomx or grossismx.'            print *, 'Decrease dzoomx or grossismx.'
96            STOP 1            STOP 1
97         END IF         END IF
98    
99         ! calcul de Xprimt         G = beta + (grossismx - beta) * fhyp
        Xprimt(nmax:2 * nmax) = beta + (grossismx - beta) * fhyp  
        xprimt(:nmax - 1) = xprimt(2 * nmax:nmax + 1:- 1)  
   
        ! Calcul de Xf  
   
        xxpr = beta + (grossismx - beta) * fxm  
        Xf(nmax) = 0d0  
   
        DO i = nmax + 1, 2 * nmax - 1  
           Xf(i) = Xf(i-1) + xxpr(i) * (xtild(i) - xtild(i-1))  
        END DO  
100    
101         Xf(2 * nmax) = pi_d         Xf(:nmax - 1) = beta * xtild(:nmax - 1) + (grossismx - beta) &
102         xf(:nmax - 1) = - xf(2 * nmax:nmax + 1:- 1)              * ffdx(:nmax - 1)
103           Xf(nmax) = pi_d
104    
105         call invert_zoom_x(xf, xtild, Xprimt, rlonm025(:iim), xprimm025(:iim), &         call invert_zoom_x(beta, xf, xtild, G, rlonm025(:iim), xprimm025(:iim), &
106              xuv = - 0.25d0)              xuv = - 0.25d0)
107         call invert_zoom_x(xf, xtild, Xprimt, rlonv(:iim), xprimv(:iim), &         call invert_zoom_x(beta, xf, xtild, G, rlonv(:iim), xprimv(:iim), &
108              xuv = 0d0)              xuv = 0d0)
109         call invert_zoom_x(xf, xtild, Xprimt, rlonu(:iim), xprimu(:iim), &         call invert_zoom_x(beta, xf, xtild, G, rlonu(:iim), xprimu(:iim), &
110              xuv = 0.5d0)              xuv = 0.5d0)
111         call invert_zoom_x(xf, xtild, Xprimt, rlonp025(:iim), xprimp025(:iim), &         call invert_zoom_x(beta, xf, xtild, G, rlonp025(:iim), xprimp025(:iim), &
112              xuv = 0.25d0)              xuv = 0.25d0)
113      end if test_grossismx      end if
114    
115      is2 = 0      is2 = 0
116    

Legend:
Removed from v.145  
changed lines
  Added in v.167

  ViewVC Help
Powered by ViewVC 1.1.21