source: LMDZ6/trunk/libf/phylmd/rrtm/pe2set_mod.F90 @ 3981

Last change on this file since 3981 was 1990, checked in by Laurent Fairhead, 10 years ago

Corrections à la version r1989 pour permettre la compilation avec RRTM
Inclusion de la licence CeCILL_V2 pour RRTM


Changes to revision r1989 to enable RRTM code compilation
RRTM part put under CeCILL_V2 licence

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 2.9 KB
Line 
1MODULE PE2SET_MOD
2CONTAINS
3SUBROUTINE PE2SET(KPE,KPRGPNS,KPRGPEW,KPRTRW,KPRTRV)
4
5#ifdef DOC
6
7!**** *PE2SET* - Convert from PE number to set numbers
8
9!     Purpose.
10!     --------
11!        Convert from PE number to set numbers in both
12!                  grid-point space and spectral space
13
14!**   Interface.
15!     ----------
16!        *CALL* *PE2SET(KPE,KPRGPNS,KPRGPEW,KPRTRW,KPRTRV)
17
18!        Explicit arguments : 
19!        --------------------
20!                  input:   KPE     - integer processor number
21!                                     in the range 1 .. NPROC
22!                  output:  KPRGPNS - integer A set number in grid space
23!                                     in the range 1 .. NPRGPNS
24!                           KPRGPEW - integer B set number in grid space
25!                                     in the range 1 .. NPRGPEW
26!                           KPRTRW  - integer A set number in spectral space
27!                                     in the range 1 .. NPRTRW
28!                           KPRTRV  - integer B set number in spectral space
29!                                     in the range 1 .. NPRTRV
30
31!        Implicit arguments :  YOMMP parameters
32!                              NPRGPNS,NPRGPEW,NPRTRW,NPRTRV,NPROC
33
34!        --------------------
35!     Method.
36!     -------
37
38!        PE allocation order is row oriented (e.g. NPRGPNS or NPRTRW = 4):
39
40!                1  2  3  4
41!                5  6  7  8
42!                9 10 11 12
43!               13 14 15 16
44!                .  .  .  .
45
46!     Externals.
47!     ----------
48!         NONE
49
50!     Reference.
51!     ----------
52!        ECMWF Research Department documentation of the IFS
53
54!     Author.
55!     -------
56!        David Dent *ECMWF*
57
58!     Modifications.
59!     --------------
60!        Original : 98-08-19
61!        Revision : 98-10-13 row ordering
62!     ------------------------------------------------------------------
63#endif
64
65USE PARKIND1  ,ONLY : JPIM     ,JPRB
66
67USE TPM_DISTR
68USE EQ_REGIONS_MOD
69USE ABORT_TRANS_MOD
70
71
72IMPLICIT NONE
73INTEGER(KIND=JPIM),INTENT(IN)  :: KPE
74INTEGER(KIND=JPIM),INTENT(OUT) :: KPRGPNS,KPRGPEW,KPRTRW,KPRTRV
75
76INTEGER(KIND=JPIM) :: IPE,JA
77!     ------------------------------------------------------------------
78
79!*       1.    Check input argument for validity
80!              ---------------------------------
81
82IF(KPE <= 0.OR.KPE > NPROC) THEN
83  WRITE(*,'(A,2I8)') ' PE2SET INVALID ARGUMENT ',KPE,NPROC
84  CALL ABORT_TRANS(' PE2SET INVALID ARGUMENT ')
85
86ELSE
87
88!*       2.    Compute output parameters
89!              -------------------------
90
91  IF( LEQ_REGIONS )THEN
92    KPRGPNS=1
93    IPE=KPE
94    DO JA=1,N_REGIONS_NS
95      IF( IPE > N_REGIONS(JA) )THEN
96        IPE=IPE-N_REGIONS(JA)
97        KPRGPNS=KPRGPNS+1
98        CYCLE
99      ENDIF
100      KPRGPEW=IPE
101      EXIT
102    ENDDO
103  ELSE
104    KPRGPEW=MOD(KPE-1,NPRGPEW)+1
105    KPRGPNS=(KPE-1)/NPRGPEW+1
106  ENDIF
107  KPRTRV =MOD(KPE-1,NPRTRV)+1
108  KPRTRW =(KPE-1)/NPRTRV+1
109
110ENDIF
111
112END SUBROUTINE PE2SET
113END MODULE PE2SET_MOD
Note: See TracBrowser for help on using the repository browser.