SURFEX v8.1
General documentation of Surfex
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 (IO, U, HPROGRAM,HALG_MPI)
7 !#############################################
8 !
9 !!**** *SFX_OASIS_DEF_OL* - Offline driver for definitions for exchange of coupling fields
10 !!
11 !! PURPOSE
12 !! -------
13 !!
14 !!** METHOD
15 !! ------
16 !!
17 !! EXTERNAL
18 !! --------
19 !!
20 !!
21 !! IMPLICIT ARGUMENTS
22 !! ------------------
23 !!
24 !! REFERENCE
25 !! ---------
26 !!
27 !!
28 !! AUTHOR
29 !! ------
30 !! B. Decharme *Meteo France*
31 !!
32 !! MODIFICATIONS
33 !! -------------
34 !! Original 10/2013
35 !-------------------------------------------------------------------------------
36 !
37 !* 0. DECLARATIONS
38 ! ------------
39 !
40 !
41 !
42 !
44 !
45 USE modd_surf_atm_n, ONLY : surf_atm_t
46 !
47 USE modd_surf_par, ONLY : xundef
48 !
49 USE modd_surfex_mpi, ONLY : nproc, nrank, nindex
50 !
51 !
52 USE modi_sfx_oasis_define
53 !
54 #ifdef CPLOASIS
55 USE mod_oasis
56 #endif
57 !
58 USE yomhook ,ONLY : lhook, dr_hook
59 USE parkind1 ,ONLY : jprb
60 !
61 IMPLICIT NONE
62 !
63 !* 0.1 Declarations of arguments
64 ! -------------------------
65 !
66 !
67 !
68 TYPE(isba_options_t), INTENT(INOUT) :: IO
69 !
70 TYPE(surf_atm_t), INTENT(INOUT) :: U
71 !
72  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling surf. schemes
73  CHARACTER(LEN=4), INTENT(IN) :: HALG_MPI ! decomposition algorithm
74 !
75 !
76 !* 0.2 Declarations of local variables
77 ! -------------------------------
78 !
79 INTEGER, DIMENSION(:), ALLOCATABLE :: IPARAL
80 INTEGER, DIMENSION(:), ALLOCATABLE :: ISEG_SIZE
81 INTEGER, DIMENSION(:), ALLOCATABLE :: ISEG_OFFSET
82 !
83 INTEGER, DIMENSION(U%NDIM_FULL+1) :: IINDEX
84 !
85 INTEGER :: JPROC, JI, JSEG
86 INTEGER :: ISEGMENT, ICOUNT, INPAR, INPTS
87 !
88 REAL(KIND=JPRB) :: ZHOOK_HANDLE
89 !
90 !-------------------------------------------------------------------------------
91 !
92 IF (lhook) CALL dr_hook('SFX_OASIS_DEF_OL',0,zhook_handle)
93 !
94 !-------------------------------------------------------------------------------
95 #ifdef CPLOASIS
96 !-------------------------------------------------------------------------------
97 !
98 !* 1. Define ORANGE parallel partitions:
99 ! ----------------------------------
100 !
101 ! Number of segments for this proc
102 !
103 iindex(1:u%NDIM_FULL)=nindex(:)
104 iindex(u%NDIM_FULL+1)=nproc+10
105 isegment=0
106 DO ji=1,u%NDIM_FULL
107  IF(nindex(ji)==nrank.AND.nindex(ji)/=iindex(ji+1))THEN
108  isegment=isegment+1
109  ENDIF
110 ENDDO
111 !
112 inpar=2+2*isegment
113 !
114 ! Local offset and extent for this proc
115 !
116 ALLOCATE(iseg_size(isegment))
117 ALLOCATE(iseg_offset(isegment))
118 !
119 isegment=0
120 icount=0
121 DO ji=1,u%NDIM_FULL
122  IF(nindex(ji)==nrank)THEN
123  icount=icount+1
124  ENDIF
125  IF(nindex(ji)==nrank.AND.nindex(ji)/=iindex(ji+1))THEN
126  isegment =isegment+1
127  iseg_size(isegment)=icount
128  iseg_offset(isegment)=ji-icount
129  icount=0
130  ENDIF
131 ENDDO
132 !
133 ALLOCATE(iparal(inpar))
134 !
135 ! OASIS orange partition
136 !
137 iparal(clim_strategy) = clim_orange
138 !
139 ! Number of proc segments for OASIS
140 !
141 iparal(2) = isegment
142 !
143 ! Local offset and extent for OASIS
144 !
145 ji=2
146 inpts=0
147 DO jseg=1,isegment
148  ji=ji+1
149  iparal(ji) = iseg_offset(jseg)
150  ji=ji+1
151  iparal(ji) = iseg_size(jseg)
152  inpts=inpts+iseg_size(jseg)
153 ENDDO
154 !
155 DEALLOCATE(iseg_size )
156 DEALLOCATE(iseg_offset)
157 !
158 !
159 !* 2. Put definitions for exchange of coupling fields :
160 ! -------------------------------------------------
161 !
162  CALL sfx_oasis_define(io, u, hprogram,inpts,iparal)
163 !
164 DEALLOCATE(iparal)
165 !
166 !-------------------------------------------------------------------------------
167 #endif
168 !-------------------------------------------------------------------------------
169 !
170 IF (lhook) CALL dr_hook('SFX_OASIS_DEF_OL',1,zhook_handle)
171 !
172 !-------------------------------------------------------------------------------
173 !
174 END SUBROUTINE sfx_oasis_def_ol
subroutine sfx_oasis_def_ol(IO, U, HPROGRAM, HALG_MPI)
real, parameter xundef
integer, parameter jprb
Definition: parkind1.F90:32
subroutine sfx_oasis_define(IO, U, HPROGRAM, KNPTS, KPARAL)
logical lhook
Definition: yomhook.F90:15
integer, dimension(:), allocatable nindex