source: LMDZ5/branches/AI-cosp/libf/dyn3d_common/principal_cshift_m.F90 @ 5429

Last change on this file since 5429 was 2218, checked in by lguez, 10 years ago

Bug fix in fxhyp. There was some bad logic for the shifting of
longitude grids rlonuv, rlonv, rlonm025 and rlonp025 toward [- pi,
pi]. In some cases, one of the four grids was not shifted and the
others were. For example, you could see the bug with: iim = 48, clon =
20, grossismx = 3, dzoomx = 0.15. The bad logic involved the variable
is2 in the loop on ik = 1, 4. The loop included some tests depending
on ik. The whole thing was quite convoluted. Rewrote fxhyp. In
particular, replaced the loop on ik by a call to a new procedure,
invert_zoom_x. fxhyp.F was in dyn3d, it is replaced by fxhyp_m.F90
which is in dyn3d_common. Removed several arguments of fxhyp: zoom
parameters are accessed through serre.h; rlonm025 and rlonp025 were
not used in inigeom; min and max of longitude steps are written inside
fxhyp.

Some simplifications and modernizations in fyhyp. In particular,
several arguments are removed: zoom parameters are accessed through
serre.h; yprimv was not used in inigeom; min and max of latitude steps
are written inside fyhyp.

Removed now useless intermediary procedure fxyhyper.

Changed default value of dzoomx and dzoomy from 0 to 0.2. dzoom[xy] is
only needed when grossism[xy] > 1 and then it should be > 0.

dzoom[xy] can no longer be the extent of the zoom in degrees: it must
be expressed as the fraction of the total domain.

File size: 1.1 KB
Line 
1module principal_cshift_m
2
3  implicit none
4
5contains
6
7  subroutine principal_cshift(is2, xlon, xprimm)
8
9    ! Add or subtract 2 pi so that xlon is near [-pi, pi], then cshift
10    ! so that xlon is in ascending order. Make the same cshift on
11    ! xprimm.
12
13    use nrtype, only: twopi
14
15    include "dimensions.h"
16    ! for iim
17
18    include "serre.h"
19    ! for clon
20
21    integer, intent(in):: is2
22    real, intent(inout):: xlon(:), xprimm(:) ! (iim + 1)
23
24    !-----------------------------------------------------
25
26    if (is2 /= 0) then
27       IF (clon <= 0.) THEN
28          IF (is2 /= 1) THEN
29             xlon(:is2 - 1) = xlon(:is2 - 1) + twopi
30             xlon(:iim) = cshift(xlon(:iim), shift = is2 - 1)
31             xprimm(:iim) = cshift(xprimm(:iim), shift = is2 - 1)
32          END IF
33       else
34          xlon(is2 + 1:iim) = xlon(is2 + 1:iim) - twopi
35          xlon(:iim) = cshift(xlon(:iim), shift = is2)
36          xprimm(:iim) = cshift(xprimm(:iim), shift = is2)
37       end IF
38    end if
39
40    xlon(iim + 1) = xlon(1) + twopi
41    xprimm(iim + 1) = xprimm(1)
42
43  end subroutine principal_cshift
44
45end module principal_cshift_m
Note: See TracBrowser for help on using the repository browser.