source: CONFIG/UNIFORM/v6/IPSLCM6.2/SOURCES/NEMO/cpl_oasis3.F90 @ 4701

Last change on this file since 4701 was 4417, checked in by cetlod, 5 years ago

IPSLCM6.2 : modifying coupled OA oasis interface to be able to run with LMDZ up-to-date version

File size: 25.2 KB
Line 
1
2MODULE cpl_oasis3
3   !!======================================================================
4   !!                    ***  MODULE cpl_oasis  ***
5   !! Coupled O/A : coupled ocean-atmosphere case using OASIS3-MCT
6   !!=====================================================================
7   !! History :   
8   !!   9.0  !  04-06  (R. Redler, NEC Laboratories Europe, Germany) Original code
9   !!   " "  !  04-11  (R. Redler, NEC Laboratories Europe; N. Keenlyside, W. Park, IFM-GEOMAR, Germany) revision
10   !!   " "  !  04-11  (V. Gayler, MPI M&D) Grid writing
11   !!   " "  !  05-08  (R. Redler, W. Park) frld initialization, paral(2) revision
12   !!   " "  !  05-09  (R. Redler) extended to allow for communication over root only
13   !!   " "  !  06-01  (W. Park) modification of physical part
14   !!   " "  !  06-02  (R. Redler, W. Park) buffer array fix for root exchange
15   !!   3.4  !  11-11  (C. Harris) Changes to allow mutiple category fields
16   !!----------------------------------------------------------------------
17   !!----------------------------------------------------------------------
18   !!   'key_oasis3'                    coupled Ocean/Atmosphere via OASIS3-MCT
19   !!   'key_oa3mct_v3'                 to be added for OASIS3-MCT version 3
20   !!----------------------------------------------------------------------
21   !!   cpl_init     : initialization of coupled mode communication
22   !!   cpl_define   : definition of grid and fields
23   !!   cpl_snd     : snd out fields in coupled mode
24   !!   cpl_rcv     : receive fields in coupled mode
25   !!   cpl_finalize : finalize the coupled mode communication
26   !!----------------------------------------------------------------------
27#if defined key_oasis3
28   USE mod_oasis                    ! OASIS3-MCT module
29#endif
30   USE par_oce                      ! ocean parameters
31   USE dom_oce                      ! ocean space and time domain
32   USE in_out_manager               ! I/O manager
33   USE lbclnk                       ! ocean lateral boundary conditions (or mpp link)
34   USE xios
35
36   IMPLICIT NONE
37   PRIVATE
38
39   PUBLIC   cpl_init
40   PUBLIC   cpl_define
41   PUBLIC   cpl_snd
42   PUBLIC   cpl_rcv
43   PUBLIC   cpl_freq
44   PUBLIC   cpl_finalize
45
46   INTEGER, PUBLIC            ::   OASIS_Rcv  = 1    !: return code if received field
47   INTEGER, PUBLIC            ::   OASIS_idle = 0    !: return code if nothing done by oasis
48   INTEGER                    ::   ncomp_id          ! id returned by oasis_init_comp
49   INTEGER                    ::   nerror            ! return error code
50#if ! defined key_oasis3
51   ! OASIS Variables not used. defined only for compilation purpose
52   INTEGER                    ::   OASIS_Out         = -1
53   INTEGER                    ::   OASIS_REAL        = -1
54   INTEGER                    ::   OASIS_Ok          = -1
55   INTEGER                    ::   OASIS_In          = -1
56   INTEGER                    ::   OASIS_Sent        = -1
57   INTEGER                    ::   OASIS_SentOut     = -1
58   INTEGER                    ::   OASIS_ToRest      = -1
59   INTEGER                    ::   OASIS_ToRestOut   = -1
60   INTEGER                    ::   OASIS_Recvd       = -1
61   INTEGER                    ::   OASIS_RecvOut     = -1
62   INTEGER                    ::   OASIS_FromRest    = -1
63   INTEGER                    ::   OASIS_FromRestOut = -1
64#endif
65
66   INTEGER                    ::   nrcv         ! total number of fields received
67   INTEGER                    ::   nsnd         ! total number of fields sent
68   INTEGER                    ::   ncplmodel    ! Maximum number of models to/from which NEMO is potentialy sending/receiving data
69   INTEGER, PUBLIC, PARAMETER ::   nmaxfld=50   ! Maximum number of coupling fields
70   INTEGER, PUBLIC, PARAMETER ::   nmaxcat=5    ! Maximum number of coupling fields
71   INTEGER, PUBLIC, PARAMETER ::   nmaxcpl=5    ! Maximum number of coupling fields
72   
73   TYPE, PUBLIC ::   FLD_CPL               !: Type for coupling field information
74      LOGICAL               ::   laction   ! To be coupled or not
75      CHARACTER(len = 8)    ::   clname    ! Name of the coupling field   
76      CHARACTER(len = 1)    ::   clgrid    ! Grid type 
77      REAL(wp)              ::   nsgn      ! Control of the sign change
78      INTEGER, DIMENSION(nmaxcat,nmaxcpl) ::   nid   ! Id of the field (no more than 9 categories and 9 extrena models)
79      INTEGER               ::   nct       ! Number of categories in field
80      INTEGER               ::   ncplmodel ! Maximum number of models to/from which this variable may be sent/received
81   END TYPE FLD_CPL
82
83   TYPE(FLD_CPL), DIMENSION(nmaxfld), PUBLIC ::   srcv, ssnd   !: Coupling fields
84
85   REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   exfld   ! Temporary buffer for receiving
86
87   !!----------------------------------------------------------------------
88   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
89   !! $Id: cpl_oasis3.F90 7846 2017-03-30 13:25:01Z cetlod $
90   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
91   !!----------------------------------------------------------------------
92CONTAINS
93
94   SUBROUTINE cpl_init( cd_modname, kl_comm )
95      !!-------------------------------------------------------------------
96      !!             ***  ROUTINE cpl_init  ***
97      !!
98      !! ** Purpose :   Initialize coupled mode communication for ocean
99      !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software)
100      !!
101      !! ** Method  :   OASIS3 MPI communication
102      !!--------------------------------------------------------------------
103      CHARACTER(len = *), INTENT(in) ::   cd_modname   ! model name as set in namcouple file
104      INTEGER          , INTENT(out) ::   kl_comm      ! local communicator of the model
105      !!--------------------------------------------------------------------
106
107      ! WARNING: No write in numout in this routine
108      !============================================
109
110      !------------------------------------------------------------------
111      ! 1st Initialize the OASIS system for the application
112      !------------------------------------------------------------------
113      CALL oasis_init_comp ( ncomp_id, TRIM(cd_modname), nerror )
114      IF ( nerror /= OASIS_Ok ) &
115         CALL oasis_abort (ncomp_id, 'cpl_init', 'Failure in oasis_init_comp')
116
117      !------------------------------------------------------------------
118      ! 3rd Get an MPI communicator for OPA local communication
119      !------------------------------------------------------------------
120
121      CALL oasis_get_localcomm ( kl_comm, nerror )
122      IF ( nerror /= OASIS_Ok ) &
123         CALL oasis_abort (ncomp_id, 'cpl_init','Failure in oasis_get_localcomm' )
124      !
125   END SUBROUTINE cpl_init
126
127
128   SUBROUTINE cpl_define( krcv, ksnd, kcplmodel )
129      !!-------------------------------------------------------------------
130      !!             ***  ROUTINE cpl_define  ***
131      !!
132      !! ** Purpose :   Define grid and field information for ocean
133      !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software)
134      !!
135      !! ** Method  :   OASIS3 MPI communication
136      !!--------------------------------------------------------------------
137      INTEGER, INTENT(in) ::   krcv, ksnd     ! Number of received and sent coupling fields
138      INTEGER, INTENT(in) ::   kcplmodel      ! Maximum number of models to/from which NEMO is potentialy sending/receiving data
139      !
140      INTEGER :: id_part
141      INTEGER :: paral(5)       ! OASIS3 box partition
142      INTEGER :: ishape(2,2)    ! shape of arrays passed to PSMILe
143      INTEGER :: ji,jc,jm       ! local loop indicees
144      CHARACTER(LEN=64) :: zclname
145      CHARACTER(LEN=2) :: cli2
146      !!--------------------------------------------------------------------
147
148      IF(lwp) WRITE(numout,*)
149      IF(lwp) WRITE(numout,*) 'cpl_define : initialization in coupled ocean/atmosphere case'
150      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~~~'
151      IF(lwp) WRITE(numout,*)
152
153      ncplmodel = kcplmodel
154      IF( kcplmodel > nmaxcpl ) THEN
155         CALL oasis_abort ( ncomp_id, 'cpl_define', 'ncplmodel is larger than nmaxcpl, increase nmaxcpl')   ;   RETURN
156      ENDIF
157
158      nrcv = krcv
159      IF( nrcv > nmaxfld ) THEN
160         CALL oasis_abort ( ncomp_id, 'cpl_define', 'nrcv is larger than nmaxfld, increase nmaxfld')   ;   RETURN
161      ENDIF
162
163      nsnd = ksnd
164      IF( nsnd > nmaxfld ) THEN
165         CALL oasis_abort ( ncomp_id, 'cpl_define', 'nsnd is larger than nmaxfld, increase nmaxfld')   ;   RETURN
166      ENDIF
167
168      !
169      ! ... Define the shape for the area that excludes the halo
170      !     For serial configuration (key_mpp_mpi not being active)
171      !     nl* is set to the global values 1 and jp*glo.
172      !
173      ishape(:,1) = (/ 1, nlei-nldi+1 /)
174      ishape(:,2) = (/ 1, nlej-nldj+1 /)
175      !
176      ! ... Allocate memory for data exchange
177      !
178      ALLOCATE(exfld(nlei-nldi+1, nlej-nldj+1), stat = nerror)
179      IF( nerror > 0 ) THEN
180         CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in allocating exfld')   ;   RETURN
181      ENDIF
182      !
183      ! -----------------------------------------------------------------
184      ! ... Define the partition
185      ! -----------------------------------------------------------------
186     
187      paral(1) = 2                                              ! box partitioning
188      paral(2) = jpiglo * (nldj-1+njmpp-1) + (nldi-1+nimpp-1)   ! NEMO lower left corner global offset   
189      paral(3) = nlei-nldi+1                                    ! local extent in i
190      paral(4) = nlej-nldj+1                                    ! local extent in j
191      paral(5) = jpiglo                                         ! global extent in x
192     
193      IF( ln_ctl ) THEN
194         WRITE(numout,*) ' multiexchg: paral (1:5)', paral
195         WRITE(numout,*) ' multiexchg: jpi, jpj =', jpi, jpj
196         WRITE(numout,*) ' multiexchg: nldi, nlei, nimpp =', nldi, nlei, nimpp
197         WRITE(numout,*) ' multiexchg: nldj, nlej, njmpp =', nldj, nlej, njmpp
198      ENDIF
199     
200      CALL oasis_def_partition ( id_part, paral, nerror, jpiglo*jpjglo )
201      !
202      ! ... Announce send variables.
203      !
204      ssnd(:)%ncplmodel = kcplmodel
205      !
206      DO ji = 1, ksnd
207         IF ( ssnd(ji)%laction ) THEN
208
209            IF( ssnd(ji)%nct > nmaxcat ) THEN
210               CALL oasis_abort ( ncomp_id, 'cpl_define', 'Number of categories of '//   &
211                  &              TRIM(ssnd(ji)%clname)//' is larger than nmaxcat, increase nmaxcat' )
212               RETURN
213            ENDIF
214           
215            DO jc = 1, ssnd(ji)%nct
216               DO jm = 1, kcplmodel
217
218                  IF ( ssnd(ji)%nct .GT. 1 ) THEN
219                     WRITE(cli2,'(i2.2)') jc
220                     zclname = TRIM(ssnd(ji)%clname)//'_cat'//cli2
221                  ELSE
222                     zclname = ssnd(ji)%clname
223                  ENDIF
224                  IF ( kcplmodel  > 1 ) THEN
225                     WRITE(cli2,'(i2.2)') jm
226                     zclname = 'model'//cli2//'_'//TRIM(zclname)
227                  ENDIF
228#if defined key_agrif
229                  IF( agrif_fixed() /= 0 ) THEN
230                     zclname=TRIM(Agrif_CFixed())//'_'//TRIM(zclname)
231                  END IF
232#endif
233                  IF( ln_ctl ) WRITE(numout,*) "Define", ji, jc, jm, " "//TRIM(zclname), " for ", OASIS_Out
234                  CALL oasis_def_var (ssnd(ji)%nid(jc,jm), zclname, id_part   , (/ 2, 0 /),   &
235                     &                OASIS_Out          , ishape , OASIS_REAL, nerror )
236                  IF ( nerror /= OASIS_Ok ) THEN
237                     WRITE(numout,*) 'Failed to define transient ', ji, jc, jm, " "//TRIM(zclname)
238                     CALL oasis_abort ( ssnd(ji)%nid(jc,jm), 'cpl_define', 'Failure in oasis_def_var' )
239                  ENDIF
240                  IF( ln_ctl .AND. ssnd(ji)%nid(jc,jm) /= -1 ) WRITE(numout,*) "variable defined in the namcouple"
241                  IF( ln_ctl .AND. ssnd(ji)%nid(jc,jm) == -1 ) WRITE(numout,*) "variable NOT defined in the namcouple"
242               END DO
243            END DO
244         ENDIF
245      END DO
246      !
247      ! ... Announce received variables.
248      !
249      srcv(:)%ncplmodel = kcplmodel
250      !
251      DO ji = 1, krcv
252         IF ( srcv(ji)%laction ) THEN
253           
254            IF( srcv(ji)%nct > nmaxcat ) THEN
255               CALL oasis_abort ( ncomp_id, 'cpl_define', 'Number of categories of '//   &
256                  &              TRIM(srcv(ji)%clname)//' is larger than nmaxcat, increase nmaxcat' )
257               RETURN
258            ENDIF
259           
260            DO jc = 1, srcv(ji)%nct
261               DO jm = 1, kcplmodel
262                 
263                  IF ( srcv(ji)%nct .GT. 1 ) THEN
264                     WRITE(cli2,'(i2.2)') jc
265                     zclname = TRIM(srcv(ji)%clname)//'_cat'//cli2
266                  ELSE
267                     zclname = srcv(ji)%clname
268                  ENDIF
269                  IF ( kcplmodel  > 1 ) THEN
270                     WRITE(cli2,'(i2.2)') jm
271                     zclname = 'model'//cli2//'_'//TRIM(zclname)
272                  ENDIF
273#if defined key_agrif
274                  IF( agrif_fixed() /= 0 ) THEN
275                     zclname=TRIM(Agrif_CFixed())//'_'//TRIM(zclname)
276                  END IF
277#endif
278                  IF( ln_ctl ) WRITE(numout,*) "Define", ji, jc, jm, " "//TRIM(zclname), " for ", OASIS_In
279                  CALL oasis_def_var (srcv(ji)%nid(jc,jm), zclname, id_part   , (/ 2, 0 /),   &
280                     &                OASIS_In           , ishape , OASIS_REAL, nerror )
281                  IF ( nerror /= OASIS_Ok ) THEN
282                     WRITE(numout,*) 'Failed to define transient ', ji, jc, jm, " "//TRIM(zclname)
283                     CALL oasis_abort ( srcv(ji)%nid(jc,jm), 'cpl_define', 'Failure in oasis_def_var' )
284                  ENDIF
285                  IF( ln_ctl .AND. srcv(ji)%nid(jc,jm) /= -1 ) WRITE(numout,*) "variable defined in the namcouple"
286                  IF( ln_ctl .AND. srcv(ji)%nid(jc,jm) == -1 ) WRITE(numout,*) "variable NOT defined in the namcouple"
287
288               END DO
289            END DO
290         ENDIF
291      END DO
292     
293      !------------------------------------------------------------------
294      ! End of definition phase
295      !------------------------------------------------------------------
296     
297      CALL xios_oasis_enddef()
298      CALL oasis_enddef(nerror)
299      IF( nerror /= OASIS_Ok )   CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in oasis_enddef')
300      !
301   END SUBROUTINE cpl_define
302   
303   
304   SUBROUTINE cpl_snd( kid, kstep, pdata, kinfo )
305      !!---------------------------------------------------------------------
306      !!              ***  ROUTINE cpl_snd  ***
307      !!
308      !! ** Purpose : - At each coupling time-step,this routine sends fields
309      !!      like sst or ice cover to the coupler or remote application.
310      !!----------------------------------------------------------------------
311      INTEGER                   , INTENT(in   ) ::   kid       ! variable index in the array
312      INTEGER                   , INTENT(  out) ::   kinfo     ! OASIS3 info argument
313      INTEGER                   , INTENT(in   ) ::   kstep     ! ocean time-step in seconds
314      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pdata
315      !!
316      INTEGER                                   ::   jc,jm     ! local loop index
317      !!--------------------------------------------------------------------
318      !
319      ! snd data to OASIS3
320      !
321      DO jc = 1, ssnd(kid)%nct
322         DO jm = 1, ssnd(kid)%ncplmodel
323       
324            IF( ssnd(kid)%nid(jc,jm) /= -1 ) THEN
325               CALL oasis_put ( ssnd(kid)%nid(jc,jm), kstep, pdata(nldi:nlei, nldj:nlej,jc), kinfo )
326               
327               IF ( ln_ctl ) THEN       
328                  IF ( kinfo == OASIS_Sent     .OR. kinfo == OASIS_ToRest .OR.   &
329                     & kinfo == OASIS_SentOut  .OR. kinfo == OASIS_ToRestOut ) THEN
330                     WRITE(numout,*) '****************'
331                     WRITE(numout,*) 'oasis_put: Outgoing ', ssnd(kid)%clname
332                     WRITE(numout,*) 'oasis_put: ivarid ', ssnd(kid)%nid(jc,jm)
333                     WRITE(numout,*) 'oasis_put:  kstep ', kstep
334                     WRITE(numout,*) 'oasis_put:   info ', kinfo
335                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(:,:,jc))
336                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(:,:,jc))
337                     WRITE(numout,*) '     -     Sum value is ', SUM(pdata(:,:,jc))
338                     WRITE(numout,*) '****************'
339                  ENDIF
340               ENDIF
341               
342            ENDIF
343           
344         ENDDO
345      ENDDO
346      !
347    END SUBROUTINE cpl_snd
348
349
350   SUBROUTINE cpl_rcv( kid, kstep, pdata, pmask, kinfo )
351      !!---------------------------------------------------------------------
352      !!              ***  ROUTINE cpl_rcv  ***
353      !!
354      !! ** Purpose : - At each coupling time-step,this routine receives fields
355      !!      like stresses and fluxes from the coupler or remote application.
356      !!----------------------------------------------------------------------
357      INTEGER                   , INTENT(in   ) ::   kid       ! variable index in the array
358      INTEGER                   , INTENT(in   ) ::   kstep     ! ocean time-step in seconds
359      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pdata     ! IN to keep the value if nothing is done
360      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pmask     ! coupling mask
361      INTEGER                   , INTENT(  out) ::   kinfo     ! OASIS3 info argument
362      !!
363      INTEGER                                   ::   jc,jm     ! local loop index
364      LOGICAL                                   ::   llaction, llfisrt
365      !!--------------------------------------------------------------------
366      !
367      ! receive local data from OASIS3 on every process
368      !
369      kinfo = OASIS_idle
370      !
371      DO jc = 1, srcv(kid)%nct
372         llfisrt = .TRUE.
373
374         DO jm = 1, srcv(kid)%ncplmodel
375
376            IF( srcv(kid)%nid(jc,jm) /= -1 ) THEN
377
378               CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo )         
379               
380               llaction =  kinfo == OASIS_Recvd   .OR. kinfo == OASIS_FromRest .OR.   &
381                  &        kinfo == OASIS_RecvOut .OR. kinfo == OASIS_FromRestOut
382               
383               IF ( ln_ctl )   WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid(jc,jm)
384               
385               IF ( llaction ) THEN
386                 
387                  kinfo = OASIS_Rcv
388                  IF( llfisrt ) THEN
389                     pdata(nldi:nlei,nldj:nlej,jc) =                                 exfld(:,:) * pmask(nldi:nlei,nldj:nlej,jm)
390                     llfisrt = .FALSE.
391                  ELSE
392                     pdata(nldi:nlei,nldj:nlej,jc) = pdata(nldi:nlei,nldj:nlej,jc) + exfld(:,:) * pmask(nldi:nlei,nldj:nlej,jm)
393                  ENDIF
394                 
395                  IF ( ln_ctl ) THEN       
396                     WRITE(numout,*) '****************'
397                     WRITE(numout,*) 'oasis_get: Incoming ', srcv(kid)%clname
398                     WRITE(numout,*) 'oasis_get: ivarid '  , srcv(kid)%nid(jc,jm)
399                     WRITE(numout,*) 'oasis_get:   kstep', kstep
400                     WRITE(numout,*) 'oasis_get:   info ', kinfo
401                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(:,:,jc))
402                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(:,:,jc))
403                     WRITE(numout,*) '     -     Sum value is ', SUM(pdata(:,:,jc))
404                     WRITE(numout,*) '****************'
405                  ENDIF
406                 
407               ENDIF
408               
409            ENDIF
410           
411         ENDDO
412
413         !--- Fill the overlap areas and extra hallows (mpp)
414         !--- check periodicity conditions (all cases)
415         IF( .not. llfisrt )   CALL lbc_lnk( pdata(:,:,jc), srcv(kid)%clgrid, srcv(kid)%nsgn )   
416 
417      ENDDO
418      !
419   END SUBROUTINE cpl_rcv
420
421
422   INTEGER FUNCTION cpl_freq( cdfieldname ) 
423      !!---------------------------------------------------------------------
424      !!              ***  ROUTINE cpl_freq  ***
425      !!
426      !! ** Purpose : - send back the coupling frequency for a particular field
427      !!----------------------------------------------------------------------
428      CHARACTER(len = *), INTENT(in) ::   cdfieldname    ! field name as set in namcouple file
429      !!
430      INTEGER               :: id
431      INTEGER               :: info
432      INTEGER, DIMENSION(1) :: itmp
433      INTEGER               :: ji,jm     ! local loop index
434      INTEGER               :: mop
435      !!----------------------------------------------------------------------
436      cpl_freq = 0   ! defaut definition
437      id = -1        ! defaut definition
438      !
439      DO ji = 1, nsnd
440         IF (ssnd(ji)%laction ) THEN
441            DO jm = 1, ncplmodel
442               IF( ssnd(ji)%nid(1,jm) /= -1 ) THEN
443                  IF( TRIM(cdfieldname) == TRIM(ssnd(ji)%clname) ) THEN
444                     id = ssnd(ji)%nid(1,jm)
445                     mop = OASIS_Out
446                  ENDIF
447               ENDIF
448            ENDDO
449         ENDIF
450      ENDDO
451      DO ji = 1, nrcv
452         IF (srcv(ji)%laction ) THEN
453            DO jm = 1, ncplmodel
454               IF( srcv(ji)%nid(1,jm) /= -1 ) THEN
455                  IF( TRIM(cdfieldname) == TRIM(srcv(ji)%clname) ) THEN
456                     id = srcv(ji)%nid(1,jm)
457                     mop = OASIS_In
458                  ENDIF
459               ENDIF
460            ENDDO
461         ENDIF
462      ENDDO
463      !
464      IF( id /= -1 ) THEN
465#if defined key_oa3mct_v3
466         CALL oasis_get_freqs(id, mop, 1, itmp, info)
467#else
468         CALL oasis_get_freqs(id,      1, itmp, info)
469#endif
470         cpl_freq = itmp(1)
471      ENDIF
472      !
473   END FUNCTION cpl_freq
474
475
476   SUBROUTINE cpl_finalize
477      !!---------------------------------------------------------------------
478      !!              ***  ROUTINE cpl_finalize  ***
479      !!
480      !! ** Purpose : - Finalizes the coupling. If MPI_init has not been
481      !!      called explicitly before cpl_init it will also close
482      !!      MPI communication.
483      !!----------------------------------------------------------------------
484      !
485      DEALLOCATE( exfld )
486      IF (nstop == 0) THEN
487         CALL oasis_terminate( nerror )         
488      ELSE
489         CALL oasis_abort( ncomp_id, "cpl_finalize", "NEMO ABORT STOP" )
490      ENDIF       
491      !
492   END SUBROUTINE cpl_finalize
493
494#if ! defined key_oasis3
495
496   !!----------------------------------------------------------------------
497   !!   No OASIS Library          OASIS3 Dummy module...
498   !!----------------------------------------------------------------------
499
500   SUBROUTINE oasis_init_comp(k1,cd1,k2)
501      CHARACTER(*), INTENT(in   ) ::  cd1
502      INTEGER     , INTENT(  out) ::  k1,k2
503      k1 = -1 ; k2 = -1
504      WRITE(numout,*) 'oasis_init_comp: Error you sould not be there...', cd1
505   END SUBROUTINE oasis_init_comp
506
507   SUBROUTINE oasis_abort(k1,cd1,cd2)
508      INTEGER     , INTENT(in   ) ::  k1
509      CHARACTER(*), INTENT(in   ) ::  cd1,cd2
510      WRITE(numout,*) 'oasis_abort: Error you sould not be there...', cd1, cd2
511   END SUBROUTINE oasis_abort
512
513   SUBROUTINE oasis_get_localcomm(k1,k2)
514      INTEGER     , INTENT(  out) ::  k1,k2
515      k1 = -1 ; k2 = -1
516      WRITE(numout,*) 'oasis_get_localcomm: Error you sould not be there...'
517   END SUBROUTINE oasis_get_localcomm
518
519   SUBROUTINE oasis_def_partition(k1,k2,k3,k4)
520      INTEGER     , INTENT(  out) ::  k1,k3
521      INTEGER     , INTENT(in   ) ::  k2(5)
522      INTEGER     , INTENT(in   ) ::  k4
523      k1 = k2(1) ; k3 = k2(5)+k4
524      WRITE(numout,*) 'oasis_def_partition: Error you sould not be there...'
525   END SUBROUTINE oasis_def_partition
526
527   SUBROUTINE oasis_def_var(k1,cd1,k2,k3,k4,k5,k6,k7)
528      CHARACTER(*), INTENT(in   ) ::  cd1
529      INTEGER     , INTENT(in   ) ::  k2,k3(2),k4,k5(2,2),k6
530      INTEGER     , INTENT(  out) ::  k1,k7
531      k1 = -1 ; k7 = -1
532      WRITE(numout,*) 'oasis_def_var: Error you sould not be there...', cd1
533   END SUBROUTINE oasis_def_var
534
535   SUBROUTINE oasis_enddef(k1)
536      INTEGER     , INTENT(  out) ::  k1
537      k1 = -1
538      WRITE(numout,*) 'oasis_enddef: Error you sould not be there...'
539   END SUBROUTINE oasis_enddef
540 
541   SUBROUTINE oasis_put(k1,k2,p1,k3)
542      REAL(wp), DIMENSION(:,:), INTENT(in   ) ::  p1
543      INTEGER                 , INTENT(in   ) ::  k1,k2
544      INTEGER                 , INTENT(  out) ::  k3
545      k3 = -1
546      WRITE(numout,*) 'oasis_put: Error you sould not be there...'
547   END SUBROUTINE oasis_put
548
549   SUBROUTINE oasis_get(k1,k2,p1,k3)
550      REAL(wp), DIMENSION(:,:), INTENT(  out) ::  p1
551      INTEGER                 , INTENT(in   ) ::  k1,k2
552      INTEGER                 , INTENT(  out) ::  k3
553      p1(1,1) = -1. ; k3 = -1
554      WRITE(numout,*) 'oasis_get: Error you sould not be there...'
555   END SUBROUTINE oasis_get
556
557   SUBROUTINE oasis_get_freqs(k1,k2,k3,k4)
558      INTEGER              , INTENT(in   ) ::  k1,k2
559      INTEGER, DIMENSION(1), INTENT(  out) ::  k3
560      INTEGER              , INTENT(  out) ::  k4
561      k3(1) = k1 ; k4 = k2
562      WRITE(numout,*) 'oasis_get_freqs: Error you sould not be there...'
563   END SUBROUTINE oasis_get_freqs
564
565   SUBROUTINE oasis_terminate(k1)
566      INTEGER     , INTENT(  out) ::  k1
567      k1 = -1
568      WRITE(numout,*) 'oasis_terminate: Error you sould not be there...'
569   END SUBROUTINE oasis_terminate
570   
571#endif
572
573   !!=====================================================================
574END MODULE cpl_oasis3
Note: See TracBrowser for help on using the repository browser.