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

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

Put dimensions.h and paramet.h into modules

File size: 1.1 KB
RevLine 
[2218]1module principal_cshift_m
2
[5113]3  IMPLICIT NONE
[2218]4
[5119]5CONTAINS
[2218]6
[5103]7  SUBROUTINE principal_cshift(is2, xlon, xprimm)
[2218]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
[5159]13  USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
[5117]14    USE lmdz_physical_constants, ONLY: twopi
15    USE serre_mod, ONLY: clon
[2218]16
[5159]17
[2218]18    ! for iim
19
[5117]20    INTEGER, INTENT(IN):: is2
21    REAL, INTENT(INOUT):: xlon(:), xprimm(:) ! (iim + 1)
[2218]22
23    !-----------------------------------------------------
24
[5117]25    IF (is2 /= 0) THEN
[2218]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
[5103]42  END SUBROUTINE  principal_cshift
[2218]43
[5119]44END MODULE principal_cshift_m
Note: See TracBrowser for help on using the repository browser.