Ignore:
Timestamp:
03/21/23 14:42:28 (16 months ago)
Author:
cetlod
Message:

IPSLCM7_WORK : 1st step of coupling DYNAMICO-LMDZ-ORCHIDEE-NEMO4.2 + Oasis3-mct.5.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CONFIG/UNIFORM/v7/IPSLCM7/SOURCES/NEMO/cpl_oasis3.F90

    r6329 r6346  
    1  
    21MODULE cpl_oasis3 
    32   !!====================================================================== 
     
    54   !! Coupled O/A : coupled ocean-atmosphere case using OASIS3-MCT 
    65   !!===================================================================== 
    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    !!---------------------------------------------------------------------- 
     6   !! History :  1.0  !  2004-06  (R. Redler, NEC Laboratories Europe, Germany) Original code 
     7   !!             -   !  2004-11  (R. Redler, NEC Laboratories Europe; N. Keenlyside, W. Park, IFM-GEOMAR, Germany) revision 
     8   !!             -   !  2004-11  (V. Gayler, MPI M&D) Grid writing 
     9   !!            2.0  !  2005-08  (R. Redler, W. Park) frld initialization, paral(2) revision 
     10   !!             -   !  2005-09  (R. Redler) extended to allow for communication over root only 
     11   !!             -   !  2006-01  (W. Park) modification of physical part 
     12   !!             -   !  2006-02  (R. Redler, W. Park) buffer array fix for root exchange 
     13   !!            3.4  !  2011-11  (C. Harris) Changes to allow mutiple category fields 
     14   !!            3.6  !  2014-11  (S. Masson) OASIS3-MCT 
     15   !!---------------------------------------------------------------------- 
     16 
    1717   !!---------------------------------------------------------------------- 
    1818   !!   'key_oasis3'                    coupled Ocean/Atmosphere via OASIS3-MCT 
     
    2121   !!   cpl_init     : initialization of coupled mode communication 
    2222   !!   cpl_define   : definition of grid and fields 
    23    !!   cpl_snd     : snd out fields in coupled mode 
    24    !!   cpl_rcv     : receive fields in coupled mode 
     23   !!   cpl_snd      : snd out fields in coupled mode 
     24   !!   cpl_rcv      : receive fields in coupled mode 
    2525   !!   cpl_finalize : finalize the coupled mode communication 
    2626   !!---------------------------------------------------------------------- 
     
    6464#endif 
    6565 
    66    INTEGER                    ::   nrcv         ! total number of fields received  
    67    INTEGER                    ::   nsnd         ! total number of fields sent  
     66   INTEGER                    ::   nrcv         ! total number of fields received 
     67   INTEGER                    ::   nsnd         ! total number of fields sent 
    6868   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 
     69   INTEGER, PUBLIC, PARAMETER ::   nmaxfld=62   ! Maximum number of coupling fields 
    7070   INTEGER, PUBLIC, PARAMETER ::   nmaxcat=5    ! Maximum number of coupling fields 
    7171   INTEGER, PUBLIC, PARAMETER ::   nmaxcpl=5    ! Maximum number of coupling fields 
    72     
     72 
    7373   TYPE, PUBLIC ::   FLD_CPL               !: Type for coupling field information 
    7474      LOGICAL               ::   laction   ! To be coupled or not 
    75       CHARACTER(len = 8)    ::   clname    ! Name of the coupling field    
    76       CHARACTER(len = 1)    ::   clgrid    ! Grid type   
     75      CHARACTER(len = 8)    ::   clname    ! Name of the coupling field 
     76      CHARACTER(len = 1)    ::   clgrid    ! Grid type 
    7777      REAL(wp)              ::   nsgn      ! Control of the sign change 
    7878      INTEGER, DIMENSION(nmaxcat,nmaxcpl) ::   nid   ! Id of the field (no more than 9 categories and 9 extrena models) 
     
    8686 
    8787   !!---------------------------------------------------------------------- 
    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) 
     88   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     89   !! $Id: cpl_oasis3.F90 14434 2021-02-11 08:20:52Z smasson $ 
     90   !! Software governed by the CeCILL license (see ./LICENSE) 
    9191   !!---------------------------------------------------------------------- 
    9292CONTAINS 
     
    9999      !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software) 
    100100      !! 
    101       !! ** Method  :   OASIS3 MPI communication  
     101      !! ** Method  :   OASIS3 MPI communication 
    102102      !!-------------------------------------------------------------------- 
    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 
     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 
    105105      !!-------------------------------------------------------------------- 
    106106 
     
    112112      !------------------------------------------------------------------ 
    113113      CALL oasis_init_comp ( ncomp_id, TRIM(cd_modname), nerror ) 
    114       IF ( nerror /= OASIS_Ok ) & 
     114      IF( nerror /= OASIS_Ok ) & 
    115115         CALL oasis_abort (ncomp_id, 'cpl_init', 'Failure in oasis_init_comp') 
    116116 
    117117      !------------------------------------------------------------------ 
    118       ! 3rd Get an MPI communicator for OPA local communication 
     118      ! 3rd Get an MPI communicator for OCE local communication 
    119119      !------------------------------------------------------------------ 
    120120 
    121121      CALL oasis_get_localcomm ( kl_comm, nerror ) 
    122       IF ( nerror /= OASIS_Ok ) & 
     122      IF( nerror /= OASIS_Ok ) & 
    123123         CALL oasis_abort (ncomp_id, 'cpl_init','Failure in oasis_get_localcomm' ) 
    124124      ! 
     
    133133      !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software) 
    134134      !! 
    135       !! ** Method  :   OASIS3 MPI communication  
     135      !! ** Method  :   OASIS3 MPI communication 
    136136      !!-------------------------------------------------------------------- 
    137137      INTEGER, INTENT(in) ::   krcv, ksnd     ! Number of received and sent coupling fields 
     
    140140      INTEGER :: id_part 
    141141      INTEGER :: paral(5)       ! OASIS3 box partition 
    142       INTEGER :: ishape(2,2)    ! shape of arrays passed to PSMILe 
     142      INTEGER :: ishape(4)    ! shape of arrays passed to PSMILe 
    143143      INTEGER :: ji,jc,jm       ! local loop indicees 
    144144      CHARACTER(LEN=64) :: zclname 
     
    165165         CALL oasis_abort ( ncomp_id, 'cpl_define', 'nsnd is larger than nmaxfld, increase nmaxfld')   ;   RETURN 
    166166      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 /) 
     167      ! 
     168      ! ... Define the shape for the area that excludes the halo as we don't want them to be "seen" by oasis 
     169      ! 
     170      ishape(1) = 1 
     171      ishape(2) = Ni_0 
     172      ishape(3) = 1 
     173      ishape(4) = Nj_0 
    175174      ! 
    176175      ! ... Allocate memory for data exchange 
    177176      ! 
    178       ALLOCATE(exfld(nlei-nldi+1, nlej-nldj+1), stat = nerror) 
     177      ALLOCATE(exfld(Ni_0, Nj_0), stat = nerror)        ! allocate only inner domain (without halos) 
    179178      IF( nerror > 0 ) THEN 
    180179         CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in allocating exfld')   ;   RETURN 
     
    182181      ! 
    183182      ! ----------------------------------------------------------------- 
    184       ! ... Define the partition  
     183      ! ... Define the partition, excluding halos as we don't want them to be "seen" by oasis 
    185184      ! ----------------------------------------------------------------- 
    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 
     185 
     186      paral(1) = 2                                      ! box partitioning 
     187      paral(2) = Ni0glo * mjg0(nn_hls) + mig0(nn_hls)   ! NEMO lower left corner global offset, without halos 
     188      paral(3) = Ni_0                                   ! local extent in i, excluding halos 
     189      paral(4) = Nj_0                                   ! local extent in j, excluding halos 
     190      paral(5) = Ni0glo                                 ! global extent in x, excluding halos 
     191 
     192      IF( sn_cfctl%l_oasout ) THEN 
    194193         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.  
     194         WRITE(numout,*) ' multiexchg: Ni_0, Nj_0 =', Ni_0, Nj_0 
     195         WRITE(numout,*) ' multiexchg: Nis0, Nie0, nimpp =', Nis0, Nie0, nimpp 
     196         WRITE(numout,*) ' multiexchg: Njs0, Nje0, njmpp =', Njs0, Nje0, njmpp 
     197      ENDIF 
     198 
     199      CALL oasis_def_partition ( id_part, paral, nerror, Ni0glo*Nj0glo )   ! global number of points, excluding halos 
     200      ! 
     201      ! ... Announce send variables. 
    203202      ! 
    204203      ssnd(:)%ncplmodel = kcplmodel 
    205204      ! 
    206205      DO ji = 1, ksnd 
    207          IF ( ssnd(ji)%laction ) THEN 
     206         IF( ssnd(ji)%laction ) THEN 
    208207 
    209208            IF( ssnd(ji)%nct > nmaxcat ) THEN 
     
    212211               RETURN 
    213212            ENDIF 
    214              
     213 
    215214            DO jc = 1, ssnd(ji)%nct 
    216215               DO jm = 1, kcplmodel 
    217216 
    218                   IF ( ssnd(ji)%nct .GT. 1 ) THEN 
     217                  IF( ssnd(ji)%nct .GT. 1 ) THEN 
    219218                     WRITE(cli2,'(i2.2)') jc 
    220219                     zclname = TRIM(ssnd(ji)%clname)//'_cat'//cli2 
     
    222221                     zclname = ssnd(ji)%clname 
    223222                  ENDIF 
    224                   IF ( kcplmodel  > 1 ) THEN 
     223                  IF( kcplmodel  > 1 ) THEN 
    225224                     WRITE(cli2,'(i2.2)') jm 
    226225                     zclname = 'model'//cli2//'_'//TRIM(zclname) 
    227226                  ENDIF 
    228227#if defined key_agrif 
    229                   IF( agrif_fixed() /= 0 ) THEN  
     228                  IF( agrif_fixed() /= 0 ) THEN 
    230229                     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          , OASIS_REAL, nerror ) 
    236                   IF ( nerror /= OASIS_Ok ) THEN 
     230                  ENDIF 
     231#endif 
     232                  IF( sn_cfctl%l_oasout ) WRITE(numout,*) "Define", ji, jc, jm, " "//TRIM(zclname), " for ", OASIS_Out 
     233                  CALL oasis_def_var (ssnd(ji)%nid(jc,jm), zclname, id_part   , (/ 2, 1 /),   & 
     234                     &                OASIS_Out          , ishape , OASIS_REAL, nerror ) 
     235                  IF( nerror /= OASIS_Ok ) THEN 
    237236                     WRITE(numout,*) 'Failed to define transient ', ji, jc, jm, " "//TRIM(zclname) 
    238237                     CALL oasis_abort ( ssnd(ji)%nid(jc,jm), 'cpl_define', 'Failure in oasis_def_var' ) 
    239238                  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" 
     239                  IF( sn_cfctl%l_oasout .AND. ssnd(ji)%nid(jc,jm) /= -1 ) WRITE(numout,*) "variable defined in the namcouple" 
     240                  IF( sn_cfctl%l_oasout .AND. ssnd(ji)%nid(jc,jm) == -1 ) WRITE(numout,*) "variable NOT defined in the namcouple" 
    242241               END DO 
    243242            END DO 
     
    245244      END DO 
    246245      ! 
    247       ! ... Announce received variables.  
     246      ! ... Announce received variables. 
    248247      ! 
    249248      srcv(:)%ncplmodel = kcplmodel 
    250249      ! 
    251250      DO ji = 1, krcv 
    252          IF ( srcv(ji)%laction ) THEN  
    253              
     251         IF( srcv(ji)%laction ) THEN 
     252 
    254253            IF( srcv(ji)%nct > nmaxcat ) THEN 
    255254               CALL oasis_abort ( ncomp_id, 'cpl_define', 'Number of categories of '//   & 
     
    257256               RETURN 
    258257            ENDIF 
    259              
     258 
    260259            DO jc = 1, srcv(ji)%nct 
    261260               DO jm = 1, kcplmodel 
    262                    
    263                   IF ( srcv(ji)%nct .GT. 1 ) THEN 
     261 
     262                  IF( srcv(ji)%nct .GT. 1 ) THEN 
    264263                     WRITE(cli2,'(i2.2)') jc 
    265264                     zclname = TRIM(srcv(ji)%clname)//'_cat'//cli2 
     
    267266                     zclname = srcv(ji)%clname 
    268267                  ENDIF 
    269                   IF ( kcplmodel  > 1 ) THEN 
     268                  IF( kcplmodel  > 1 ) THEN 
    270269                     WRITE(cli2,'(i2.2)') jm 
    271270                     zclname = 'model'//cli2//'_'//TRIM(zclname) 
    272271                  ENDIF 
    273272#if defined key_agrif 
    274                   IF( agrif_fixed() /= 0 ) THEN  
     273                  IF( agrif_fixed() /= 0 ) THEN 
    275274                     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           , OASIS_REAL, nerror ) 
    281                   IF ( nerror /= OASIS_Ok ) THEN 
     275                  ENDIF 
     276#endif 
     277                  IF( sn_cfctl%l_oasout ) WRITE(numout,*) "Define", ji, jc, jm, " "//TRIM(zclname), " for ", OASIS_In 
     278                  CALL oasis_def_var (srcv(ji)%nid(jc,jm), zclname, id_part   , (/ 2, 1 /),   & 
     279                     &                OASIS_In           , ishape , OASIS_REAL, nerror ) 
     280                  IF( nerror /= OASIS_Ok ) THEN 
    282281                     WRITE(numout,*) 'Failed to define transient ', ji, jc, jm, " "//TRIM(zclname) 
    283282                     CALL oasis_abort ( srcv(ji)%nid(jc,jm), 'cpl_define', 'Failure in oasis_def_var' ) 
    284283                  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" 
     284                  IF( sn_cfctl%l_oasout .AND. srcv(ji)%nid(jc,jm) /= -1 ) WRITE(numout,*) "variable defined in the namcouple" 
     285                  IF( sn_cfctl%l_oasout .AND. srcv(ji)%nid(jc,jm) == -1 ) WRITE(numout,*) "variable NOT defined in the namcouple" 
    287286 
    288287               END DO 
     
    290289         ENDIF 
    291290      END DO 
    292        
     291 
    293292      !------------------------------------------------------------------ 
    294293      ! End of definition phase 
    295294      !------------------------------------------------------------------ 
    296        
     295      ! 
     296#if defined key_agrif 
     297      ! Warning: Agrif_Nb_Fine_Grids not yet defined at this stage for Agrif_Root -> must use Agrif_Root_Only() 
     298      IF( Agrif_Root_Only() .OR. agrif_fixed() == Agrif_Nb_Fine_Grids() ) THEN 
     299#endif 
    297300      CALL xios_oasis_enddef() 
    298301      CALL oasis_enddef(nerror) 
    299302      IF( nerror /= OASIS_Ok )   CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in oasis_enddef') 
     303#if defined key_agrif 
     304      ENDIF 
     305#endif 
    300306      ! 
    301307   END SUBROUTINE cpl_define 
    302     
    303     
     308 
     309 
    304310   SUBROUTINE cpl_snd( kid, kstep, pdata, kinfo ) 
    305311      !!--------------------------------------------------------------------- 
     
    321327      DO jc = 1, ssnd(kid)%nct 
    322328         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         
     329 
     330            IF( ssnd(kid)%nid(jc,jm) /= -1 ) THEN   ! exclude halos from data sent to oasis 
     331               CALL oasis_put ( ssnd(kid)%nid(jc,jm), kstep, pdata(Nis0:Nie0, Njs0:Nje0,jc), kinfo ) 
     332 
     333               IF ( sn_cfctl%l_oasout ) THEN 
    328334                  IF ( kinfo == OASIS_Sent     .OR. kinfo == OASIS_ToRest .OR.   & 
    329335                     & kinfo == OASIS_SentOut  .OR. kinfo == OASIS_ToRestOut ) THEN 
     
    333339                     WRITE(numout,*) 'oasis_put:  kstep ', kstep 
    334340                     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)) 
     341                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(Nis0:Nie0,Njs0:Nje0,jc)) 
     342                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(Nis0:Nie0,Njs0:Nje0,jc)) 
     343                     WRITE(numout,*) '     -     Sum value is ',    SUM(pdata(Nis0:Nie0,Njs0:Nje0,jc)) 
    338344                     WRITE(numout,*) '****************' 
    339345                  ENDIF 
    340346               ENDIF 
    341                 
     347 
    342348            ENDIF 
    343              
     349 
    344350         ENDDO 
    345351      ENDDO 
     
    362368      !! 
    363369      INTEGER                                   ::   jc,jm     ! local loop index 
    364       LOGICAL                                   ::   llaction, llfisrt 
     370      LOGICAL                                   ::   llaction, ll_1st 
    365371      !!-------------------------------------------------------------------- 
    366372      ! 
     
    370376      ! 
    371377      DO jc = 1, srcv(kid)%nct 
    372          llfisrt = .TRUE. 
     378         ll_1st = .TRUE. 
    373379 
    374380         DO jm = 1, srcv(kid)%ncplmodel 
     
    376382            IF( srcv(kid)%nid(jc,jm) /= -1 ) THEN 
    377383 
    378                CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo )          
    379                 
     384               CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo ) 
     385 
    380386               llaction =  kinfo == OASIS_Recvd   .OR. kinfo == OASIS_FromRest .OR.   & 
    381387                  &        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                    
     388 
     389               IF ( sn_cfctl%l_oasout )   & 
     390                  &  WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid(jc,jm) 
     391 
     392               IF( llaction ) THEN   ! data received from oasis do not include halos 
     393 
    387394                  kinfo = OASIS_Rcv 
    388                   IF( llfisrt ) THEN  
    389                      pdata(nldi:nlei,nldj:nlej,jc) =                                 exfld(:,:) * pmask(nldi:nlei,nldj:nlej,jm) 
    390                      llfisrt = .FALSE. 
     395                  IF( ll_1st ) THEN 
     396                     pdata(Nis0:Nie0,Njs0:Nje0,jc) =   exfld(:,:) * pmask(Nis0:Nie0,Njs0:Nje0,jm) 
     397                     ll_1st = .FALSE. 
    391398                  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         
     399                     pdata(Nis0:Nie0,Njs0:Nje0,jc) = pdata(Nis0:Nie0,Njs0:Nje0,jc)   & 
     400                        &                                + exfld(:,:) * pmask(Nis0:Nie0,Njs0:Nje0,jm) 
     401                  ENDIF 
     402 
     403                  IF ( sn_cfctl%l_oasout ) THEN 
    396404                     WRITE(numout,*) '****************' 
    397405                     WRITE(numout,*) 'oasis_get: Incoming ', srcv(kid)%clname 
     
    399407                     WRITE(numout,*) 'oasis_get:   kstep', kstep 
    400408                     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)) 
     409                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(Nis0:Nie0,Njs0:Nje0,jc)) 
     410                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(Nis0:Nie0,Njs0:Nje0,jc)) 
     411                     WRITE(numout,*) '     -     Sum value is ',    SUM(pdata(Nis0:Nie0,Njs0:Nje0,jc)) 
    404412                     WRITE(numout,*) '****************' 
    405413                  ENDIF 
    406                    
     414 
    407415               ENDIF 
    408                 
     416 
    409417            ENDIF 
    410              
     418 
    411419         ENDDO 
    412420 
    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   
     421         !--- we must call lbc_lnk to fill the halos that where not received. 
     422         IF( .NOT. ll_1st ) THEN 
     423            CALL lbc_lnk( 'cpl_oasis3', pdata(:,:,jc), srcv(kid)%clgrid, srcv(kid)%nsgn ) 
     424         ENDIF 
     425 
    417426      ENDDO 
    418427      ! 
     
    420429 
    421430 
    422    INTEGER FUNCTION cpl_freq( cdfieldname )   
     431   INTEGER FUNCTION cpl_freq( cdfieldname ) 
    423432      !!--------------------------------------------------------------------- 
    424433      !!              ***  ROUTINE cpl_freq  *** 
     
    438447      ! 
    439448      DO ji = 1, nsnd 
    440          IF (ssnd(ji)%laction ) THEN 
     449         IF(ssnd(ji)%laction ) THEN 
    441450            DO jm = 1, ncplmodel 
    442451               IF( ssnd(ji)%nid(1,jm) /= -1 ) THEN 
     
    450459      ENDDO 
    451460      DO ji = 1, nrcv 
    452          IF (srcv(ji)%laction ) THEN 
     461         IF(srcv(ji)%laction ) THEN 
    453462            DO jm = 1, ncplmodel 
    454463               IF( srcv(ji)%nid(1,jm) /= -1 ) THEN 
     
    463472      ! 
    464473      IF( id /= -1 ) THEN 
    465 #if defined key_oa3mct_v3 
    466474         CALL oasis_get_freqs(id, mop, 1, itmp, info) 
    467 #else 
    468          CALL oasis_get_freqs(id,      1, itmp, info) 
    469 #endif 
    470475         cpl_freq = itmp(1) 
    471476      ENDIF 
     
    484489      ! 
    485490      DEALLOCATE( exfld ) 
    486       IF (nstop == 0) THEN 
    487          CALL oasis_terminate( nerror )          
     491      IF(nstop == 0) THEN 
     492         CALL oasis_terminate( nerror ) 
    488493      ELSE 
    489494         CALL oasis_abort( ncomp_id, "cpl_finalize", "NEMO ABORT STOP" ) 
    490       ENDIF        
     495      ENDIF 
    491496      ! 
    492497   END SUBROUTINE cpl_finalize 
     
    538543      WRITE(numout,*) 'oasis_enddef: Error you sould not be there...' 
    539544   END SUBROUTINE oasis_enddef 
    540    
     545 
    541546   SUBROUTINE oasis_put(k1,k2,p1,k3) 
    542547      REAL(wp), DIMENSION(:,:), INTENT(in   ) ::  p1 
     
    555560   END SUBROUTINE oasis_get 
    556561 
    557    SUBROUTINE oasis_get_freqs(k1,k2,k3,k4) 
     562   SUBROUTINE oasis_get_freqs(k1,k5,k2,k3,k4) 
    558563      INTEGER              , INTENT(in   ) ::  k1,k2 
    559564      INTEGER, DIMENSION(1), INTENT(  out) ::  k3 
    560       INTEGER              , INTENT(  out) ::  k4 
    561       k3(1) = k1 ; k4 = k2 
     565      INTEGER              , INTENT(  out) ::  k4,k5 
     566      k3(1) = k1 ; k4 = k2 ; k5 = k2 
    562567      WRITE(numout,*) 'oasis_get_freqs: Error you sould not be there...' 
    563568   END SUBROUTINE oasis_get_freqs 
     
    568573      WRITE(numout,*) 'oasis_terminate: Error you sould not be there...' 
    569574   END SUBROUTINE oasis_terminate 
    570     
     575 
    571576#endif 
    572577 
Note: See TracChangeset for help on using the changeset viewer.