SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
sfx_oasis_def_ol.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 !#########
6 SUBROUTINE sfx_oasis_def_ol (I, &
7  u, &
8  hprogram,halg_mpi)
9 !#############################################
10 !
11 !!**** *SFX_OASIS_DEF_OL* - Offline driver for definitions for exchange of coupling fields
12 !!
13 !! PURPOSE
14 !! -------
15 !!
16 !!** METHOD
17 !! ------
18 !!
19 !! EXTERNAL
20 !! --------
21 !!
22 !!
23 !! IMPLICIT ARGUMENTS
24 !! ------------------
25 !!
26 !! REFERENCE
27 !! ---------
28 !!
29 !!
30 !! AUTHOR
31 !! ------
32 !! B. Decharme *Meteo France*
33 !!
34 !! MODIFICATIONS
35 !! -------------
36 !! Original 10/2013
37 !-------------------------------------------------------------------------------
38 !
39 !* 0. DECLARATIONS
40 ! ------------
41 !
42 !
43 !
44 !
45 USE modd_isba_n, ONLY : isba_t
46 !
47 USE modd_surf_atm_n, ONLY : surf_atm_t
48 !
49 USE modd_surf_par, ONLY : xundef
50 !
51 USE modd_surfex_mpi, ONLY : nproc, nrank, nindex
52 !
53 !
54 USE modi_sfx_oasis_define
55 !
56 #ifdef CPLOASIS
57 USE mod_oasis
58 #endif
59 !
60 USE yomhook ,ONLY : lhook, dr_hook
61 USE parkind1 ,ONLY : jprb
62 !
63 IMPLICIT NONE
64 !
65 !* 0.1 Declarations of arguments
66 ! -------------------------
67 !
68 !
69 !
70 TYPE(isba_t), INTENT(INOUT) :: i
71 !
72 TYPE(surf_atm_t), INTENT(INOUT) :: u
73 !
74  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! program calling surf. schemes
75  CHARACTER(LEN=4), INTENT(IN) :: halg_mpi ! decomposition algorithm
76 !
77 !
78 !* 0.2 Declarations of local variables
79 ! -------------------------------
80 !
81 INTEGER, DIMENSION(:), ALLOCATABLE :: iparal
82 INTEGER, DIMENSION(:), ALLOCATABLE :: iseg_size
83 INTEGER, DIMENSION(:), ALLOCATABLE :: iseg_offset
84 !
85 INTEGER, DIMENSION(U%NDIM_FULL+1) :: iindex
86 !
87 INTEGER :: jproc, ji, jseg
88 INTEGER :: isegment, icount, inpar, inpts
89 !
90 REAL(KIND=JPRB) :: zhook_handle
91 !
92 !-------------------------------------------------------------------------------
93 !
94 IF (lhook) CALL dr_hook('SFX_OASIS_DEF_OL',0,zhook_handle)
95 !
96 !-------------------------------------------------------------------------------
97 #ifdef CPLOASIS
98 !-------------------------------------------------------------------------------
99 !
100 !* 1. Define ORANGE parallel partitions:
101 ! ----------------------------------
102 !
103 ! Number of segments for this proc
104 !
105 iindex(1:u%NDIM_FULL)=nindex(:)
106 iindex(u%NDIM_FULL+1)=nproc+10
107 isegment=0
108 DO ji=1,u%NDIM_FULL
109  IF(nindex(ji)==nrank.AND.nindex(ji)/=iindex(ji+1))THEN
110  isegment=isegment+1
111  ENDIF
112 ENDDO
113 !
114 inpar=2+2*isegment
115 !
116 ! Local offset and extent for this proc
117 !
118 ALLOCATE(iseg_size(isegment))
119 ALLOCATE(iseg_offset(isegment))
120 !
121 isegment=0
122 icount=0
123 DO ji=1,u%NDIM_FULL
124  IF(nindex(ji)==nrank)THEN
125  icount=icount+1
126  ENDIF
127  IF(nindex(ji)==nrank.AND.nindex(ji)/=iindex(ji+1))THEN
128  isegment =isegment+1
129  iseg_size(isegment)=icount
130  iseg_offset(isegment)=ji-icount
131  icount=0
132  ENDIF
133 ENDDO
134 !
135 ALLOCATE(iparal(inpar))
136 !
137 ! OASIS orange partition
138 !
139 iparal(clim_strategy) = clim_orange
140 !
141 ! Number of proc segments for OASIS
142 !
143 iparal(2) = isegment
144 !
145 ! Local offset and extent for OASIS
146 !
147 ji=2
148 inpts=0
149 DO jseg=1,isegment
150  ji=ji+1
151  iparal(ji) = iseg_offset(jseg)
152  ji=ji+1
153  iparal(ji) = iseg_size(jseg)
154  inpts=inpts+iseg_size(jseg)
155 ENDDO
156 !
157 DEALLOCATE(iseg_size )
158 DEALLOCATE(iseg_offset)
159 !
160 !
161 !* 2. Put definitions for exchange of coupling fields :
162 ! -------------------------------------------------
163 !
164  CALL sfx_oasis_define(i, u, &
165  hprogram,inpts,iparal)
166 !
167 DEALLOCATE(iparal)
168 !
169 !-------------------------------------------------------------------------------
170 #endif
171 !-------------------------------------------------------------------------------
172 !
173 IF (lhook) CALL dr_hook('SFX_OASIS_DEF_OL',1,zhook_handle)
174 !
175 !-------------------------------------------------------------------------------
176 !
177 END SUBROUTINE sfx_oasis_def_ol
subroutine sfx_oasis_define(I, U, HPROGRAM, KNPTS, KPARAL)
subroutine sfx_oasis_def_ol(I, U, HPROGRAM, HALG_MPI)