--- trunk/Sources/dyn3d/fxhyp.f 2015/06/16 17:27:33 146 +++ trunk/Sources/dyn3d/fxhyp.f 2015/06/17 16:40:24 148 @@ -12,7 +12,7 @@ ! Calcule les longitudes et dérivées dans la grille du GCM pour ! une fonction f(x) à dérivée tangente hyperbolique. - ! Il vaut mieux avoir : grossismx \times dzoom < pi + ! Il vaut mieux avoir : grossismx \times delta < pi ! Le premier point scalaire pour une grille regulière (grossismx = ! 1., taux = 0., clon = 0.) est à - 180 degrés. @@ -29,17 +29,17 @@ ! Local: real rlonm025(iim + 1), rlonp025(iim + 1), d_rlonv(iim) - REAL dzoom, step - DOUBLE PRECISION, dimension(0:nmax):: xtild, fhyp, G, Xf - DOUBLE PRECISION ffdx, beta + REAL delta, step + DOUBLE PRECISION, dimension(0:nmax):: xtild, fhyp, G, Xf, ffdx + DOUBLE PRECISION beta INTEGER i, is2 - DOUBLE PRECISION xxpr(nmax - 1), xmoy(nmax), fxm(nmax) + DOUBLE PRECISION xmoy(nmax), fxm(nmax) !---------------------------------------------------------------------- print *, "Call sequence information: fxhyp" - test_grossismx: if (grossismx == 1.) then + if (grossismx == 1.) then step = twopi / iim xprimm025(:iim) = step @@ -51,33 +51,33 @@ rlonm025(:iim) = rlonv(:iim) - 0.25 * step rlonp025(:iim) = rlonv(:iim) + 0.25 * step rlonu(:iim) = rlonv(:iim) + 0.5 * step - else test_grossismx - dzoom = dzoomx * twopi_d + else + delta = dzoomx * twopi_d xtild = arth(0d0, pi_d / nmax, nmax + 1) forall (i = 1:nmax) xmoy(i) = 0.5d0 * (xtild(i-1) + xtild(i)) ! Compute fhyp: - fhyp(1:nmax - 1) = tanh_cautious(taux * (dzoom / 2. & + fhyp(1:nmax - 1) = tanh_cautious(taux * (delta / 2d0 & - xtild(1:nmax - 1)), xtild(1:nmax - 1) & * (pi_d - xtild(1:nmax - 1))) fhyp(0) = 1d0 fhyp(nmax) = -1d0 - fxm = tanh_cautious(taux * (dzoom / 2. - xmoy), xmoy * (pi_d - xmoy)) + fxm = tanh_cautious(taux * (delta / 2d0 - xmoy), xmoy * (pi_d - xmoy)) - ! Calcul de beta + ! Compute \int_0 ^{\tilde x} F: - ffdx = 0. + ffdx(0) = 0d0 DO i = 1, nmax - ffdx = ffdx + fxm(i) * (xtild(i) - xtild(i-1)) + ffdx(i) = ffdx(i - 1) + fxm(i) * (xtild(i) - xtild(i-1)) END DO - print *, "ffdx = ", ffdx - beta = (pi_d - grossismx * ffdx) / (pi_d - ffdx) + print *, "ffdx(nmax) = ", ffdx(nmax) + beta = (pi_d - grossismx * ffdx(nmax)) / (pi_d - ffdx(nmax)) print *, "beta = ", beta - IF (2. * beta - grossismx <= 0.) THEN + IF (2d0 * beta - grossismx <= 0d0) THEN print *, 'Bad choice of grossismx, taux, dzoomx.' print *, 'Decrease dzoomx or grossismx.' STOP 1 @@ -85,15 +85,8 @@ G = beta + (grossismx - beta) * fhyp - ! Calcul de Xf - - xxpr = beta + (grossismx - beta) * fxm(:nmax - 1) - Xf(0) = 0d0 - - DO i = 1, nmax - 1 - Xf(i) = Xf(i-1) + xxpr(i) * (xtild(i) - xtild(i-1)) - END DO - + Xf(:nmax - 1) = beta * xtild(:nmax - 1) + (grossismx - beta) & + * ffdx(:nmax - 1) Xf(nmax) = pi_d call invert_zoom_x(xf, xtild, G, rlonm025(:iim), xprimm025(:iim), & @@ -102,7 +95,7 @@ call invert_zoom_x(xf, xtild, G, rlonu(:iim), xprimu(:iim), xuv = 0.5d0) call invert_zoom_x(xf, xtild, G, rlonp025(:iim), xprimp025(:iim), & xuv = 0.25d0) - end if test_grossismx + end if is2 = 0