source: LMDZ6/trunk/libf/dyn3d_common/principal_cshift_m.F90 @ 4047

Last change on this file since 4047 was 2598, checked in by Ehouarn Millour, 8 years ago

Cleanup in the dynamics: turn serre.h into module serre_mod.F90
EM

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    use serre_mod, only: clon
15
16    include "dimensions.h"
17    ! for iim
18
19    integer, intent(in):: is2
20    real, intent(inout):: xlon(:), xprimm(:) ! (iim + 1)
21
22    !-----------------------------------------------------
23
24    if (is2 /= 0) then
25       IF (clon <= 0.) THEN
26          IF (is2 /= 1) THEN
27             xlon(:is2 - 1) = xlon(:is2 - 1) + twopi
28             xlon(:iim) = cshift(xlon(:iim), shift = is2 - 1)
29             xprimm(:iim) = cshift(xprimm(:iim), shift = is2 - 1)
30          END IF
31       else
32          xlon(is2 + 1:iim) = xlon(is2 + 1:iim) - twopi
33          xlon(:iim) = cshift(xlon(:iim), shift = is2)
34          xprimm(:iim) = cshift(xprimm(:iim), shift = is2)
35       end IF
36    end if
37
38    xlon(iim + 1) = xlon(1) + twopi
39    xprimm(iim + 1) = xprimm(1)
40
41  end subroutine principal_cshift
42
43end module principal_cshift_m
Note: See TracBrowser for help on using the repository browser.