New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
cpl_oasis3.F90 in branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90 @ 5220

Last change on this file since 5220 was 5220, checked in by smasson, 9 years ago

dev_r5218_CNRS17_coupling: first update

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