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.
Changeset 14219 for NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/cpl_oasis3.F90 – NEMO

Ignore:
Timestamp:
2020-12-18T18:52:57+01:00 (4 years ago)
Author:
mcastril
Message:

Add Mixed Precision support by Oriol Tintó

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/cpl_oasis3.F90

    r14072 r14219  
    1414   !!            3.6  !  2014-11  (S. Masson) OASIS3-MCT 
    1515   !!---------------------------------------------------------------------- 
    16  
     16    
    1717   !!---------------------------------------------------------------------- 
    1818   !!   'key_oasis3'                    coupled Ocean/Atmosphere via OASIS3-MCT 
     
    6363#endif 
    6464 
    65    INTEGER                    ::   nrcv         ! total number of fields received 
    66    INTEGER                    ::   nsnd         ! total number of fields sent 
     65   INTEGER                    ::   nrcv         ! total number of fields received  
     66   INTEGER                    ::   nsnd         ! total number of fields sent  
    6767   INTEGER                    ::   ncplmodel    ! Maximum number of models to/from which NEMO is potentialy sending/receiving data 
    68    INTEGER, PUBLIC, PARAMETER ::   nmaxfld=62   ! Maximum number of coupling fields 
     68   INTEGER, PUBLIC, PARAMETER ::   nmaxfld=60   ! Maximum number of coupling fields 
    6969   INTEGER, PUBLIC, PARAMETER ::   nmaxcat=5    ! Maximum number of coupling fields 
    7070   INTEGER, PUBLIC, PARAMETER ::   nmaxcpl=5    ! Maximum number of coupling fields 
    71  
     71    
    7272   TYPE, PUBLIC ::   FLD_CPL               !: Type for coupling field information 
    7373      LOGICAL               ::   laction   ! To be coupled or not 
    74       CHARACTER(len = 8)    ::   clname    ! Name of the coupling field 
    75       CHARACTER(len = 1)    ::   clgrid    ! Grid type 
     74      CHARACTER(len = 8)    ::   clname    ! Name of the coupling field    
     75      CHARACTER(len = 1)    ::   clgrid    ! Grid type   
    7676      REAL(wp)              ::   nsgn      ! Control of the sign change 
    7777      INTEGER, DIMENSION(nmaxcat,nmaxcpl) ::   nid   ! Id of the field (no more than 9 categories and 9 extrena models) 
     
    9898      !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software) 
    9999      !! 
    100       !! ** Method  :   OASIS3 MPI communication 
     100      !! ** Method  :   OASIS3 MPI communication  
    101101      !!-------------------------------------------------------------------- 
    102102      CHARACTER(len = *), INTENT(in   ) ::   cd_modname   ! model name as set in namcouple file 
     
    132132      !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software) 
    133133      !! 
    134       !! ** Method  :   OASIS3 MPI communication 
     134      !! ** Method  :   OASIS3 MPI communication  
    135135      !!-------------------------------------------------------------------- 
    136136      INTEGER, INTENT(in) ::   krcv, ksnd     ! Number of received and sent coupling fields 
     
    180180      ! 
    181181      ! ----------------------------------------------------------------- 
    182       ! ... Define the partition, excluding halos as we don't want them to be "seen" by oasis 
     182      ! ... Define the partition, excluding halos as we don't want them to be "seen" by oasis     
    183183      ! ----------------------------------------------------------------- 
    184  
     184       
    185185      paral(1) = 2                                      ! box partitioning 
    186       paral(2) = Ni0glo * mjg0(nn_hls) + mig0(nn_hls)   ! NEMO lower left corner global offset, without halos 
     186      paral(2) = Ni0glo * mjg0(nn_hls) + mig0(nn_hls)   ! NEMO lower left corner global offset, without halos  
    187187      paral(3) = Ni_0                                   ! local extent in i, excluding halos 
    188188      paral(4) = Nj_0                                   ! local extent in j, excluding halos 
    189189      paral(5) = Ni0glo                                 ! global extent in x, excluding halos 
    190  
     190       
    191191      IF( sn_cfctl%l_oasout ) THEN 
    192192         WRITE(numout,*) ' multiexchg: paral (1:5)', paral 
     
    195195         WRITE(numout,*) ' multiexchg: Njs0, Nje0, njmpp =', Njs0, Nje0, njmpp 
    196196      ENDIF 
    197  
     197    
    198198      CALL oasis_def_partition ( id_part, paral, nerror, Ni0glo*Nj0glo )   ! global number of points, excluding halos 
    199199      ! 
    200       ! ... Announce send variables. 
     200      ! ... Announce send variables.  
    201201      ! 
    202202      ssnd(:)%ncplmodel = kcplmodel 
     
    210210               RETURN 
    211211            ENDIF 
    212  
     212             
    213213            DO jc = 1, ssnd(ji)%nct 
    214214               DO jm = 1, kcplmodel 
     
    225225                  ENDIF 
    226226#if defined key_agrif 
    227                   IF( agrif_fixed() /= 0 ) THEN 
     227                  IF( agrif_fixed() /= 0 ) THEN  
    228228                     zclname=TRIM(Agrif_CFixed())//'_'//TRIM(zclname) 
    229229                  ENDIF 
     
    243243      END DO 
    244244      ! 
    245       ! ... Announce received variables. 
     245      ! ... Announce received variables.  
    246246      ! 
    247247      srcv(:)%ncplmodel = kcplmodel 
    248248      ! 
    249249      DO ji = 1, krcv 
    250          IF( srcv(ji)%laction ) THEN 
    251  
     250         IF( srcv(ji)%laction ) THEN  
     251             
    252252            IF( srcv(ji)%nct > nmaxcat ) THEN 
    253253               CALL oasis_abort ( ncomp_id, 'cpl_define', 'Number of categories of '//   & 
     
    255255               RETURN 
    256256            ENDIF 
    257  
     257             
    258258            DO jc = 1, srcv(ji)%nct 
    259259               DO jm = 1, kcplmodel 
    260  
     260                   
    261261                  IF( srcv(ji)%nct .GT. 1 ) THEN 
    262262                     WRITE(cli2,'(i2.2)') jc 
     
    270270                  ENDIF 
    271271#if defined key_agrif 
    272                   IF( agrif_fixed() /= 0 ) THEN 
     272                  IF( agrif_fixed() /= 0 ) THEN  
    273273                     zclname=TRIM(Agrif_CFixed())//'_'//TRIM(zclname) 
    274274                  ENDIF 
     
    288288         ENDIF 
    289289      END DO 
    290  
     290       
    291291      !------------------------------------------------------------------ 
    292292      ! End of definition phase 
    293293      !------------------------------------------------------------------ 
    294       ! 
     294      !      
    295295#if defined key_agrif 
    296296      IF( agrif_fixed() == Agrif_Nb_Fine_Grids() ) THEN 
     
    303303      ! 
    304304   END SUBROUTINE cpl_define 
    305  
    306  
     305    
     306    
    307307   SUBROUTINE cpl_snd( kid, kstep, pdata, kinfo ) 
    308308      !!--------------------------------------------------------------------- 
     
    324324      DO jc = 1, ssnd(kid)%nct 
    325325         DO jm = 1, ssnd(kid)%ncplmodel 
    326  
     326         
    327327            IF( ssnd(kid)%nid(jc,jm) /= -1 ) THEN   ! exclude halos from data sent to oasis 
    328328               CALL oasis_put ( ssnd(kid)%nid(jc,jm), kstep, pdata(Nis0:Nie0, Njs0:Nje0,jc), kinfo ) 
    329  
    330                IF ( sn_cfctl%l_oasout ) THEN 
     329                
     330               IF ( sn_cfctl%l_oasout ) THEN         
    331331                  IF ( kinfo == OASIS_Sent     .OR. kinfo == OASIS_ToRest .OR.   & 
    332332                     & kinfo == OASIS_SentOut  .OR. kinfo == OASIS_ToRestOut ) THEN 
     
    342342                  ENDIF 
    343343               ENDIF 
    344  
     344                
    345345            ENDIF 
    346  
     346             
    347347         ENDDO 
    348348      ENDDO 
     
    379379            IF( srcv(kid)%nid(jc,jm) /= -1 ) THEN 
    380380 
    381                CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo ) 
    382  
     381               CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo )          
     382                
    383383               llaction =  kinfo == OASIS_Recvd   .OR. kinfo == OASIS_FromRest .OR.   & 
    384384                  &        kinfo == OASIS_RecvOut .OR. kinfo == OASIS_FromRestOut 
    385  
     385                
    386386               IF ( sn_cfctl%l_oasout )   & 
    387387                  &  WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid(jc,jm) 
    388  
     388                
    389389               IF( llaction ) THEN   ! data received from oasis do not include halos 
    390  
     390                   
    391391                  kinfo = OASIS_Rcv 
    392                   IF( ll_1st ) THEN 
     392                  IF( ll_1st ) THEN  
    393393                     pdata(Nis0:Nie0,Njs0:Nje0,jc) =   exfld(:,:) * pmask(Nis0:Nie0,Njs0:Nje0,jm) 
    394394                     ll_1st = .FALSE. 
     
    397397                        &                                + exfld(:,:) * pmask(Nis0:Nie0,Njs0:Nje0,jm) 
    398398                  ENDIF 
    399  
    400                   IF ( sn_cfctl%l_oasout ) THEN 
     399                   
     400                  IF ( sn_cfctl%l_oasout ) THEN         
    401401                     WRITE(numout,*) '****************' 
    402402                     WRITE(numout,*) 'oasis_get: Incoming ', srcv(kid)%clname 
     
    409409                     WRITE(numout,*) '****************' 
    410410                  ENDIF 
    411  
     411                   
    412412               ENDIF 
    413  
     413                
    414414            ENDIF 
    415  
     415             
    416416         ENDDO 
    417417 
    418418         !--- we must call lbc_lnk to fill the halos that where not received. 
    419419         IF( .NOT. ll_1st ) THEN 
    420             CALL lbc_lnk( 'cpl_oasis3', pdata(:,:,jc), srcv(kid)%clgrid, srcv(kid)%nsgn ) 
     420            CALL lbc_lnk( 'cpl_oasis3', pdata(:,:,jc), srcv(kid)%clgrid, srcv(kid)%nsgn )    
    421421         ENDIF 
    422  
     422  
    423423      ENDDO 
    424424      ! 
     
    426426 
    427427 
    428    INTEGER FUNCTION cpl_freq( cdfieldname ) 
     428   INTEGER FUNCTION cpl_freq( cdfieldname )   
    429429      !!--------------------------------------------------------------------- 
    430430      !!              ***  ROUTINE cpl_freq  *** 
     
    491491      DEALLOCATE( exfld ) 
    492492      IF(nstop == 0) THEN 
    493          CALL oasis_terminate( nerror ) 
     493         CALL oasis_terminate( nerror )          
    494494      ELSE 
    495495         CALL oasis_abort( ncomp_id, "cpl_finalize", "NEMO ABORT STOP" ) 
    496       ENDIF 
     496      ENDIF        
    497497      ! 
    498498   END SUBROUTINE cpl_finalize 
     
    544544      WRITE(numout,*) 'oasis_enddef: Error you sould not be there...' 
    545545   END SUBROUTINE oasis_enddef 
    546  
     546   
    547547   SUBROUTINE oasis_put(k1,k2,p1,k3) 
    548548      REAL(wp), DIMENSION(:,:), INTENT(in   ) ::  p1 
     
    574574      WRITE(numout,*) 'oasis_terminate: Error you sould not be there...' 
    575575   END SUBROUTINE oasis_terminate 
    576  
     576    
    577577#endif 
    578578 
Note: See TracChangeset for help on using the changeset viewer.