source: LMDZ6/branches/Amaury_dev/libf/dyn3d_common/principal_cshift_m.F90 @ 5186

Last change on this file since 5186 was 5159, checked in by abarral, 3 months ago

Put dimensions.h and paramet.h into modules

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 lmdz_dimensions, ONLY: iim, jjm, llm, ndm
14    USE lmdz_physical_constants, ONLY: twopi
15    USE serre_mod, ONLY: clon
16
17
18    ! for iim
19
20    INTEGER, INTENT(IN):: is2
21    REAL, INTENT(INOUT):: xlon(:), xprimm(:) ! (iim + 1)
22
23    !-----------------------------------------------------
24
25    IF (is2 /= 0) THEN
26       IF (clon <= 0.) THEN
27          IF (is2 /= 1) THEN
28             xlon(:is2 - 1) = xlon(:is2 - 1) + twopi
29             xlon(:iim) = cshift(xlon(:iim), shift = is2 - 1)
30             xprimm(:iim) = cshift(xprimm(:iim), shift = is2 - 1)
31          END IF
32       else
33          xlon(is2 + 1:iim) = xlon(is2 + 1:iim) - twopi
34          xlon(:iim) = cshift(xlon(:iim), shift = is2)
35          xprimm(:iim) = cshift(xprimm(:iim), shift = is2)
36       end IF
37    end if
38
39    xlon(iim + 1) = xlon(1) + twopi
40    xprimm(iim + 1) = xprimm(1)
41
42  END SUBROUTINE  principal_cshift
43
44END MODULE principal_cshift_m
Note: See TracBrowser for help on using the repository browser.