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 13463 for NEMO/branches/2019/dev_r11351_fldread_with_XIOS/src/ICE/icethd.F90 – NEMO

Ignore:
Timestamp:
2020-09-14T17:40:34+02:00 (4 years ago)
Author:
andmirek
Message:

Ticket #2195:update to trunk 13461

Location:
NEMO/branches/2019/dev_r11351_fldread_with_XIOS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11351_fldread_with_XIOS

    • Property svn:externals
      •  

        old new  
        33^/utils/build/mk@HEAD         mk 
        44^/utils/tools@HEAD            tools 
        5 ^/vendors/AGRIF/dev@HEAD      ext/AGRIF 
         5^/vendors/AGRIF/dev_r12970_AGRIF_CMEMS      ext/AGRIF 
        66^/vendors/FCM@HEAD            ext/FCM 
        77^/vendors/IOIPSL@HEAD         ext/IOIPSL 
         8 
         9# SETTE 
         10^/utils/CI/sette@13382        sette 
  • NEMO/branches/2019/dev_r11351_fldread_with_XIOS/src/ICE/icethd.F90

    r10994 r13463  
    5353 
    5454   !! * Substitutions 
    55 #  include "vectopt_loop_substitute.h90" 
     55#  include "do_loop_substitute.h90" 
    5656   !!---------------------------------------------------------------------- 
    5757   !! NEMO/ICE 4.0 , NEMO Consortium (2018) 
     
    9595      IF( ln_timing    )   CALL timing_start('icethd')                                                             ! timing 
    9696      IF( ln_icediachk )   CALL ice_cons_hsm(0, 'icethd', rdiag_v, rdiag_s, rdiag_t, rdiag_fv, rdiag_fs, rdiag_ft) ! conservation 
     97      IF( ln_icediachk )   CALL ice_cons2D  (0, 'icethd',  diag_v,  diag_s,  diag_t,  diag_fv,  diag_fs,  diag_ft) ! conservation 
    9798 
    9899      IF( kt == nit000 .AND. lwp ) THEN 
     
    108109         zu_io(:,:) = u_ice(:,:) - ssu_m(:,:) 
    109110         zv_io(:,:) = v_ice(:,:) - ssv_m(:,:) 
    110          DO jj = 2, jpjm1  
    111             DO ji = fs_2, fs_jpim1 
    112                zfric(ji,jj) = rn_cio * ( 0.5_wp *  & 
    113                   &                    (  zu_io(ji,jj) * zu_io(ji,jj) + zu_io(ji-1,jj) * zu_io(ji-1,jj)   & 
    114                   &                     + zv_io(ji,jj) * zv_io(ji,jj) + zv_io(ji,jj-1) * zv_io(ji,jj-1) ) ) * tmask(ji,jj,1) 
    115             END DO 
    116          END DO 
     111         DO_2D( 0, 0, 0, 0 ) 
     112            zfric(ji,jj) = rn_cio * ( 0.5_wp *  & 
     113               &                    (  zu_io(ji,jj) * zu_io(ji,jj) + zu_io(ji-1,jj) * zu_io(ji-1,jj)   & 
     114               &                     + zv_io(ji,jj) * zv_io(ji,jj) + zv_io(ji,jj-1) * zv_io(ji,jj-1) ) ) * tmask(ji,jj,1) 
     115         END_2D 
    117116      ELSE      !  if no ice dynamics => transmit directly the atmospheric stress to the ocean 
    118          DO jj = 2, jpjm1 
    119             DO ji = fs_2, fs_jpim1 
    120                zfric(ji,jj) = r1_rau0 * SQRT( 0.5_wp *  & 
    121                   &                         (  utau(ji,jj) * utau(ji,jj) + utau(ji-1,jj) * utau(ji-1,jj)   & 
    122                   &                          + vtau(ji,jj) * vtau(ji,jj) + vtau(ji,jj-1) * vtau(ji,jj-1) ) ) * tmask(ji,jj,1) 
    123             END DO 
    124          END DO 
     117         DO_2D( 0, 0, 0, 0 ) 
     118            zfric(ji,jj) = r1_rho0 * SQRT( 0.5_wp *  & 
     119               &                         (  utau(ji,jj) * utau(ji,jj) + utau(ji-1,jj) * utau(ji-1,jj)   & 
     120               &                          + vtau(ji,jj) * vtau(ji,jj) + vtau(ji,jj-1) * vtau(ji,jj-1) ) ) * tmask(ji,jj,1) 
     121         END_2D 
    125122      ENDIF 
    126       CALL lbc_lnk( 'icethd', zfric, 'T',  1. ) 
     123      CALL lbc_lnk( 'icethd', zfric, 'T',  1.0_wp ) 
    127124      ! 
    128125      !--------------------------------------------------------------------! 
    129126      ! Partial computation of forcing for the thermodynamic sea ice model 
    130127      !--------------------------------------------------------------------! 
    131       DO jj = 1, jpj 
    132          DO ji = 1, jpi 
    133             rswitch  = tmask(ji,jj,1) * MAX( 0._wp , SIGN( 1._wp , at_i(ji,jj) - epsi10 ) ) ! 0 if no ice 
    134             ! 
    135             !           !  solar irradiance transmission at the mixed layer bottom and used in the lead heat budget 
    136             !           !  practically no "direct lateral ablation" 
    137             !            
    138             !           !  net downward heat flux from the ice to the ocean, expressed as a function of ocean  
    139             !           !  temperature and turbulent mixing (McPhee, 1992) 
    140             ! 
    141             ! --- Energy received in the lead from atm-oce exchanges, zqld is defined everywhere (J.m-2) --- ! 
    142             zqld =  tmask(ji,jj,1) * rdt_ice *  & 
    143                &    ( ( 1._wp - at_i_b(ji,jj) ) * qsr_oce(ji,jj) * frq_m(ji,jj) +  & 
    144                &      ( 1._wp - at_i_b(ji,jj) ) * qns_oce(ji,jj) + qemp_oce(ji,jj) ) 
    145  
    146             ! --- Energy needed to bring ocean surface layer until its freezing (mostly<0 but >0 if supercooling, J.m-2) --- ! 
    147             zqfr     = rau0 * rcp * e3t_m(ji,jj) * ( t_bo(ji,jj) - ( sst_m(ji,jj) + rt0 ) ) * tmask(ji,jj,1)  ! both < 0 (t_bo < sst) and > 0 (t_bo > sst) 
    148             zqfr_neg = MIN( zqfr , 0._wp )                                                                    ! only < 0 
    149  
    150             ! --- Sensible ocean-to-ice heat flux (mostly>0 but <0 if supercooling, W/m2) 
    151             zfric_u            = MAX( SQRT( zfric(ji,jj) ), zfric_umin )  
    152             qsb_ice_bot(ji,jj) = rswitch * rau0 * rcp * zch * zfric_u * ( ( sst_m(ji,jj) + rt0 ) - t_bo(ji,jj) ) ! W.m-2 
    153  
    154             qsb_ice_bot(ji,jj) = rswitch * MIN( qsb_ice_bot(ji,jj), - zqfr_neg * r1_rdtice / MAX( at_i(ji,jj), epsi10 ) ) 
    155             ! upper bound for qsb_ice_bot: the heat retrieved from the ocean must be smaller than the heat necessary to reach  
    156             !                              the freezing point, so that we do not have SST < T_freeze 
    157             !                              This implies: - ( qsb_ice_bot(ji,jj) * at_i(ji,jj) * rtdice ) - zqfr >= 0 
    158  
    159             !-- Energy Budget of the leads (J.m-2), source of ice growth in open water. Must be < 0 to form ice 
    160             qlead(ji,jj) = MIN( 0._wp , zqld - ( qsb_ice_bot(ji,jj) * at_i(ji,jj) * rdt_ice ) - zqfr ) 
    161  
    162             ! If there is ice and leads are warming => transfer energy from the lead budget and use it for bottom melting  
    163             ! If the grid cell is fully covered by ice (no leads) => transfer energy from the lead budget to the ice bottom budget 
    164             IF( ( zqld >= 0._wp .AND. at_i(ji,jj) > 0._wp ) .OR. at_i(ji,jj) >= (1._wp - epsi10) ) THEN 
    165                fhld (ji,jj) = rswitch * zqld * r1_rdtice / MAX( at_i(ji,jj), epsi10 ) ! divided by at_i since this is (re)multiplied by a_i in icethd_dh.F90 
    166                qlead(ji,jj) = 0._wp 
    167             ELSE 
    168                fhld (ji,jj) = 0._wp 
    169             ENDIF 
    170             ! 
    171             ! Net heat flux on top of the ice-ocean [W.m-2] 
    172             ! --------------------------------------------- 
    173             qt_atm_oi(ji,jj) = qns_tot(ji,jj) + qsr_tot(ji,jj)  
    174          END DO 
    175       END DO 
     128      DO_2D( 1, 1, 1, 1 ) 
     129         rswitch  = tmask(ji,jj,1) * MAX( 0._wp , SIGN( 1._wp , at_i(ji,jj) - epsi10 ) ) ! 0 if no ice 
     130         ! 
     131         !           !  solar irradiance transmission at the mixed layer bottom and used in the lead heat budget 
     132         !           !  practically no "direct lateral ablation" 
     133         !            
     134         !           !  net downward heat flux from the ice to the ocean, expressed as a function of ocean  
     135         !           !  temperature and turbulent mixing (McPhee, 1992) 
     136         ! 
     137         ! --- Energy received in the lead from atm-oce exchanges, zqld is defined everywhere (J.m-2) --- ! 
     138         zqld =  tmask(ji,jj,1) * rDt_ice *  & 
     139            &    ( ( 1._wp - at_i_b(ji,jj) ) * qsr_oce(ji,jj) * frq_m(ji,jj) +  & 
     140            &      ( 1._wp - at_i_b(ji,jj) ) * qns_oce(ji,jj) + qemp_oce(ji,jj) ) 
     141 
     142         ! --- Energy needed to bring ocean surface layer until its freezing (mostly<0 but >0 if supercooling, J.m-2) --- ! 
     143         zqfr     = rho0 * rcp * e3t_m(ji,jj) * ( t_bo(ji,jj) - ( sst_m(ji,jj) + rt0 ) ) * tmask(ji,jj,1)  ! both < 0 (t_bo < sst) and > 0 (t_bo > sst) 
     144         zqfr_neg = MIN( zqfr , 0._wp )                                                                    ! only < 0 
     145 
     146         ! --- Sensible ocean-to-ice heat flux (mostly>0 but <0 if supercooling, W/m2) 
     147         zfric_u            = MAX( SQRT( zfric(ji,jj) ), zfric_umin )  
     148         qsb_ice_bot(ji,jj) = rswitch * rho0 * rcp * zch * zfric_u * ( ( sst_m(ji,jj) + rt0 ) - t_bo(ji,jj) ) ! W.m-2 
     149 
     150         qsb_ice_bot(ji,jj) = rswitch * MIN( qsb_ice_bot(ji,jj), - zqfr_neg * r1_Dt_ice / MAX( at_i(ji,jj), epsi10 ) ) 
     151         ! upper bound for qsb_ice_bot: the heat retrieved from the ocean must be smaller than the heat necessary to reach  
     152         !                              the freezing point, so that we do not have SST < T_freeze 
     153         !                              This implies: - ( qsb_ice_bot(ji,jj) * at_i(ji,jj) * rtdice ) - zqfr >= 0 
     154 
     155         !-- Energy Budget of the leads (J.m-2), source of ice growth in open water. Must be < 0 to form ice 
     156         qlead(ji,jj) = MIN( 0._wp , zqld - ( qsb_ice_bot(ji,jj) * at_i(ji,jj) * rDt_ice ) - zqfr ) 
     157 
     158         ! If there is ice and leads are warming => transfer energy from the lead budget and use it for bottom melting  
     159         ! If the grid cell is fully covered by ice (no leads) => transfer energy from the lead budget to the ice bottom budget 
     160         IF( ( zqld >= 0._wp .AND. at_i(ji,jj) > 0._wp ) .OR. at_i(ji,jj) >= (1._wp - epsi10) ) THEN 
     161            fhld (ji,jj) = rswitch * zqld * r1_Dt_ice / MAX( at_i(ji,jj), epsi10 ) ! divided by at_i since this is (re)multiplied by a_i in icethd_dh.F90 
     162            qlead(ji,jj) = 0._wp 
     163         ELSE 
     164            fhld (ji,jj) = 0._wp 
     165         ENDIF 
     166         ! 
     167         ! Net heat flux on top of the ice-ocean [W.m-2] 
     168         ! --------------------------------------------- 
     169         qt_atm_oi(ji,jj) = qns_tot(ji,jj) + qsr_tot(ji,jj)  
     170      END_2D 
    176171       
    177172      ! In case we bypass open-water ice formation 
     
    190185      !     Third  step in iceupdate.F90  :  heat from ice-ocean mass exchange (zf_mass) + solar 
    191186      qt_oce_ai(:,:) = ( 1._wp - at_i_b(:,:) ) * qns_oce(:,:) + qemp_oce(:,:)  &  ! Non solar heat flux received by the ocean                
    192          &             - qlead(:,:) * r1_rdtice                                &  ! heat flux taken from the ocean where there is open water ice formation 
     187         &             - qlead(:,:) * r1_Dt_ice                                &  ! heat flux taken from the ocean where there is open water ice formation 
    193188         &             - at_i (:,:) * qsb_ice_bot(:,:)                         &  ! heat flux taken by sensible flux 
    194189         &             - at_i (:,:) * fhld       (:,:)                            ! heat flux taken during bottom growth/melt  
     
    201196         ! select ice covered grid points 
    202197         npti = 0 ; nptidx(:) = 0 
    203          DO jj = 1, jpj 
    204             DO ji = 1, jpi 
    205                IF ( a_i(ji,jj,jl) > epsi10 ) THEN      
    206                   npti         = npti  + 1 
    207                   nptidx(npti) = (jj - 1) * jpi + ji 
    208                ENDIF 
    209             END DO 
    210          END DO 
     198         DO_2D( 1, 1, 1, 1 ) 
     199            IF ( a_i(ji,jj,jl) > epsi10 ) THEN      
     200               npti         = npti  + 1 
     201               nptidx(npti) = (jj - 1) * jpi + ji 
     202            ENDIF 
     203         END_2D 
    211204 
    212205         IF( npti > 0 ) THEN  ! If there is no ice, do nothing. 
     
    225218                              CALL ice_thd_dh                           ! Ice-Snow thickness    
    226219                              CALL ice_thd_pnd                          ! Melt ponds formation 
    227                               CALL ice_thd_ent( e_i_1d(1:npti,:) )      ! Ice enthalpy remapping 
     220                              CALL ice_thd_ent( e_i_1d(1:npti,:), .true. )      ! Ice enthalpy remapping 
    228221            ENDIF 
    229222                              CALL ice_thd_sal( ln_icedS )          ! --- Ice salinity --- !     
     
    243236      ! 
    244237      IF( ln_icediachk )   CALL ice_cons_hsm(1, 'icethd', rdiag_v, rdiag_s, rdiag_t, rdiag_fv, rdiag_fs, rdiag_ft) 
     238      IF( ln_icediachk )   CALL ice_cons2D  (1, 'icethd',  diag_v,  diag_s,  diag_t,  diag_fv,  diag_fs,  diag_ft) 
    245239      !                    
    246240      IF( jpl > 1  )          CALL ice_itd_rem( kt )                ! --- Transport ice between thickness categories --- ! 
     
    250244      ! controls 
    251245      IF( ln_icectl )   CALL ice_prt    (kt, iiceprt, jiceprt, 1, ' - ice thermodyn. - ') ! prints 
    252       IF( ln_ctl    )   CALL ice_prt3D  ('icethd')                                        ! prints 
     246      IF( sn_cfctl%l_prtctl )   & 
     247        &               CALL ice_prt3D  ('icethd')                                        ! prints 
    253248      IF( ln_timing )   CALL timing_stop('icethd')                                        ! timing 
    254249      ! 
     
    537532      !!------------------------------------------------------------------- 
    538533      ! 
    539       REWIND( numnam_ice_ref )              ! Namelist namthd in reference namelist : Ice thermodynamics 
    540534      READ  ( numnam_ice_ref, namthd, IOSTAT = ios, ERR = 901) 
    541 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namthd in reference namelist', lwp ) 
    542       REWIND( numnam_ice_cfg )              ! Namelist namthd in configuration namelist : Ice thermodynamics 
     535901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namthd in reference namelist' ) 
    543536      READ  ( numnam_ice_cfg, namthd, IOSTAT = ios, ERR = 902 ) 
    544 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namthd in configuration namelist', lwp ) 
     537902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namthd in configuration namelist' ) 
    545538      IF(lwm) WRITE( numoni, namthd ) 
    546539      ! 
Note: See TracChangeset for help on using the changeset viewer.