/[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 144 by guez, Wed Jun 10 16:46:46 2015 UTC revision 151 by guez, Tue Jun 23 15:14:20 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 28  contains Line 28  contains
28      real, intent(out):: rlonu(:), xprimu(:), xprimp025(:) ! (iim + 1)      real, intent(out):: rlonu(:), xprimu(:), xprimp025(:) ! (iim + 1)
29    
30      ! Local:      ! Local:
31      real rlonm025(iim + 1), rlonp025(iim + 1)      real rlonm025(iim + 1), rlonp025(iim + 1), d_rlonv(iim)
32      REAL dzoom, step      REAL delta, step
33      real d_rlonv(iim)      DOUBLE PRECISION, dimension(0:nmax):: xtild, fhyp, G, Xf, ffdx
34      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), xxpr(2 * nmax)  
35      INTEGER i, is2      INTEGER i, is2
36      DOUBLE PRECISION, dimension(nmax + 1:2 * nmax):: xmoy, fxm      DOUBLE PRECISION xmoy(nmax), fxm(nmax)
37    
38      !----------------------------------------------------------------------      !----------------------------------------------------------------------
39    
40      print *, "Call sequence information: fxhyp"      print *, "Call sequence information: fxhyp"
41    
42      test_grossismx: if (grossismx == 1.) then      if (grossismx == 1.) then
43         step = twopi / iim         step = twopi / iim
44    
45         xprimm025(:iim) = step         xprimm025(:iim) = step
# Line 53  contains Line 51  contains
51         rlonm025(:iim) = rlonv(:iim) - 0.25 * step         rlonm025(:iim) = rlonv(:iim) - 0.25 * step
52         rlonp025(:iim) = rlonv(:iim) + 0.25 * step         rlonp025(:iim) = rlonv(:iim) + 0.25 * step
53         rlonu(:iim) = rlonv(:iim) + 0.5 * step         rlonu(:iim) = rlonv(:iim) + 0.5 * step
54      else test_grossismx      else
55         dzoom = dzoomx * twopi_d         delta = dzoomx * twopi_d
56         xtild = arth(- pi_d, pi_d / nmax, 2 * nmax + 1)         xtild = arth(0d0, pi_d / nmax, nmax + 1)
57         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))
58    
59         ! Compute fhyp:         ! Compute fhyp:
60         fhyp(nmax + 1:2 * nmax - 1) = tanh_cautious(taux * (dzoom / 2. &         fhyp(1:nmax - 1) = tanh_cautious(taux * (delta / 2d0 &
61              - xtild(nmax + 1:2 * nmax - 1)), xtild(nmax + 1:2 * nmax - 1) &              - xtild(1:nmax - 1)), xtild(1:nmax - 1) &
62              * (pi_d - xtild(nmax + 1:2 * nmax - 1)))              * (pi_d - xtild(1:nmax - 1)))
63         fhyp(nmax) = 1d0         fhyp(0) = 1d0
64         fhyp(2 * nmax) = -1d0         fhyp(nmax) = -1d0
65    
66         fxm = tanh_cautious(taux * (dzoom / 2. - xmoy), xmoy * (pi_d - xmoy))         fxm = tanh_cautious(taux * (delta / 2d0 - xmoy), xmoy * (pi_d - xmoy))
67    
68         ! Calcul de beta         ! Compute \int_0 ^{\tilde x} F:
69    
70         ffdx = 0.         ffdx(0) = 0d0
71    
72         DO i = nmax + 1, 2 * nmax         DO i = 1, nmax
73            ffdx = ffdx + fxm(i) * (xtild(i) - xtild(i-1))            ffdx(i) = ffdx(i - 1) + fxm(i) * (xtild(i) - xtild(i-1))
74         END DO         END DO
75    
76         print *, "ffdx = ", ffdx         print *, "ffdx(nmax) = ", ffdx(nmax)
77         beta = (pi_d - grossismx * ffdx) / (pi_d - ffdx)         beta = (pi_d - grossismx * ffdx(nmax)) / (pi_d - ffdx(nmax))
78         print *, "beta = ", beta         print *, "beta = ", beta
79    
80         IF (2. * beta - grossismx <= 0.) THEN         IF (2d0 * beta - grossismx <= 0d0) THEN
81            print *, 'Bad choice of grossismx, taux, dzoomx.'            print *, 'Bad choice of grossismx, taux, dzoomx.'
82            print *, 'Decrease dzoomx or grossismx.'            print *, 'Decrease dzoomx or grossismx.'
83            STOP 1            STOP 1
84         END IF         END IF
85    
86         ! 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)  
87    
88         ! Calcul de Xf         Xf(:nmax - 1) = beta * xtild(:nmax - 1) + (grossismx - beta) &
89                * ffdx(:nmax - 1)
90           Xf(nmax) = pi_d
91    
92         xxpr(nmax + 1:2 * nmax) = beta + (grossismx - beta) * fxm         call invert_zoom_x(xf, xtild, G, rlonm025(:iim), xprimm025(:iim), &
        xxpr(:nmax) = xxpr(2 * nmax:nmax + 1:- 1)  
   
        Xf(0) = - pi_d  
   
        DO i=1, 2 * nmax - 1  
           Xf(i) = Xf(i-1) + xxpr(i) * (xtild(i) - xtild(i-1))  
        END DO  
   
        Xf(2 * nmax) = pi_d  
   
        call invert_zoom_x(xf, xtild, Xprimt, rlonm025(:iim), xprimm025(:iim), &  
93              xuv = - 0.25d0)              xuv = - 0.25d0)
94         call invert_zoom_x(xf, xtild, Xprimt, rlonv(:iim), xprimv(:iim), &         call invert_zoom_x(xf, xtild, G, rlonv(:iim), xprimv(:iim), xuv = 0d0)
95              xuv = 0d0)         call invert_zoom_x(xf, xtild, G, rlonu(:iim), xprimu(:iim), xuv = 0.5d0)
96         call invert_zoom_x(xf, xtild, Xprimt, rlonu(:iim), xprimu(:iim), &         call invert_zoom_x(xf, xtild, G, rlonp025(:iim), xprimp025(:iim), &
             xuv = 0.5d0)  
        call invert_zoom_x(xf, xtild, Xprimt, rlonp025(:iim), xprimp025(:iim), &  
97              xuv = 0.25d0)              xuv = 0.25d0)
98      end if test_grossismx      end if
99    
100      is2 = 0      is2 = 0
101    

Legend:
Removed from v.144  
changed lines
  Added in v.151

  ViewVC Help
Powered by ViewVC 1.1.21