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 13710 for NEMO/branches/2020/dev_r12702_ASINTER-02_emanuelaclementi_Waves/src/OCE/SBC/sbccpl.F90 – NEMO

Ignore:
Timestamp:
2020-11-02T10:56:42+01:00 (3 years ago)
Author:
emanuelaclementi
Message:

branches/2020/dev_r12702_ASINTER-02_emanuelaclementi_Waves: merge with trunk@13708, see #2155 and #2339

Location:
NEMO/branches/2020/dev_r12702_ASINTER-02_emanuelaclementi_Waves
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r12702_ASINTER-02_emanuelaclementi_Waves

    • 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 
        88 
        99# SETTE 
        10 ^/utils/CI/sette@HEAD         sette 
         10^/utils/CI/sette@13559        sette 
  • NEMO/branches/2020/dev_r12702_ASINTER-02_emanuelaclementi_Waves/src/OCE/SBC/sbccpl.F90

    r12991 r13710  
    4242#endif 
    4343#if defined key_si3 
    44    USE icethd_dh      ! for CALL ice_thd_snwblow 
     44   USE icevar         ! for CALL ice_var_snwblow 
    4545#endif 
    4646   ! 
     
    4949   USE lib_mpp        ! distribued memory computing library 
    5050   USE lbclnk         ! ocean lateral boundary conditions (or mpp link) 
     51 
     52#if defined key_oasis3  
     53   USE mod_oasis, ONLY : OASIS_Sent, OASIS_ToRest, OASIS_SentOut, OASIS_ToRestOut  
     54#endif  
    5155 
    5256   IMPLICIT NONE 
     
    159163   INTEGER, PARAMETER ::   jps_wlev   = 32   ! water level  
    160164   INTEGER, PARAMETER ::   jps_fice1  = 33   ! first-order ice concentration (for semi-implicit coupling of atmos-ice fluxes) 
    161    INTEGER, PARAMETER ::   jps_a_p    = 34   ! meltpond area 
     165   INTEGER, PARAMETER ::   jps_a_p    = 34   ! meltpond area fraction 
    162166   INTEGER, PARAMETER ::   jps_ht_p   = 35   ! meltpond thickness 
    163167   INTEGER, PARAMETER ::   jps_kice   = 36   ! sea ice effective conductivity 
     
    166170 
    167171   INTEGER, PARAMETER ::   jpsnd      = 38   ! total number of fields sent  
     172 
     173#if ! defined key_oasis3  
     174   ! Dummy variables to enable compilation when oasis3 is not being used  
     175   INTEGER                    ::   OASIS_Sent        = -1  
     176   INTEGER                    ::   OASIS_SentOut     = -1  
     177   INTEGER                    ::   OASIS_ToRest      = -1  
     178   INTEGER                    ::   OASIS_ToRestOut   = -1  
     179#endif  
    168180 
    169181   !                                  !!** namelist namsbc_cpl ** 
     
    191203   LOGICAL     ::   ln_usecplmask         !  use a coupling mask file to merge data received from several models 
    192204                                          !   -> file cplmask.nc with the float variable called cplmask (jpi,jpj,nn_cplmodel) 
     205   LOGICAL     ::   ln_scale_ice_flux     !  use ice fluxes that are already "ice weighted" ( i.e. multiplied ice concentration)  
     206 
    193207   TYPE ::   DYNARR      
    194208      REAL(wp), POINTER, DIMENSION(:,:,:) ::   z3    
     
    198212 
    199213   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   alb_oce_mix    ! ocean albedo sent to atmosphere (mix clear/overcast sky) 
     214#if defined key_si3 || defined key_cice 
     215   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   a_i_last_couple !: Ice fractional area at last coupling time 
     216#endif 
    200217 
    201218   REAL(wp) ::   rpref = 101000._wp   ! reference atmospheric pressure[N/m2]  
     
    206223   !! Substitution 
    207224#  include "do_loop_substitute.h90" 
     225#  include "domzgr_substitute.h90" 
    208226   !!---------------------------------------------------------------------- 
    209227   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    217235      !!             ***  FUNCTION sbc_cpl_alloc  *** 
    218236      !!---------------------------------------------------------------------- 
    219       INTEGER :: ierr(4) 
     237      INTEGER :: ierr(5) 
    220238      !!---------------------------------------------------------------------- 
    221239      ierr(:) = 0 
     
    227245#endif 
    228246      ALLOCATE( xcplmask(jpi,jpj,0:nn_cplmodel) , STAT=ierr(3) ) 
    229       ! 
    230       IF( .NOT. ln_apr_dyn ) ALLOCATE( ssh_ib(jpi,jpj), ssh_ibb(jpi,jpj), apr(jpi, jpj), STAT=ierr(4) )  
     247#if defined key_si3 || defined key_cice 
     248      ALLOCATE( a_i_last_couple(jpi,jpj,jpl) , STAT=ierr(4) ) 
     249#endif 
     250      ! 
     251      IF( .NOT. ln_apr_dyn ) ALLOCATE( ssh_ib(jpi,jpj), ssh_ibb(jpi,jpj), apr(jpi, jpj), STAT=ierr(5) ) 
    231252 
    232253      sbc_cpl_alloc = MAXVAL( ierr ) 
     
    255276      REAL(wp), DIMENSION(jpi,jpj) ::   zacs, zaos 
    256277      !! 
    257       NAMELIST/namsbc_cpl/  sn_snd_temp  , sn_snd_alb   , sn_snd_thick, sn_snd_crt   , sn_snd_co2  ,   & 
    258          &                  sn_snd_ttilyr, sn_snd_cond  , sn_snd_mpnd , sn_snd_sstfrz, sn_snd_thick1,  & 
    259          &                  sn_snd_ifrac , sn_snd_crtw  , sn_snd_wlev , sn_rcv_hsig  , sn_rcv_phioc,   & 
    260          &                  sn_rcv_w10m  , sn_rcv_taumod, sn_rcv_tau  , sn_rcv_dqnsdt, sn_rcv_qsr  ,   & 
    261          &                  sn_rcv_sdrfx , sn_rcv_sdrfy , sn_rcv_wper , sn_rcv_wnum  , sn_rcv_wstrf,   & 
     278      NAMELIST/namsbc_cpl/  nn_cplmodel  , ln_usecplmask, nn_cats_cpl , ln_scale_ice_flux,             & 
     279         &                  sn_snd_temp  , sn_snd_alb   , sn_snd_thick, sn_snd_crt   , sn_snd_co2   ,  &  
     280         &                  sn_snd_ttilyr, sn_snd_cond  , sn_snd_mpnd , sn_snd_sstfrz, sn_snd_thick1,  &  
     281         &                  sn_snd_ifrac , sn_snd_crtw  , sn_snd_wlev , sn_rcv_hsig  , sn_rcv_phioc ,  &  
     282         &                  sn_rcv_w10m  , sn_rcv_taumod, sn_rcv_tau  , sn_rcv_dqnsdt, sn_rcv_qsr   ,  &  
     283         &                  sn_rcv_sdrfx , sn_rcv_sdrfy , sn_rcv_wper , sn_rcv_wnum  , sn_rcv_wstrf ,  & 
    262284         &                  sn_rcv_charn , sn_rcv_taw   , sn_rcv_bhd  , sn_rcv_tusd  , sn_rcv_tvsd,    & 
    263285         &                  sn_rcv_wdrag , sn_rcv_qns   , sn_rcv_emp  , sn_rcv_rnf   , sn_rcv_cal  ,   & 
    264          &                  sn_rcv_iceflx, sn_rcv_co2   , nn_cplmodel , ln_usecplmask, sn_rcv_mslp ,   & 
    265          &                  sn_rcv_icb   , sn_rcv_isf   , sn_rcv_ts_ice, nn_cats_cpl 
    266  
     286         &                  sn_rcv_iceflx, sn_rcv_co2   , sn_rcv_icb  , sn_rcv_isf   , sn_rcv_ts_ice  
    267287 
    268288      !!--------------------------------------------------------------------- 
     
    285305      ENDIF 
    286306      IF( lwp .AND. ln_cpl ) THEN                        ! control print 
     307         WRITE(numout,*)'  nn_cplmodel                         = ', nn_cplmodel 
     308         WRITE(numout,*)'  ln_usecplmask                       = ', ln_usecplmask 
     309         WRITE(numout,*)'  ln_scale_ice_flux                   = ', ln_scale_ice_flux 
     310         WRITE(numout,*)'  nn_cats_cpl                         = ', nn_cats_cpl 
    287311         WRITE(numout,*)'  received fields (mutiple ice categogies)' 
    288312         WRITE(numout,*)'      10m wind module                 = ', TRIM(sn_rcv_w10m%cldes  ), ' (', TRIM(sn_rcv_w10m%clcat  ), ')' 
     
    333357         WRITE(numout,*)'                      - orientation   = ', sn_snd_crtw%clvor  
    334358         WRITE(numout,*)'                      - mesh          = ', sn_snd_crtw%clvgrd  
    335          WRITE(numout,*)'  nn_cplmodel                         = ', nn_cplmodel 
    336          WRITE(numout,*)'  ln_usecplmask                       = ', ln_usecplmask 
    337          WRITE(numout,*)'  nn_cats_cpl                         = ', nn_cats_cpl 
    338359      ENDIF 
    339360 
     
    372393      !  
    373394      ! Vectors: change of sign at north fold ONLY if on the local grid 
    374       IF( TRIM( sn_rcv_tau%cldes ) == 'oce only' .OR. TRIM(sn_rcv_tau%cldes ) == 'oce and ice') THEN ! avoid working with the atmospheric fields if they are not coupled 
     395      IF(       TRIM( sn_rcv_tau%cldes ) == 'oce only' .OR. TRIM( sn_rcv_tau%cldes ) == 'oce and ice'  & 
     396           .OR. TRIM( sn_rcv_tau%cldes ) == 'mixed oce-ice' ) THEN ! avoid working with the atmospheric fields if they are not coupled 
     397      ! 
    375398      IF( TRIM( sn_rcv_tau%clvor ) == 'local grid' )   srcv(jpr_otx1:jpr_itz2)%nsgn = -1. 
    376399       
     
    720743         ! Change first letter to couple with atmosphere if already coupled OPA 
    721744         ! this is nedeed as each variable name used in the namcouple must be unique: 
    722          ! for example O_Runoff received by OPA from SAS and therefore O_Runoff received by SAS from the Atmosphere 
     745         ! for example O_Runoff received by OPA from SAS and therefore S_Runoff received by SAS from the Atmosphere 
    723746         DO jn = 1, jprcv 
    724747            IF( srcv(jn)%clname(1:1) == "O" ) srcv(jn)%clname = "S"//srcv(jn)%clname(2:LEN(srcv(jn)%clname)) 
     
    844867      END SELECT 
    845868 
     869      ! Initialise ice fractions from last coupling time to zero (needed by Met-Office) 
     870#if defined key_si3 || defined key_cice 
     871       a_i_last_couple(:,:,:) = 0._wp 
     872#endif 
    846873      !                                                      ! ------------------------- !  
    847874      !                                                      !      Ice Meltponds        !  
     
    10611088         xcplmask(:,:,:) = 0. 
    10621089         CALL iom_open( 'cplmask', inum ) 
    1063          CALL iom_get( inum, jpdom_unknown, 'cplmask', xcplmask(1:nlci,1:nlcj,1:nn_cplmodel),   & 
    1064             &          kstart = (/ mig(1),mjg(1),1 /), kcount = (/ nlci,nlcj,nn_cplmodel /) ) 
     1090         CALL iom_get( inum, jpdom_unknown, 'cplmask', xcplmask(1:jpi,1:jpj,1:nn_cplmodel),   & 
     1091            &          kstart = (/ mig(1),mjg(1),1 /), kcount = (/ jpi,jpj,nn_cplmodel /) ) 
    10651092         CALL iom_close( inum ) 
    10661093      ELSE 
     
    11331160      REAL(wp) ::   zcdrag = 1.5e-3        ! drag coefficient 
    11341161      REAL(wp) ::   zzx, zzy               ! temporary variables 
    1135       REAL(wp), DIMENSION(jpi,jpj) ::   ztx, zty, zmsk, zemp, zqns, zqsr 
     1162      REAL(wp), DIMENSION(jpi,jpj) ::   ztx, zty, zmsk, zemp, zqns, zqsr, zcloud_fra 
    11361163      !!---------------------------------------------------------------------- 
    11371164      ! 
     
    11971224            !                               
    11981225            IF( srcv(jpr_otx1)%clgrid == 'T' ) THEN 
    1199                DO_2D_00_00 
     1226               DO_2D( 0, 0, 0, 0 )                                        ! T ==> (U,V) 
    12001227                  frcv(jpr_otx1)%z3(ji,jj,1) = 0.5 * ( frcv(jpr_otx1)%z3(ji+1,jj  ,1) + frcv(jpr_otx1)%z3(ji,jj,1) ) 
    12011228                  frcv(jpr_oty1)%z3(ji,jj,1) = 0.5 * ( frcv(jpr_oty1)%z3(ji  ,jj+1,1) + frcv(jpr_oty1)%z3(ji,jj,1) ) 
    12021229               END_2D 
    1203                CALL lbc_lnk_multi( 'sbccpl', frcv(jpr_otx1)%z3(:,:,1), 'U',  -1., frcv(jpr_oty1)%z3(:,:,1), 'V',  -1. ) 
     1230               CALL lbc_lnk_multi( 'sbccpl', frcv(jpr_otx1)%z3(:,:,1), 'U',  -1.0_wp, frcv(jpr_oty1)%z3(:,:,1), 'V',  -1.0_wp ) 
    12041231            ENDIF 
    12051232            llnewtx = .TRUE. 
     
    12211248         ! => need to be done only when otx1 was changed 
    12221249         IF( llnewtx ) THEN 
    1223             DO_2D_00_00 
     1250            DO_2D( 0, 0, 0, 0 ) 
    12241251               zzx = frcv(jpr_otx1)%z3(ji-1,jj  ,1) + frcv(jpr_otx1)%z3(ji,jj,1) 
    12251252               zzy = frcv(jpr_oty1)%z3(ji  ,jj-1,1) + frcv(jpr_oty1)%z3(ji,jj,1) 
    12261253               frcv(jpr_taum)%z3(ji,jj,1) = 0.5 * SQRT( zzx * zzx + zzy * zzy ) 
    12271254            END_2D 
    1228             CALL lbc_lnk( 'sbccpl', frcv(jpr_taum)%z3(:,:,1), 'T', 1. ) 
     1255            CALL lbc_lnk( 'sbccpl', frcv(jpr_taum)%z3(:,:,1), 'T', 1.0_wp ) 
    12291256            llnewtau = .TRUE. 
    12301257         ELSE 
     
    12461273         IF( llnewtau ) THEN  
    12471274            zcoef = 1. / ( zrhoa * zcdrag )  
    1248             DO_2D_11_11 
     1275            DO_2D( 1, 1, 1, 1 ) 
    12491276               frcv(jpr_w10m)%z3(ji,jj,1) = SQRT( frcv(jpr_taum)%z3(ji,jj,1) * zcoef ) 
    12501277            END_2D 
    12511278         ENDIF 
    12521279      ENDIF 
    1253  
     1280!!$      !                                                      ! ========================= ! 
     1281!!$      SELECT CASE( TRIM( sn_rcv_clouds%cldes ) )             !       cloud fraction      ! 
     1282!!$      !                                                      ! ========================= ! 
     1283!!$      cloud_fra(:,:) = frcv(jpr_clfra)*z3(:,:,1) 
     1284!!$      END SELECT 
     1285!!$ 
     1286      zcloud_fra(:,:) = pp_cldf   ! should be real cloud fraction instead (as in the bulk) but needs to be read from atm. 
     1287      IF( ln_mixcpl ) THEN 
     1288         cloud_fra(:,:) = cloud_fra(:,:) * xcplmask(:,:,0) + zcloud_fra(:,:)* zmsk(:,:) 
     1289      ELSE 
     1290         cloud_fra(:,:) = zcloud_fra(:,:) 
     1291      ENDIF 
     1292      !                                                      ! ========================= ! 
    12541293      ! u(v)tau and taum will be modified by ice model 
    12551294      ! -> need to be reset before each call of the ice/fsbc       
     
    15291568      INTEGER ::   ji, jj   ! dummy loop indices 
    15301569      INTEGER ::   itx      ! index of taux over ice 
     1570      REAL(wp)                     ::   zztmp1, zztmp2 
    15311571      REAL(wp), DIMENSION(jpi,jpj) ::   ztx, zty  
    15321572      !!---------------------------------------------------------------------- 
     
    15921632            p_taui(:,:) = frcv(jpr_itx1)%z3(:,:,1)                   ! (U,V) ==> (U,V) 
    15931633            p_tauj(:,:) = frcv(jpr_ity1)%z3(:,:,1) 
    1594          CASE( 'F' ) 
    1595             DO_2D_00_00 
    1596                p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji,jj,1) + frcv(jpr_itx1)%z3(ji  ,jj-1,1) ) 
    1597                p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji,jj,1) + frcv(jpr_ity1)%z3(ji-1,jj  ,1) ) 
     1634         CASE( 'T' ) 
     1635            DO_2D( 0, 0, 0, 0 )                    ! T ==> (U,V) 
     1636               ! take care of the land-sea mask to avoid "pollution" of coastal stress. p[uv]taui used in frazil and  rheology  
     1637               zztmp1 = 0.5_wp * ( 2. - umask(ji,jj,1) ) * MAX( tmask(ji,jj,1),tmask(ji+1,jj  ,1) ) 
     1638               zztmp2 = 0.5_wp * ( 2. - vmask(ji,jj,1) ) * MAX( tmask(ji,jj,1),tmask(ji  ,jj+1,1) ) 
     1639               p_taui(ji,jj) = zztmp1 * ( frcv(jpr_itx1)%z3(ji+1,jj  ,1) + frcv(jpr_itx1)%z3(ji,jj,1) ) 
     1640               p_tauj(ji,jj) = zztmp2 * ( frcv(jpr_ity1)%z3(ji  ,jj+1,1) + frcv(jpr_ity1)%z3(ji,jj,1) ) 
    15981641            END_2D 
    1599          CASE( 'T' ) 
    1600             DO_2D_00_00 
    1601                p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji+1,jj  ,1) + frcv(jpr_itx1)%z3(ji,jj,1) ) 
    1602                p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji  ,jj+1,1) + frcv(jpr_ity1)%z3(ji,jj,1) ) 
    1603             END_2D 
    1604          CASE( 'I' ) 
    1605             DO_2D_00_00 
    1606                p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji+1,jj+1,1) + frcv(jpr_itx1)%z3(ji+1,jj  ,1) ) 
    1607                p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji+1,jj+1,1) + frcv(jpr_ity1)%z3(ji  ,jj+1,1) ) 
    1608             END_2D 
     1642            CALL lbc_lnk_multi( 'sbccpl', p_taui, 'U',  -1., p_tauj, 'V',  -1. ) 
    16091643         END SELECT 
    1610          IF( srcv(jpr_itx1)%clgrid /= 'U' ) THEN  
    1611             CALL lbc_lnk_multi( 'sbccpl', p_taui, 'U',  -1., p_tauj, 'V',  -1. ) 
    1612          ENDIF 
    16131644          
    16141645      ENDIF 
     
    16761707      ! 
    16771708      INTEGER  ::   ji, jj, jl   ! dummy loop index 
    1678       REAL(wp) ::   ztri         ! local scalar 
    16791709      REAL(wp), DIMENSION(jpi,jpj)     ::   zcptn, zcptrain, zcptsnw, ziceld, zmsk, zsnw 
    16801710      REAL(wp), DIMENSION(jpi,jpj)     ::   zemp_tot, zemp_ice, zemp_oce, ztprecip, zsprecip  , zevap_oce, zdevap_ice 
    16811711      REAL(wp), DIMENSION(jpi,jpj)     ::   zqns_tot, zqns_oce, zqsr_tot, zqsr_oce, zqprec_ice, zqemp_oce, zqemp_ice 
     1712      REAL(wp), DIMENSION(jpi,jpj)     ::   zevap_ice_total 
    16821713      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zqns_ice, zqsr_ice, zdqns_ice, zqevap_ice, zevap_ice, zqtr_ice_top, ztsu 
     1714      REAL(wp), DIMENSION(jpi,jpj)     ::   ztri 
    16831715      !!---------------------------------------------------------------------- 
    16841716      ! 
     
    17001732         ztprecip(:,:) =   frcv(jpr_rain)%z3(:,:,1) + zsprecip(:,:)  ! May need to ensure positive here 
    17011733         zemp_tot(:,:) =   frcv(jpr_tevp)%z3(:,:,1) - ztprecip(:,:) 
    1702          zemp_ice(:,:) = ( frcv(jpr_ievp)%z3(:,:,1) - frcv(jpr_snow)%z3(:,:,1) ) * picefr(:,:) 
    17031734      CASE( 'oce and ice'   )   ! received fields: jpr_sbpr, jpr_semp, jpr_oemp, jpr_ievp 
    17041735         zemp_tot(:,:) = ziceld(:,:) * frcv(jpr_oemp)%z3(:,:,1) + picefr(:,:) * frcv(jpr_sbpr)%z3(:,:,1) 
     
    17121743 
    17131744#if defined key_si3 
     1745 
     1746      ! --- evaporation over ice (kg/m2/s) --- ! 
     1747      IF (ln_scale_ice_flux) THEN ! typically met-office requirements 
     1748         IF (sn_rcv_emp%clcat == 'yes') THEN 
     1749            WHERE( a_i(:,:,:) > 1.e-10 )  ; zevap_ice(:,:,:) = frcv(jpr_ievp)%z3(:,:,:) * a_i_last_couple(:,:,:) / a_i(:,:,:) 
     1750            ELSEWHERE                     ; zevap_ice(:,:,:) = 0._wp 
     1751            END WHERE 
     1752            WHERE( picefr(:,:) > 1.e-10 ) ; zevap_ice_total(:,:) = SUM( zevap_ice(:,:,:) * a_i(:,:,:), dim=3 ) / picefr(:,:) 
     1753            ELSEWHERE                     ; zevap_ice_total(:,:) = 0._wp 
     1754            END WHERE 
     1755         ELSE 
     1756            WHERE( picefr(:,:) > 1.e-10 ) ; zevap_ice(:,:,1) = frcv(jpr_ievp)%z3(:,:,1) * SUM( a_i_last_couple, dim=3 ) / picefr(:,:) 
     1757            ELSEWHERE                     ; zevap_ice(:,:,1) = 0._wp 
     1758            END WHERE 
     1759            zevap_ice_total(:,:) = zevap_ice(:,:,1) 
     1760            DO jl = 2, jpl 
     1761               zevap_ice(:,:,jl) = zevap_ice(:,:,1) 
     1762            ENDDO 
     1763         ENDIF 
     1764      ELSE 
     1765         IF (sn_rcv_emp%clcat == 'yes') THEN 
     1766            zevap_ice(:,:,1:jpl) = frcv(jpr_ievp)%z3(:,:,1:jpl) 
     1767            WHERE( picefr(:,:) > 1.e-10 ) ; zevap_ice_total(:,:) = SUM( zevap_ice(:,:,:) * a_i(:,:,:), dim=3 ) / picefr(:,:) 
     1768            ELSEWHERE                     ; zevap_ice_total(:,:) = 0._wp 
     1769            END WHERE 
     1770         ELSE 
     1771            zevap_ice(:,:,1) = frcv(jpr_ievp)%z3(:,:,1) 
     1772            zevap_ice_total(:,:) = zevap_ice(:,:,1) 
     1773            DO jl = 2, jpl 
     1774               zevap_ice(:,:,jl) = zevap_ice(:,:,1) 
     1775            ENDDO 
     1776         ENDIF 
     1777      ENDIF 
     1778 
     1779      IF ( TRIM( sn_rcv_emp%cldes ) == 'conservative' ) THEN 
     1780         ! For conservative case zemp_ice has not been defined yet. Do it now. 
     1781         zemp_ice(:,:) = zevap_ice_total(:,:) * picefr(:,:) - frcv(jpr_snow)%z3(:,:,1) * picefr(:,:) 
     1782      ENDIF 
     1783 
    17141784      ! zsnw = snow fraction over ice after wind blowing (=picefr if no blowing) 
    1715       zsnw(:,:) = 0._wp   ;   CALL ice_thd_snwblow( ziceld, zsnw ) 
     1785      zsnw(:,:) = 0._wp   ;   CALL ice_var_snwblow( ziceld, zsnw ) 
    17161786       
    17171787      ! --- evaporation minus precipitation corrected (because of wind blowing on snow) --- ! 
     
    17201790 
    17211791      ! --- evaporation over ocean (used later for qemp) --- ! 
    1722       zevap_oce(:,:) = frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) * picefr(:,:) 
    1723  
    1724       ! --- evaporation over ice (kg/m2/s) --- ! 
    1725       DO jl=1,jpl 
    1726          IF(sn_rcv_emp%clcat == 'yes') THEN   ;   zevap_ice(:,:,jl) = frcv(jpr_ievp)%z3(:,:,jl) 
    1727          ELSE                                  ;   zevap_ice(:,:,jl) = frcv(jpr_ievp)%z3(:,:,1 )   ;   ENDIF 
    1728       ENDDO 
     1792      zevap_oce(:,:) = frcv(jpr_tevp)%z3(:,:,1) - zevap_ice_total(:,:) * picefr(:,:) 
    17291793 
    17301794      ! since the sensitivity of evap to temperature (devap/dT) is not prescribed by the atmosphere, we set it to 0 
     
    18041868!!      IF( srcv(jpr_rnf)%laction )   CALL iom_put( 'runoffs' , rnf(:,:) * tmask(:,:,1)                                 )  ! runoff 
    18051869!!      IF( srcv(jpr_isf)%laction )   CALL iom_put( 'iceshelf_cea', -fwfisf(:,:) * tmask(:,:,1)                         )  ! iceshelf 
    1806       IF( srcv(jpr_cal)%laction )   CALL iom_put( 'calving_cea' , frcv(jpr_cal)%z3(:,:,1) * tmask(:,:,1)                )  ! calving 
    1807       IF( srcv(jpr_icb)%laction )   CALL iom_put( 'iceberg_cea' , frcv(jpr_icb)%z3(:,:,1) * tmask(:,:,1)                )  ! icebergs 
    1808       IF( iom_use('snowpre') )      CALL iom_put( 'snowpre'     , sprecip(:,:)                                          )  ! Snow 
    1809       IF( iom_use('precip') )       CALL iom_put( 'precip'      , tprecip(:,:)                                          )  ! total  precipitation 
    1810       IF( iom_use('rain') )         CALL iom_put( 'rain'        , tprecip(:,:) - sprecip(:,:)                           )  ! liquid precipitation  
    1811       IF( iom_use('snow_ao_cea') )  CALL iom_put( 'snow_ao_cea' , sprecip(:,:) * ( 1._wp - zsnw(:,:) )                  )  ! Snow over ice-free ocean  (cell average) 
    1812       IF( iom_use('snow_ai_cea') )  CALL iom_put( 'snow_ai_cea' , sprecip(:,:) *           zsnw(:,:)                    )  ! Snow over sea-ice         (cell average) 
    1813       IF( iom_use('rain_ao_cea') )  CALL iom_put( 'rain_ao_cea' , ( tprecip(:,:) - sprecip(:,:) ) * picefr(:,:)         )  ! liquid precipitation over ocean (cell average) 
    1814       IF( iom_use('subl_ai_cea') )  CALL iom_put( 'subl_ai_cea' , frcv(jpr_ievp)%z3(:,:,1) * picefr(:,:) * tmask(:,:,1) )  ! Sublimation over sea-ice (cell average) 
    1815       IF( iom_use('evap_ao_cea') )  CALL iom_put( 'evap_ao_cea' , ( frcv(jpr_tevp)%z3(:,:,1)  & 
    1816          &                                                        - frcv(jpr_ievp)%z3(:,:,1) * picefr(:,:) ) * tmask(:,:,1) ) ! ice-free oce evap (cell average) 
     1870      IF( srcv(jpr_cal)%laction )    CALL iom_put( 'calving_cea' , frcv(jpr_cal)%z3(:,:,1) * tmask(:,:,1)                )  ! calving 
     1871      IF( srcv(jpr_icb)%laction )    CALL iom_put( 'iceberg_cea' , frcv(jpr_icb)%z3(:,:,1) * tmask(:,:,1)                )  ! icebergs 
     1872      IF( iom_use('snowpre') )       CALL iom_put( 'snowpre'     , sprecip(:,:)                                          )  ! Snow 
     1873      IF( iom_use('precip') )        CALL iom_put( 'precip'      , tprecip(:,:)                                          )  ! total  precipitation 
     1874      IF( iom_use('rain') )          CALL iom_put( 'rain'        , tprecip(:,:) - sprecip(:,:)                           )  ! liquid precipitation  
     1875      IF( iom_use('snow_ao_cea') )   CALL iom_put( 'snow_ao_cea' , sprecip(:,:) * ( 1._wp - zsnw(:,:) )                  )  ! Snow over ice-free ocean  (cell average) 
     1876      IF( iom_use('snow_ai_cea') )   CALL iom_put( 'snow_ai_cea' , sprecip(:,:) *           zsnw(:,:)                    )  ! Snow over sea-ice         (cell average) 
     1877      IF( iom_use('rain_ao_cea') )   CALL iom_put( 'rain_ao_cea' , ( tprecip(:,:) - sprecip(:,:) ) * picefr(:,:)         )  ! liquid precipitation over ocean (cell average) 
     1878      IF( iom_use('subl_ai_cea') )   CALL iom_put( 'subl_ai_cea' , frcv(jpr_ievp)%z3(:,:,1) * picefr(:,:) * tmask(:,:,1) )     ! Sublimation over sea-ice (cell average) 
     1879      IF( iom_use('evap_ao_cea') )   CALL iom_put( 'evap_ao_cea' , ( frcv(jpr_tevp)%z3(:,:,1)  & 
     1880         &                                                         - frcv(jpr_ievp)%z3(:,:,1) * picefr(:,:) ) * tmask(:,:,1) ) ! ice-free oce evap (cell average) 
    18171881      ! note: runoff output is done in sbcrnf (which includes icebergs too) and iceshelf output is done in sbcisf 
    18181882      ! 
     
    18221886      CASE( 'oce only' )         ! the required field is directly provided 
    18231887         zqns_tot(:,:) = frcv(jpr_qnsoce)%z3(:,:,1) 
     1888         ! For Met Office sea ice non-solar fluxes are already delt with by JULES so setting to zero 
     1889         ! here so the only flux is the ocean only one. 
     1890         zqns_ice(:,:,:) = 0._wp  
    18241891      CASE( 'conservative' )     ! the required fields are directly provided 
    18251892         zqns_tot(:,:) = frcv(jpr_qnsmix)%z3(:,:,1) 
     
    18391906            ENDDO 
    18401907         ELSE 
    1841             qns_tot(:,:) = qns_tot(:,:) + picefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1) 
     1908            zqns_tot(:,:) = zqns_tot(:,:) + picefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1) 
    18421909            DO jl = 1, jpl 
    1843                zqns_tot(:,:   ) = zqns_tot(:,:) + picefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1) 
    18441910               zqns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,1) 
    18451911            END DO 
     
    18521918               zqns_ice(:,:,jl) = frcv(jpr_qnsmix)%z3(:,:,jl)    & 
    18531919                  &             + frcv(jpr_dqnsdt)%z3(:,:,jl) * ( pist(:,:,jl) - ( ( rt0 + psst(:,:) ) * ziceld(:,:)   & 
    1854                   &                                                                + pist(:,:,jl) * picefr(:,:) ) ) 
     1920                  &                                             + pist(:,:,jl) * picefr(:,:) ) ) 
    18551921            END DO 
    18561922         ELSE 
     
    18581924               zqns_ice(:,:,jl) = frcv(jpr_qnsmix)%z3(:,:, 1)    & 
    18591925                  &             + frcv(jpr_dqnsdt)%z3(:,:, 1) * ( pist(:,:,jl) - ( ( rt0 + psst(:,:) ) * ziceld(:,:)   & 
    1860                   &                                                                + pist(:,:,jl) * picefr(:,:) ) ) 
     1926                  &                                             + pist(:,:,jl) * picefr(:,:) ) ) 
    18611927            END DO 
    18621928         ENDIF 
     
    19642030      CASE( 'oce only' ) 
    19652031         zqsr_tot(:,:  ) = MAX( 0._wp , frcv(jpr_qsroce)%z3(:,:,1) ) 
     2032         ! For Met Office sea ice solar fluxes are already delt with by JULES so setting to zero 
     2033         ! here so the only flux is the ocean only one. 
     2034         zqsr_ice(:,:,:) = 0._wp 
    19662035      CASE( 'conservative' ) 
    19672036         zqsr_tot(:,:  ) = frcv(jpr_qsrmix)%z3(:,:,1) 
     
    19822051            END DO 
    19832052         ELSE 
    1984             qsr_tot(:,:   ) = qsr_tot(:,:) + picefr(:,:) * frcv(jpr_qsrice)%z3(:,:,1) 
     2053            zqsr_tot(:,:) = zqsr_tot(:,:) + picefr(:,:) * frcv(jpr_qsrice)%z3(:,:,1) 
    19852054            DO jl = 1, jpl 
    1986                zqsr_tot(:,:   ) = zqsr_tot(:,:) + picefr(:,:) * frcv(jpr_qsrice)%z3(:,:,1) 
    19872055               zqsr_ice(:,:,jl) = frcv(jpr_qsrice)%z3(:,:,1) 
    19882056            END DO 
     
    20502118            ENDDO 
    20512119         ENDIF 
     2120      CASE( 'none' )  
     2121         zdqns_ice(:,:,:) = 0._wp 
    20522122      END SELECT 
    20532123       
     
    20652135      !                                                      ! ========================= ! 
    20662136      CASE ('coupled') 
    2067          IF( ln_mixcpl ) THEN 
    2068             DO jl=1,jpl 
    2069                qml_ice(:,:,jl) = qml_ice(:,:,jl) * xcplmask(:,:,0) + frcv(jpr_topm)%z3(:,:,jl) * zmsk(:,:) 
    2070                qcn_ice(:,:,jl) = qcn_ice(:,:,jl) * xcplmask(:,:,0) + frcv(jpr_botm)%z3(:,:,jl) * zmsk(:,:) 
    2071             ENDDO 
     2137         IF (ln_scale_ice_flux) THEN 
     2138            WHERE( a_i(:,:,:) > 1.e-10_wp ) 
     2139               qml_ice(:,:,:) = frcv(jpr_topm)%z3(:,:,:) * a_i_last_couple(:,:,:) / a_i(:,:,:) 
     2140               qcn_ice(:,:,:) = frcv(jpr_botm)%z3(:,:,:) * a_i_last_couple(:,:,:) / a_i(:,:,:) 
     2141            ELSEWHERE 
     2142               qml_ice(:,:,:) = 0.0_wp 
     2143               qcn_ice(:,:,:) = 0.0_wp 
     2144            END WHERE 
    20722145         ELSE 
    20732146            qml_ice(:,:,:) = frcv(jpr_topm)%z3(:,:,:) 
     
    20802153      IF( .NOT.ln_cndflx ) THEN                              !==  No conduction flux as surface forcing  ==! 
    20812154         ! 
    2082          !                    ! ===> used prescribed cloud fraction representative for polar oceans in summer (0.81) 
    2083          ztri = 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice    ! surface transmission when hi>10cm (Grenfell Maykut 77) 
    2084          ! 
    2085          WHERE    ( phs(:,:,:) <= 0._wp .AND. phi(:,:,:) <  0.1_wp )       ! linear decrease from hi=0 to 10cm   
    2086             zqtr_ice_top(:,:,:) = qsr_ice(:,:,:) * ( ztri + ( 1._wp - ztri ) * ( 1._wp - phi(:,:,:) * 10._wp ) ) 
    2087          ELSEWHERE( phs(:,:,:) <= 0._wp .AND. phi(:,:,:) >= 0.1_wp )       ! constant (ztri) when hi>10cm 
    2088             zqtr_ice_top(:,:,:) = qsr_ice(:,:,:) * ztri 
    2089          ELSEWHERE                                                         ! zero when hs>0 
    2090             zqtr_ice_top(:,:,:) = 0._wp 
    2091          END WHERE 
     2155         IF( nn_qtrice == 0 ) THEN 
     2156            ! formulation derived from Grenfell and Maykut (1977), where transmission rate 
     2157            !    1) depends on cloudiness 
     2158            !       ! ===> used prescribed cloud fraction representative for polar oceans in summer (0.81) 
     2159            !       !      should be real cloud fraction instead (as in the bulk) but needs to be read from atm. 
     2160            !    2) is 0 when there is any snow 
     2161            !    3) tends to 1 for thin ice 
     2162            ztri(:,:) = 0.18 * ( 1.0 - cloud_fra(:,:) ) + 0.35 * cloud_fra(:,:)  ! surface transmission when hi>10cm 
     2163            DO jl = 1, jpl 
     2164               WHERE    ( phs(:,:,jl) <= 0._wp .AND. phi(:,:,jl) <  0.1_wp )       ! linear decrease from hi=0 to 10cm   
     2165                  zqtr_ice_top(:,:,jl) = zqsr_ice(:,:,jl) * ( ztri(:,:) + ( 1._wp - ztri(:,:) ) * ( 1._wp - phi(:,:,jl) * 10._wp ) ) 
     2166               ELSEWHERE( phs(:,:,jl) <= 0._wp .AND. phi(:,:,jl) >= 0.1_wp )       ! constant (ztri) when hi>10cm 
     2167                  zqtr_ice_top(:,:,jl) = zqsr_ice(:,:,jl) * ztri(:,:) 
     2168               ELSEWHERE                                                           ! zero when hs>0 
     2169                  zqtr_ice_top(:,:,jl) = 0._wp  
     2170               END WHERE 
     2171            ENDDO 
     2172         ELSEIF( nn_qtrice == 1 ) THEN 
     2173            ! formulation is derived from the thesis of M. Lebrun (2019). 
     2174            !    It represents the best fit using several sets of observations 
     2175            !    It comes with snow conductivities adapted to freezing/melting conditions (see icethd_zdf_bl99.F90) 
     2176            zqtr_ice_top(:,:,:) = 0.3_wp * zqsr_ice(:,:,:) 
     2177         ENDIF 
    20922178         !      
    20932179      ELSEIF( ln_cndflx .AND. .NOT.ln_cndemulate ) THEN      !==  conduction flux as surface forcing  ==! 
    20942180         ! 
    2095          !                    ! ===> here we must receive the qtr_ice_top array from the coupler 
    2096          !                           for now just assume zero (fully opaque ice) 
     2181         !          ! ===> here we must receive the qtr_ice_top array from the coupler 
     2182         !                 for now just assume zero (fully opaque ice) 
    20972183         zqtr_ice_top(:,:,:) = 0._wp 
    20982184         ! 
     
    21512237      ! 
    21522238      isec = ( kt - nit000 ) * NINT( rn_Dt )        ! date of exchanges 
     2239      info = OASIS_idle 
    21532240 
    21542241      zfr_l(:,:) = 1.- fr_i(:,:) 
     
    22892376      ENDIF 
    22902377 
     2378#if defined key_si3 || defined key_cice 
     2379      ! If this coupling was successful then save ice fraction for use between coupling points.  
     2380      ! This is needed for some calculations where the ice fraction at the last coupling point  
     2381      ! is needed.  
     2382      IF(  info == OASIS_Sent    .OR. info == OASIS_ToRest .OR. &  
     2383         & info == OASIS_SentOut .OR. info == OASIS_ToRestOut ) THEN  
     2384         IF ( sn_snd_thick%clcat == 'yes' ) THEN  
     2385           a_i_last_couple(:,:,1:jpl) = a_i(:,:,1:jpl) 
     2386         ENDIF 
     2387      ENDIF 
     2388#endif 
     2389 
    22912390      IF( ssnd(jps_fice1)%laction ) THEN 
    22922391         SELECT CASE( sn_snd_thick1%clcat ) 
     
    23522451            SELECT CASE( sn_snd_mpnd%clcat )   
    23532452            CASE( 'yes' )   
    2354                ztmp3(:,:,1:jpl) =  a_ip_frac(:,:,1:jpl) 
     2453               ztmp3(:,:,1:jpl) =  a_ip_eff(:,:,1:jpl) 
    23552454               ztmp4(:,:,1:jpl) =  h_ip(:,:,1:jpl)   
    23562455            CASE( 'no' )   
     
    23582457               ztmp4(:,:,:) = 0.0   
    23592458               DO jl=1,jpl   
    2360                  ztmp3(:,:,1) = ztmp3(:,:,1) + a_ip_frac(:,:,jpl)   
    2361                  ztmp4(:,:,1) = ztmp4(:,:,1) + h_ip(:,:,jpl)  
     2459                 ztmp3(:,:,1) = ztmp3(:,:,1) + a_ip_frac(:,:,jpl) 
     2460                 ztmp4(:,:,1) = ztmp4(:,:,1) + h_ip(:,:,jpl) 
    23622461               ENDDO   
    23632462            CASE default   ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_mpnd%clcat' )   
     
    24202519            SELECT CASE( TRIM( sn_snd_crt%cldes ) ) 
    24212520            CASE( 'oce only'             )      ! C-grid ==> T 
    2422                DO_2D_00_00 
     2521               DO_2D( 0, 0, 0, 0 ) 
    24232522                  zotx1(ji,jj) = 0.5 * ( uu(ji,jj,1,Kmm) + uu(ji-1,jj  ,1,Kmm) ) 
    24242523                  zoty1(ji,jj) = 0.5 * ( vv(ji,jj,1,Kmm) + vv(ji  ,jj-1,1,Kmm) )  
    24252524               END_2D 
    24262525            CASE( 'weighted oce and ice' )      ! Ocean and Ice on C-grid ==> T   
    2427                DO_2D_00_00 
     2526               DO_2D( 0, 0, 0, 0 ) 
    24282527                  zotx1(ji,jj) = 0.5 * ( uu   (ji,jj,1,Kmm) + uu   (ji-1,jj  ,1,Kmm) ) * zfr_l(ji,jj)   
    24292528                  zoty1(ji,jj) = 0.5 * ( vv   (ji,jj,1,Kmm) + vv   (ji  ,jj-1,1,Kmm) ) * zfr_l(ji,jj) 
     
    24312530                  zity1(ji,jj) = 0.5 * ( v_ice(ji,jj  )     + v_ice(ji  ,jj-1  )     ) *  fr_i(ji,jj) 
    24322531               END_2D 
    2433                CALL lbc_lnk_multi( 'sbccpl', zitx1, 'T', -1., zity1, 'T', -1. ) 
     2532               CALL lbc_lnk_multi( 'sbccpl', zitx1, 'T', -1.0_wp, zity1, 'T', -1.0_wp ) 
    24342533            CASE( 'mixed oce-ice'        )      ! Ocean and Ice on C-grid ==> T 
    2435                DO_2D_00_00 
     2534               DO_2D( 0, 0, 0, 0 ) 
    24362535                  zotx1(ji,jj) = 0.5 * ( uu   (ji,jj,1,Kmm) + uu   (ji-1,jj  ,1,Kmm) ) * zfr_l(ji,jj)   & 
    24372536                     &         + 0.5 * ( u_ice(ji,jj  )     + u_ice(ji-1,jj    )     ) *  fr_i(ji,jj) 
     
    24402539               END_2D 
    24412540            END SELECT 
    2442             CALL lbc_lnk_multi( 'sbccpl', zotx1, ssnd(jps_ocx1)%clgrid, -1.,  zoty1, ssnd(jps_ocy1)%clgrid, -1. ) 
     2541            CALL lbc_lnk_multi( 'sbccpl', zotx1, ssnd(jps_ocx1)%clgrid, -1.0_wp,  zoty1, ssnd(jps_ocy1)%clgrid, -1.0_wp ) 
    24432542            ! 
    24442543         ENDIF 
     
    24972596          SELECT CASE( TRIM( sn_snd_crtw%cldes ) )  
    24982597          CASE( 'oce only'             )      ! C-grid ==> T  
    2499              DO_2D_00_00 
     2598             DO_2D( 0, 0, 0, 0 ) 
    25002599                zotx1(ji,jj) = 0.5 * ( uu(ji,jj,1,Kmm) + uu(ji-1,jj  ,1,Kmm) )  
    25012600                zoty1(ji,jj) = 0.5 * ( vv(ji,jj,1,Kmm) + vv(ji , jj-1,1,Kmm) )   
    25022601             END_2D 
    25032602          CASE( 'weighted oce and ice' )      ! Ocean and Ice on C-grid ==> T    
    2504              DO_2D_00_00 
     2603             DO_2D( 0, 0, 0, 0 ) 
    25052604                zotx1(ji,jj) = 0.5 * ( uu   (ji,jj,1,Kmm) + uu   (ji-1,jj  ,1,Kmm) ) * zfr_l(ji,jj)    
    25062605                zoty1(ji,jj) = 0.5 * ( vv   (ji,jj,1,Kmm) + vv   (ji  ,jj-1,1,Kmm) ) * zfr_l(ji,jj)  
     
    25082607                zity1(ji,jj) = 0.5 * ( v_ice(ji,jj  ) + v_ice(ji  ,jj-1  ) ) *  fr_i(ji,jj)  
    25092608             END_2D 
    2510              CALL lbc_lnk_multi( 'sbccpl', zitx1, 'T', -1.,  zity1, 'T', -1. )  
     2609             CALL lbc_lnk_multi( 'sbccpl', zitx1, 'T', -1.0_wp,  zity1, 'T', -1.0_wp )  
    25112610          CASE( 'mixed oce-ice'        )      ! Ocean and Ice on C-grid ==> T   
    2512              DO_2D_00_00 
     2611             DO_2D( 0, 0, 0, 0 ) 
    25132612                zotx1(ji,jj) = 0.5 * ( uu   (ji,jj,1,Kmm) + uu   (ji-1,jj  ,1,Kmm) ) * zfr_l(ji,jj)   &  
    25142613                   &         + 0.5 * ( u_ice(ji,jj  ) + u_ice(ji-1,jj    ) ) *  fr_i(ji,jj)  
     
    25172616             END_2D 
    25182617          END SELECT 
    2519          CALL lbc_lnk_multi( 'sbccpl', zotx1, ssnd(jps_ocxw)%clgrid, -1., zoty1, ssnd(jps_ocyw)%clgrid, -1. )  
     2618         CALL lbc_lnk_multi( 'sbccpl', zotx1, ssnd(jps_ocxw)%clgrid, -1.0_wp, zoty1, ssnd(jps_ocyw)%clgrid, -1.0_wp )  
    25202619         !  
    25212620         !  
Note: See TracChangeset for help on using the changeset viewer.