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 14789 for NEMO/branches/2021/dev_r13747_HPC-11_mcastril_HPDAonline_DiagGPU/src/OCE/TRA/traqsr.F90 – NEMO

Ignore:
Timestamp:
2021-05-05T13:18:04+02:00 (3 years ago)
Author:
mcastril
Message:

[2021/HPC-11_mcastril_HPDAonline_DiagGPU] Update externals

Location:
NEMO/branches/2021/dev_r13747_HPC-11_mcastril_HPDAonline_DiagGPU
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2021/dev_r13747_HPC-11_mcastril_HPDAonline_DiagGPU

    • Property svn:externals
      •  

        old new  
        33^/utils/build/mk@HEAD         mk 
        44^/utils/tools@HEAD            tools 
        5 ^/vendors/AGRIF/dev_r12970_AGRIF_CMEMS      ext/AGRIF 
         5^/vendors/AGRIF/dev@HEAD      ext/AGRIF 
        66^/vendors/FCM@HEAD            ext/FCM 
        77^/vendors/IOIPSL@HEAD         ext/IOIPSL 
         8^/vendors/PPR@HEAD            ext/PPR 
        89 
        910# SETTE 
        10 ^/utils/CI/sette@13559        sette 
         11^/utils/CI/sette@14244        sette 
  • NEMO/branches/2021/dev_r13747_HPC-11_mcastril_HPDAonline_DiagGPU/src/OCE/TRA/traqsr.F90

    r13497 r14789  
    99   !!   NEMO     1.0  !  2002-06  (G. Madec)  F90: Free form and module 
    1010   !!             -   !  2005-11  (G. Madec) zco, zps, sco coordinate 
    11    !!            3.2  !  2009-04  (G. Madec & NEMO team)  
    12    !!            3.6  !  2012-05  (C. Rousset) store attenuation coef for use in ice model  
     11   !!            3.2  !  2009-04  (G. Madec & NEMO team) 
     12   !!            3.6  !  2012-05  (C. Rousset) store attenuation coef for use in ice model 
    1313   !!            3.6  !  2015-12  (O. Aumont, J. Jouanno, C. Ethe) use vertical profile of chlorophyll 
    14    !!            3.7  !  2015-11  (G. Madec, A. Coward)  remove optimisation for fix volume  
     14   !!            3.7  !  2015-11  (G. Madec, A. Coward)  remove optimisation for fix volume 
    1515   !!---------------------------------------------------------------------- 
    1616 
    1717   !!---------------------------------------------------------------------- 
    18    !!   tra_qsr       : temperature trend due to the penetration of solar radiation  
    19    !!   tra_qsr_init  : initialization of the qsr penetration  
     18   !!   tra_qsr       : temperature trend due to the penetration of solar radiation 
     19   !!   tra_qsr_init  : initialization of the qsr penetration 
    2020   !!---------------------------------------------------------------------- 
    2121   USE oce            ! ocean dynamics and active tracers 
    2222   USE phycst         ! physical constants 
    2323   USE dom_oce        ! ocean space and time domain 
     24   USE domtile 
    2425   USE sbc_oce        ! surface boundary condition: ocean 
    2526   USE trc_oce        ! share SMS/Ocean variables 
     
    4445   !                                 !!* Namelist namtra_qsr: penetrative solar radiation 
    4546   LOGICAL , PUBLIC ::   ln_traqsr    !: light absorption (qsr) flag 
    46    LOGICAL , PUBLIC ::   ln_qsr_rgb   !: Red-Green-Blue light absorption flag   
     47   LOGICAL , PUBLIC ::   ln_qsr_rgb   !: Red-Green-Blue light absorption flag 
    4748   LOGICAL , PUBLIC ::   ln_qsr_2bd   !: 2 band         light absorption flag 
    4849   LOGICAL , PUBLIC ::   ln_qsr_bio   !: bio-model      light absorption flag 
     
    5354   ! 
    5455   INTEGER , PUBLIC ::   nksr         !: levels below which the light cannot penetrate (depth larger than 391 m) 
    55   
     56 
    5657   INTEGER, PARAMETER ::   np_RGB  = 1   ! R-G-B     light penetration with constant Chlorophyll 
    5758   INTEGER, PARAMETER ::   np_RGBc = 2   ! R-G-B     light penetration with Chlorophyll data 
     
    8788      !!      Considering the 2 wavebands case: 
    8889      !!         I(k) = Qsr*( rn_abs*EXP(z(k)/rn_si0) + (1.-rn_abs)*EXP(z(k)/rn_si1) ) 
    89       !!         The temperature trend associated with the solar radiation penetration  
     90      !!         The temperature trend associated with the solar radiation penetration 
    9091      !!         is given by : zta = 1/e3t dk[ I ] / (rho0*Cp) 
    9192      !!         At the bottom, boudary condition for the radiation is no flux : 
    9293      !!      all heat which has not been absorbed in the above levels is put 
    9394      !!      in the last ocean level. 
    94       !!         The computation is only done down to the level where  
    95       !!      I(k) < 1.e-15 W/m2 (i.e. over the top nksr levels) .  
     95      !!         The computation is only done down to the level where 
     96      !!      I(k) < 1.e-15 W/m2 (i.e. over the top nksr levels) . 
    9697      !! 
    9798      !! ** Action  : - update ta with the penetrative solar radiation trend 
     
    107108      ! 
    108109      INTEGER  ::   ji, jj, jk               ! dummy loop indices 
    109       INTEGER  ::   irgb                    ! local integers 
     110      INTEGER  ::   irgb, isi, iei, isj, iej ! local integers 
    110111      REAL(wp) ::   zchl, zcoef, z1_2        ! local scalars 
    111112      REAL(wp) ::   zc0 , zc1 , zc2 , zc3    !    -         - 
     
    120121      IF( ln_timing )   CALL timing_start('tra_qsr') 
    121122      ! 
    122       IF( kt == nit000 ) THEN 
    123          IF(lwp) WRITE(numout,*) 
    124          IF(lwp) WRITE(numout,*) 'tra_qsr : penetration of the surface solar radiation' 
    125          IF(lwp) WRITE(numout,*) '~~~~~~~' 
     123      IF( ntile == 0 .OR. ntile == 1 )  THEN                       ! Do only on the first tile 
     124         IF( kt == nit000 ) THEN 
     125            IF(lwp) WRITE(numout,*) 
     126            IF(lwp) WRITE(numout,*) 'tra_qsr : penetration of the surface solar radiation' 
     127            IF(lwp) WRITE(numout,*) '~~~~~~~' 
     128         ENDIF 
    126129      ENDIF 
    127130      ! 
    128131      IF( l_trdtra ) THEN      ! trends diagnostic: save the input temperature trend 
    129          ALLOCATE( ztrdt(jpi,jpj,jpk) )  
     132         ALLOCATE( ztrdt(jpi,jpj,jpk) ) 
    130133         ztrdt(:,:,:) = pts(:,:,:,jp_tem,Krhs) 
    131134      ENDIF 
     
    134137      !                         !  before qsr induced heat content  ! 
    135138      !                         !-----------------------------------! 
     139      IF( ntsi == Nis0 ) THEN ; isi = nn_hls ; ELSE ; isi = 0 ; ENDIF    ! Avoid double-counting when using tiling 
     140      IF( ntsj == Njs0 ) THEN ; isj = nn_hls ; ELSE ; isj = 0 ; ENDIF 
     141      IF( ntei == Nie0 ) THEN ; iei = nn_hls ; ELSE ; iei = 0 ; ENDIF 
     142      IF( ntej == Nje0 ) THEN ; iej = nn_hls ; ELSE ; iej = 0 ; ENDIF 
     143 
    136144      IF( kt == nit000 ) THEN          !==  1st time step  ==! 
    137          IF( ln_rstart .AND. iom_varid( numror, 'qsr_hc_b', ldstop = .FALSE. ) > 0  .AND. .NOT.l_1st_euler ) THEN    ! read in restart 
    138             IF(lwp) WRITE(numout,*) '          nit000-1 qsr tracer content forcing field read in the restart file' 
     145         IF( ln_rstart .AND. .NOT.l_1st_euler ) THEN    ! read in restart 
    139146            z1_2 = 0.5_wp 
    140             CALL iom_get( numror, jpdom_auto, 'qsr_hc_b', qsr_hc_b, ldxios = lrxios )   ! before heat content trend due to Qsr flux 
    141          ELSE                                           ! No restart or restart not found: Euler forward time stepping 
     147            IF( ntile == 0 .OR. ntile == 1 )  THEN                        ! Do only on the first tile 
     148               IF(lwp) WRITE(numout,*) '          nit000-1 qsr tracer content forcing field read in the restart file' 
     149               CALL iom_get( numror, jpdom_auto, 'qsr_hc_b', qsr_hc_b )   ! before heat content trend due to Qsr flux 
     150            ENDIF 
     151         ELSE                                           ! No restart or Euler forward at 1st time step 
    142152            z1_2 = 1._wp 
    143             qsr_hc_b(:,:,:) = 0._wp 
     153            DO_3D( isi, iei, isj, iej, 1, jpk ) 
     154               qsr_hc_b(ji,jj,jk) = 0._wp 
     155            END_3D 
    144156         ENDIF 
    145157      ELSE                             !==  Swap of qsr heat content  ==! 
    146158         z1_2 = 0.5_wp 
    147          qsr_hc_b(:,:,:) = qsr_hc(:,:,:) 
     159         DO_3D( isi, iei, isj, iej, 1, jpk ) 
     160            qsr_hc_b(ji,jj,jk) = qsr_hc(ji,jj,jk) 
     161         END_3D 
    148162      ENDIF 
    149163      ! 
     
    154168      CASE( np_BIO )                   !==  bio-model fluxes  ==! 
    155169         ! 
    156          DO jk = 1, nksr 
    157             qsr_hc(:,:,jk) = r1_rho0_rcp * ( etot3(:,:,jk) - etot3(:,:,jk+1) ) 
    158          END DO 
     170         DO_3D( isi, iei, isj, iej, 1, nksr ) 
     171            qsr_hc(ji,jj,jk) = r1_rho0_rcp * ( etot3(ji,jj,jk) - etot3(ji,jj,jk+1) ) 
     172         END_3D 
    159173         ! 
    160174      CASE( np_RGB , np_RGBc )         !==  R-G-B fluxes  ==! 
    161175         ! 
    162          ALLOCATE( ze0 (jpi,jpj)           , ze1 (jpi,jpj) ,   & 
    163             &      ze2 (jpi,jpj)           , ze3 (jpi,jpj) ,   & 
    164             &      ztmp3d(jpi,jpj,nksr + 1)                     ) 
     176         ALLOCATE( ze0 (A2D(nn_hls))           , ze1 (A2D(nn_hls)) ,   & 
     177            &      ze2 (A2D(nn_hls))           , ze3 (A2D(nn_hls)) ,   & 
     178            &      ztmp3d(A2D(nn_hls),nksr + 1)                     ) 
    165179         ! 
    166180         IF( nqsr == np_RGBc ) THEN          !*  Variable Chlorophyll 
    167             CALL fld_read( kt, 1, sf_chl )         ! Read Chl data and provides it at the current time step 
     181            IF( ntile == 0 .OR. ntile == 1 )  THEN                                         ! Do only for the full domain 
     182               IF( ln_tile ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 0 )            ! Use full domain 
     183               CALL fld_read( kt, 1, sf_chl )         ! Read Chl data and provides it at the current time step 
     184               IF( ln_tile ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 1 )            ! Revert to tile domain 
     185            ENDIF 
    168186            ! 
    169187            ! Separation in R-G-B depending on the surface Chl 
     
    172190            ! most expensive calculations) 
    173191            ! 
    174             DO_2D( 0, 0, 0, 0 ) 
     192            DO_2D( isi, iei, isj, iej ) 
    175193                       ! zlogc = log(zchl) 
    176                zlogc = LOG ( MIN( 10. , MAX( 0.03, sf_chl(1)%fnow(ji,jj,1) ) ) )      
     194               zlogc = LOG ( MIN( 10. , MAX( 0.03, sf_chl(1)%fnow(ji,jj,1) ) ) ) 
    177195                       ! zc1 : log(zCze)  = log (1.12  * zchl**0.803) 
    178                zc1   = 0.113328685307 + 0.803 * zlogc                          
     196               zc1   = 0.113328685307 + 0.803 * zlogc 
    179197                       ! zc2 : log(zCtot) = log(40.6  * zchl**0.459) 
    180                zc2   = 3.703768066608 + 0.459 * zlogc                            
     198               zc2   = 3.703768066608 + 0.459 * zlogc 
    181199                       ! zc3 : log(zze)   = log(568.2 * zCtot**(-0.746)) 
    182                zc3   = 6.34247346942  - 0.746 * zc2                            
     200               zc3   = 6.34247346942  - 0.746 * zc2 
    183201                       ! IF( log(zze) > log(102.) ) log(zze) = log(200.0 * zCtot**(-0.293)) 
    184                IF( zc3 > 4.62497281328 ) zc3 = 5.298317366548 - 0.293 * zc2         
    185                !    
     202               IF( zc3 > 4.62497281328 ) zc3 = 5.298317366548 - 0.293 * zc2 
     203               ! 
    186204               ze0(ji,jj) = zlogc                                                 ! ze0 = log(zchl) 
    187205               ze1(ji,jj) = EXP( zc1 )                                            ! ze1 = zCze 
     
    189207               ze3(ji,jj) = EXP( - zc3 )                                          ! ze3 = 1/zze 
    190208            END_2D 
    191              
     209 
    192210! 
    193             DO_3D( 0, 0, 0, 0, 1, nksr + 1 ) 
     211            DO_3D( isi, iei, isj, iej, 1, nksr + 1 ) 
    194212               ! zchl    = ALOG( ze0(ji,jj) ) 
    195213               zlogc = ze0(ji,jj) 
     
    211229         ELSE                                !* constant chlorophyll 
    212230            zchl = 0.05 
    213             ! NB. make sure constant value is such that:  
     231            ! NB. make sure constant value is such that: 
    214232            zchl = MIN( 10. , MAX( 0.03, zchl ) ) 
    215233            ! Convert chlorophyll value to attenuation coefficient look-up table index 
    216234            zlui = 41 + 20.*LOG10(zchl) + 1.e-15 
    217235            DO jk = 1, nksr + 1 
    218                ztmp3d(:,:,jk) = zlui  
     236               ztmp3d(:,:,jk) = zlui 
    219237            END DO 
    220238         ENDIF 
    221239         ! 
    222240         zcoef  = ( 1. - rn_abs ) / 3._wp    !* surface equi-partition in R-G-B 
    223          DO_2D( 0, 0, 0, 0 ) 
     241         DO_2D( isi, iei, isj, iej ) 
    224242            ze0(ji,jj) = rn_abs * qsr(ji,jj) 
    225243            ze1(ji,jj) = zcoef  * qsr(ji,jj) 
    226244            ze2(ji,jj) = zcoef  * qsr(ji,jj) 
    227245            ze3(ji,jj) = zcoef  * qsr(ji,jj) 
    228             ! store the surface SW radiation; re-use the surface ztmp3d array  
     246            ! store the surface SW radiation; re-use the surface ztmp3d array 
    229247            ! since the surface attenuation coefficient is not used 
    230248            ztmp3d(ji,jj,1) =       qsr(ji,jj) 
     
    232250         ! 
    233251         !                                    !* interior equi-partition in R-G-B depending on vertical profile of Chl 
    234          DO_3D( 0, 0, 0, 0, 2, nksr + 1 ) 
     252         DO_3D( isi, iei, isj, iej, 2, nksr + 1 ) 
    235253            ze3t = e3t(ji,jj,jk-1,Kmm) 
    236254            irgb = NINT( ztmp3d(ji,jj,jk) ) 
     
    246264         END_3D 
    247265         ! 
    248          DO_3D( 0, 0, 0, 0, 1, nksr )          !* now qsr induced heat content 
     266         DO_3D( isi, iei, isj, iej, 1, nksr )          !* now qsr induced heat content 
    249267            qsr_hc(ji,jj,jk) = r1_rho0_rcp * ( ztmp3d(ji,jj,jk) - ztmp3d(ji,jj,jk+1) ) 
    250268         END_3D 
    251269         ! 
    252          DEALLOCATE( ze0 , ze1 , ze2 , ze3 , ztmp3d )  
     270         DEALLOCATE( ze0 , ze1 , ze2 , ze3 , ztmp3d ) 
    253271         ! 
    254272      CASE( np_2BD  )            !==  2-bands fluxes  ==! 
     
    256274         zz0 =        rn_abs   * r1_rho0_rcp      ! surface equi-partition in 2-bands 
    257275         zz1 = ( 1. - rn_abs ) * r1_rho0_rcp 
    258          DO_3D( 0, 0, 0, 0, 1, nksr )             ! solar heat absorbed at T-point in the top 400m  
     276         DO_3D( isi, iei, isj, iej, 1, nksr )          !* now qsr induced heat content 
    259277            zc0 = zz0 * EXP( -gdepw(ji,jj,jk  ,Kmm)*xsi0r ) + zz1 * EXP( -gdepw(ji,jj,jk  ,Kmm)*xsi1r ) 
    260278            zc1 = zz0 * EXP( -gdepw(ji,jj,jk+1,Kmm)*xsi0r ) + zz1 * EXP( -gdepw(ji,jj,jk+1,Kmm)*xsi1r ) 
    261             qsr_hc(ji,jj,jk) = qsr(ji,jj) * ( zc0 * wmask(ji,jj,jk) - zc1 * wmask(ji,jj,jk+1) )  
     279            qsr_hc(ji,jj,jk) = qsr(ji,jj) * ( zc0 * wmask(ji,jj,jk) - zc1 * wmask(ji,jj,jk+1) ) 
    262280         END_3D 
    263281         ! 
     
    274292      ! 
    275293      ! sea-ice: store the 1st ocean level attenuation coefficient 
    276       DO_2D( 0, 0, 0, 0 ) 
     294      DO_2D( isi, iei, isj, iej ) 
    277295         IF( qsr(ji,jj) /= 0._wp ) THEN   ;   fraqsr_1lev(ji,jj) = qsr_hc(ji,jj,1) / ( r1_rho0_rcp * qsr(ji,jj) ) 
    278296         ELSE                             ;   fraqsr_1lev(ji,jj) = 1._wp 
    279297         ENDIF 
    280298      END_2D 
    281       CALL lbc_lnk( 'traqsr', fraqsr_1lev(:,:), 'T', 1._wp ) 
    282       ! 
    283       IF( iom_use('qsr3d') ) THEN      ! output the shortwave Radiation distribution 
    284          ALLOCATE( zetot(jpi,jpj,jpk) ) 
    285          zetot(:,:,nksr+1:jpk) = 0._wp     ! below ~400m set to zero 
    286          DO jk = nksr, 1, -1 
    287             zetot(:,:,jk) = zetot(:,:,jk+1) + qsr_hc(:,:,jk) * rho0_rcp 
    288          END DO          
    289          CALL iom_put( 'qsr3d', zetot )   ! 3D distribution of shortwave Radiation 
    290          DEALLOCATE( zetot )  
    291       ENDIF 
    292       ! 
    293       IF( lrst_oce ) THEN     ! write in the ocean restart file 
    294          IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    295          CALL iom_rstput( kt, nitrst, numrow, 'qsr_hc_b'   , qsr_hc     , ldxios = lwxios ) 
    296          CALL iom_rstput( kt, nitrst, numrow, 'fraqsr_1lev', fraqsr_1lev, ldxios = lwxios )  
    297          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
     299      ! 
     300      ! TEMP: [tiling] This change not necessary and working array can use A2D(nn_hls) if using XIOS (subdomain support) 
     301      IF( ntile == 0 .OR. ntile == nijtile )  THEN                ! Do only for the full domain 
     302         IF( iom_use('qsr3d') ) THEN      ! output the shortwave Radiation distribution 
     303            ALLOCATE( zetot(jpi,jpj,jpk) ) 
     304            zetot(:,:,nksr+1:jpk) = 0._wp     ! below ~400m set to zero 
     305            DO jk = nksr, 1, -1 
     306               zetot(:,:,jk) = zetot(:,:,jk+1) + qsr_hc(:,:,jk) * rho0_rcp 
     307            END DO 
     308            CALL iom_put( 'qsr3d', zetot )   ! 3D distribution of shortwave Radiation 
     309            DEALLOCATE( zetot ) 
     310         ENDIF 
     311      ENDIF 
     312      ! 
     313      IF( ntile == 0 .OR. ntile == nijtile )  THEN                ! Do only on the last tile 
     314         IF( lrst_oce ) THEN     ! write in the ocean restart file 
     315            CALL iom_rstput( kt, nitrst, numrow, 'qsr_hc_b'   , qsr_hc      ) 
     316            CALL iom_rstput( kt, nitrst, numrow, 'fraqsr_1lev', fraqsr_1lev ) 
     317         ENDIF 
    298318      ENDIF 
    299319      ! 
     
    301321         ztrdt(:,:,:) = pts(:,:,:,jp_tem,Krhs) - ztrdt(:,:,:) 
    302322         CALL trd_tra( kt, Kmm, Krhs, 'TRA', jp_tem, jptra_qsr, ztrdt ) 
    303          DEALLOCATE( ztrdt )  
     323         DEALLOCATE( ztrdt ) 
    304324      ENDIF 
    305325      !                       ! print mean trends (used for debugging) 
     
    320340      !!      from two length scale of penetration (rn_si0,rn_si1) and a ratio 
    321341      !!      (rn_abs). These parameters are read in the namtra_qsr namelist. The 
    322       !!      default values correspond to clear water (type I in Jerlov'  
     342      !!      default values correspond to clear water (type I in Jerlov' 
    323343      !!      (1968) classification. 
    324344      !!         called by tra_qsr at the first timestep (nit000) 
     
    370390         &                               ' 2 bands, 3 RGB bands or bio-model light penetration' ) 
    371391      ! 
    372       IF( ln_qsr_rgb .AND. nn_chldta == 0 )   nqsr = np_RGB  
     392      IF( ln_qsr_rgb .AND. nn_chldta == 0 )   nqsr = np_RGB 
    373393      IF( ln_qsr_rgb .AND. nn_chldta == 1 )   nqsr = np_RGBc 
    374394      IF( ln_qsr_2bd                      )   nqsr = np_2BD 
     
    380400      ! 
    381401      SELECT CASE( nqsr ) 
    382       !                                
     402      ! 
    383403      CASE( np_RGB , np_RGBc )         !==  Red-Green-Blue light penetration  ==! 
    384          !                              
     404         ! 
    385405         IF(lwp)   WRITE(numout,*) '   ==>>>   R-G-B   light penetration ' 
    386406         ! 
    387407         CALL trc_oce_rgb( rkrgb )                 ! tabulated attenuation coef. 
    388          !                                    
     408         ! 
    389409         nksr = trc_oce_ext_lev( r_si2, 33._wp )   ! level of light extinction 
    390410         ! 
     
    420440         ! 
    421441         CALL trc_oce_rgb( rkrgb )                 ! tabulated attenuation coef. 
    422          !                                    
     442         ! 
    423443         nksr = trc_oce_ext_lev( r_si2, 33._wp )   ! level of light extinction 
    424444         ! 
     
    431451      ! 1st ocean level attenuation coefficient (used in sbcssm) 
    432452      IF( iom_varid( numror, 'fraqsr_1lev', ldstop = .FALSE. ) > 0 ) THEN 
    433          CALL iom_get( numror, jpdom_auto, 'fraqsr_1lev'  , fraqsr_1lev, ldxios = lrxios  ) 
     453         CALL iom_get( numror, jpdom_auto, 'fraqsr_1lev'  , fraqsr_1lev  ) 
    434454      ELSE 
    435455         fraqsr_1lev(:,:) = 1._wp   ! default : no penetration 
    436456      ENDIF 
    437457      ! 
    438       IF( lwxios ) THEN 
    439          CALL iom_set_rstw_var_active('qsr_hc_b') 
    440          CALL iom_set_rstw_var_active('fraqsr_1lev') 
    441       ENDIF 
    442       ! 
    443458   END SUBROUTINE tra_qsr_init 
    444459 
Note: See TracChangeset for help on using the changeset viewer.