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/sbcflx.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/sbcflx.F90

    r14072 r14219  
    3535   INTEGER , PARAMETER ::   jp_emp  = 5   ! index of evaporation-precipation file 
    3636 !!INTEGER , PARAMETER ::   jp_sfx  = 6   ! index of salt flux flux 
    37    INTEGER , PARAMETER ::   jpfld   = 5 !! 6 ! maximum number of files to read 
     37   INTEGER , PARAMETER ::   jpfld   = 5 !! 6 ! maximum number of files to read  
    3838   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf    ! structure of input fields (file informations, fields read) 
    3939 
     
    5050      !!--------------------------------------------------------------------- 
    5151      !!                    ***  ROUTINE sbc_flx  *** 
    52       !! 
     52      !!                    
    5353      !! ** Purpose :   provide at each time step the surface ocean fluxes 
    54       !!                (momentum, heat, freshwater and runoff) 
     54      !!                (momentum, heat, freshwater and runoff)  
    5555      !! 
    5656      !! ** Method  : - READ each fluxes in NetCDF files: 
     
    9191      !!--------------------------------------------------------------------- 
    9292      ! 
    93       IF( kt == nit000 ) THEN                ! First call kt=nit000 
     93      IF( kt == nit000 ) THEN                ! First call kt=nit000   
    9494         ! set file information 
    9595         READ  ( numnam_ref, namsbc_flx, IOSTAT = ios, ERR = 901) 
     
    9898         READ  ( numnam_cfg, namsbc_flx, IOSTAT = ios, ERR = 902 ) 
    9999902      IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_flx in configuration namelist' ) 
    100          IF(lwm) WRITE ( numond, namsbc_flx ) 
     100         IF(lwm) WRITE ( numond, namsbc_flx )  
    101101         ! 
    102102         !                                         ! check: do we plan to use ln_dm2dc with non-daily forcing? 
    103103         IF( ln_dm2dc .AND. sn_qsr%freqh /= 24. )   & 
    104             &   CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' ) 
     104            &   CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' )  
    105105         ! 
    106106         !                                         ! store namelist information in an array 
    107107         slf_i(jp_utau) = sn_utau   ;   slf_i(jp_vtau) = sn_vtau 
    108          slf_i(jp_qtot) = sn_qtot   ;   slf_i(jp_qsr ) = sn_qsr 
     108         slf_i(jp_qtot) = sn_qtot   ;   slf_i(jp_qsr ) = sn_qsr  
    109109         slf_i(jp_emp ) = sn_emp !! ;   slf_i(jp_sfx ) = sn_sfx 
    110110         ! 
    111111         ALLOCATE( sf(jpfld), STAT=ierror )        ! set sf structure 
    112          IF( ierror > 0 ) THEN 
    113             CALL ctl_stop( 'sbc_flx: unable to allocate sf structure' )   ;   RETURN 
     112         IF( ierror > 0 ) THEN    
     113            CALL ctl_stop( 'sbc_flx: unable to allocate sf structure' )   ;   RETURN   
    114114         ENDIF 
    115115         DO ji= 1, jpfld 
     
    123123 
    124124      CALL fld_read( kt, nn_fsbc, sf )                            ! input fields provided at the current time-step 
    125  
     125      
    126126      IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN                        ! update ocean fluxes at each SBC frequency 
    127127 
    128128         IF( ln_dm2dc ) THEN   ! modify now Qsr to include the diurnal cycle 
    129             qsr(:,:) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) * tmask(:,:,1) 
     129            qsr(:,:) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) * tmask(ji,jj,1) 
    130130         ELSE 
    131131            DO_2D( 0, 0, 0, 0 ) 
     
    138138            qns (ji,jj) = ( sf(jp_qtot)%fnow(ji,jj,1) - sf(jp_qsr)%fnow(ji,jj,1) ) * tmask(ji,jj,1) 
    139139            emp (ji,jj) =   sf(jp_emp )%fnow(ji,jj,1)                              * tmask(ji,jj,1) 
    140             !!sfx (ji,jj) = sf(jp_sfx )%fnow(ji,jj,1)                              * tmask(ji,jj,1) 
     140            !!sfx (ji,jj) = sf(jp_sfx )%fnow(ji,jj,1)                              * tmask(ji,jj,1)  
    141141         END_2D 
    142142         !                                                        ! add to qns the heat due to e-p 
     
    144144         !!qns(:,:) = qns(:,:) - emp(:,:) * sst_m(:,:) * rcp        ! mass flux is at SST 
    145145         ! 
    146          ! clem: without these lbc calls, it seems that the northfold is not ok (true in 3.6, not sure in 4.x) 
    147          CALL lbc_lnk_multi( 'sbcflx', utau, 'U', -1._wp, vtau, 'V', -1._wp, & 
    148             &                           qns, 'T',  1._wp, emp , 'T',  1._wp, qsr, 'T', 1._wp ) !! sfx, 'T', 1._wp  ) 
     146         ! clem: without these lbc calls, it seems that the northfold is not ok (true in 3.6, not sure in 4.x)  
     147         CALL lbc_lnk( 'sbcflx', utau, 'U', -1._wp) 
     148         CALL lbc_lnk( 'sbcflx', vtau, 'V', -1._wp) 
     149         CALL lbc_lnk( 'sbcflx', qns, 'T', 1._wp) 
     150         CALL lbc_lnk( 'sbcflx', emp, 'T', 1._wp) 
     151         CALL lbc_lnk( 'sbcflx', qsr, 'T', 1._wp) 
     152 
     153         ! 
     154         ! 
     155         ! clem: without these lbc calls, it seems that the northfold is not ok (true in 3.6, not sure in 4.x)  
     156        !CALL lbc_lnk_multi( 'sbcflx', utau, 'U', -1._wp, vtau, 'V', -1._wp, & 
     157        !   &                           qns, 'T',  1._wp, emp , 'T',  1._wp, qsr, 'T', 1._wp ) !! sfx, 'T', 1._wp  ) 
    149158         ! 
    150159         IF( nitend-nit000 <= 100 .AND. lwp ) THEN                ! control print (if less than 100 time-step asked) 
    151             WRITE(numout,*) 
     160            WRITE(numout,*)  
    152161            WRITE(numout,*) '        read daily momentum, heat and freshwater fluxes OK' 
    153162            DO jf = 1, jpfld 
     
    155164               IF( jf == jp_qtot .OR. jf == jp_qsr  )   zfact =     0.1 
    156165               IF( jf == jp_emp                     )   zfact = 86400. 
    157                WRITE(numout,*) 
     166               WRITE(numout,*)  
    158167               WRITE(numout,*) ' day: ', ndastp , TRIM(sf(jf)%clvar), ' * ', zfact 
    159168            END DO 
     
    166175      DO_2D( 0, 0, 0, 0 ) 
    167176         ztx = ( utau(ji-1,jj  ) + utau(ji,jj) ) * 0.5_wp * ( 2._wp - MIN( umask(ji-1,jj  ,1), umask(ji,jj,1) ) ) 
    168          zty = ( vtau(ji  ,jj-1) + vtau(ji,jj) ) * 0.5_wp * ( 2._wp - MIN( vmask(ji  ,jj-1,1), vmask(ji,jj,1) ) ) 
     177         zty = ( vtau(ji  ,jj-1) + vtau(ji,jj) ) * 0.5_wp * ( 2._wp - MIN( vmask(ji  ,jj-1,1), vmask(ji,jj,1) ) )  
    169178         zmod = 0.5_wp * SQRT( ztx * ztx + zty * zty ) * tmask(ji,jj,1) 
    170179         taum(ji,jj) = zmod 
     
    172181      END_2D 
    173182      ! 
    174       CALL lbc_lnk_multi( 'sbcflx', taum, 'T', 1._wp, wndm, 'T', 1._wp ) 
     183      CALL lbc_lnk( 'sbcflx', taum, 'T', 1._wp) 
     184      CALL lbc_lnk( 'sbcflx', wndm, 'T', 1._wp) 
     185!     CALL lbc_lnk_multi( 'sbcflx', taum, 'T', 1._wp, wndm, 'T', 1._wp ) 
    175186      ! 
    176187   END SUBROUTINE sbc_flx 
     
    178189   !!====================================================================== 
    179190END MODULE sbcflx 
     191 
Note: See TracChangeset for help on using the changeset viewer.