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 12132 – NEMO

Changeset 12132


Ignore:
Timestamp:
2019-12-10T11:38:28+01:00 (4 years ago)
Author:
smasson
Message:

trunk: coupling interface bugfixes, part 1

Location:
NEMO/trunk/src/OCE
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/IOM/iom.F90

    r11993 r12132  
    806806      CHARACTER(LEN=100)    ::   clinfo    ! info character 
    807807      !--------------------------------------------------------------------- 
     808      ! 
     809      IF( iom_open_init == 0 )   RETURN   ! avoid to use iom_file(jf)%nfid that us not yet initialized 
    808810      ! 
    809811      clinfo = '                    iom_close ~~~  ' 
  • NEMO/trunk/src/OCE/SBC/cpl_oasis3.F90

    r10582 r12132  
    306306      ! End of definition phase 
    307307      !------------------------------------------------------------------ 
    308        
     308      !      
     309#if defined key_agrif 
     310      IF( agrif_fixed() == Agrif_Nb_Fine_Grids() ) THEN 
     311#endif 
    309312      CALL oasis_enddef(nerror) 
    310313      IF( nerror /= OASIS_Ok )   CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in oasis_enddef') 
     314#if defined key_agrif 
     315      ENDIF 
     316#endif 
    311317      ! 
    312318      IF ( ltmp_wapatch ) THEN 
     
    357363                     WRITE(numout,*) 'oasis_put:  kstep ', kstep 
    358364                     WRITE(numout,*) 'oasis_put:   info ', kinfo 
    359                      WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(:,:,jc)) 
    360                      WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(:,:,jc)) 
    361                      WRITE(numout,*) '     -     Sum value is ', SUM(pdata(:,:,jc)) 
     365                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(nldi:nlei,nldj:nlej,jc)) 
     366                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(nldi:nlei,nldj:nlej,jc)) 
     367                     WRITE(numout,*) '     -     Sum value is ', SUM(pdata(nldi:nlei,nldj:nlej,jc)) 
    362368                     WRITE(numout,*) '****************' 
    363369                  ENDIF 
  • NEMO/trunk/src/OCE/SBC/sbc_oce.F90

    r10882 r12132  
    105105   !!              Ocean Surface Boundary Condition fields 
    106106   !!---------------------------------------------------------------------- 
    107    INTEGER , PUBLIC ::  ncpl_qsr_freq            !: qsr coupling frequency per days from atmosphere 
     107   INTEGER , PUBLIC ::  ncpl_qsr_freq = 0        !: qsr coupling frequency per days from atmosphere (used by top) 
    108108   ! 
    109109   LOGICAL , PUBLIC ::   lhftau = .FALSE.        !: HF tau used in TKE: mean(stress module) - module(mean stress) 
  • NEMO/trunk/src/OCE/SBC/sbccpl.F90

    r11993 r12132  
    573573      IF ( TRIM( sn_rcv_emp%clcat    ) == 'yes' )   srcv(jpr_ievp)%nct       = nn_cats_cpl 
    574574 
     575      IF( ln_cndflx .AND. .NOT.ln_cndemulate ) THEN  
     576         IF( .NOT.srcv(jpr_ts_ice)%laction )  & 
     577            &   CALL ctl_stop( 'sbc_cpl_init: srcv(jpr_ts_ice)%laction should be set to true when ln_cndflx=T' )      
     578      ENDIF 
    575579      !                                                      ! ------------------------- ! 
    576580      !                                                      !      Wave breaking        !     
     
    10401044      ENDIF 
    10411045      xcplmask(:,:,0) = 1. - SUM( xcplmask(:,:,1:nn_cplmodel), dim = 3 ) 
    1042       ! 
    1043       ncpl_qsr_freq = cpl_freq( 'O_QsrOce' ) + cpl_freq( 'O_QsrMix' ) + cpl_freq( 'I_QsrOce' ) + cpl_freq( 'I_QsrMix' ) 
    1044       IF( ln_dm2dc .AND. ln_cpl .AND. ncpl_qsr_freq /= 86400 )   & 
    1045          &   CALL ctl_stop( 'sbc_cpl_init: diurnal cycle reconstruction (ln_dm2dc) needs daily couping for solar radiation' ) 
    1046       IF( ln_dm2dc .AND. ln_cpl ) ncpl_qsr_freq = 86400 / ncpl_qsr_freq 
    10471046      ! 
    10481047   END SUBROUTINE sbc_cpl_init 
     
    11101109      REAL(wp), DIMENSION(jpi,jpj) ::   ztx, zty, zmsk, zemp, zqns, zqsr 
    11111110      !!---------------------------------------------------------------------- 
     1111      ! 
     1112      IF( kt == nit000 ) THEN 
     1113      !   cannot be done in the init phase when we use agrif as cpl_freq requires that oasis_enddef is done 
     1114         ncpl_qsr_freq = cpl_freq( 'O_QsrOce' ) + cpl_freq( 'O_QsrMix' ) + cpl_freq( 'I_QsrOce' ) + cpl_freq( 'I_QsrMix' ) 
     1115         IF( ln_dm2dc .AND. ncpl_qsr_freq /= 86400 )   & 
     1116            &   CALL ctl_stop( 'sbc_cpl_rcv: diurnal cycle reconstruction (ln_dm2dc) needs daily couping for solar radiation' ) 
     1117         ncpl_qsr_freq = 86400 / ncpl_qsr_freq   ! used by top 
     1118      ENDIF 
    11121119      ! 
    11131120      IF( ln_mixcpl )   zmsk(:,:) = 1. - xcplmask(:,:,0) 
     
    12431250      IF( srcv(jpr_co2)%laction )   atm_co2(:,:) = frcv(jpr_co2)%z3(:,:,1) 
    12441251      ! 
    1245       !                                                      ! ================== ! 
    1246       !                                                      !   ice skin temp.   ! 
    1247       !                                                      ! ================== ! 
    1248 #if defined key_si3 
    1249       ! needed by Met Office 
    1250       IF( srcv(jpr_ts_ice)%laction ) THEN  
    1251          WHERE    ( frcv(jpr_ts_ice)%z3(:,:,:) > 0.0  )   ;   tsfc_ice(:,:,:) = 0.0  
    1252          ELSEWHERE( frcv(jpr_ts_ice)%z3(:,:,:) < -60. )   ;   tsfc_ice(:,:,:) = -60. 
    1253          ELSEWHERE                                        ;   tsfc_ice(:,:,:) = frcv(jpr_ts_ice)%z3(:,:,:) 
    1254          END WHERE 
    1255       ENDIF  
    1256 #endif 
    12571252      !                                                      ! ========================= !  
    12581253      !                                                      ! Mean Sea Level Pressure   !   (taum)  
     
    16301625      !!                   sprecip           solid precipitation over the ocean   
    16311626      !!---------------------------------------------------------------------- 
    1632       REAL(wp), INTENT(in), DIMENSION(:,:)             ::   picefr     ! ice fraction                [0 to 1] 
    1633       !                                                !!           ! optional arguments, used only in 'mixed oce-ice' case 
    1634       REAL(wp), INTENT(in), DIMENSION(:,:,:), OPTIONAL ::   palbi      ! all skies ice albedo  
    1635       REAL(wp), INTENT(in), DIMENSION(:,:  ), OPTIONAL ::   psst       ! sea surface temperature     [Celsius] 
    1636       REAL(wp), INTENT(in), DIMENSION(:,:,:), OPTIONAL ::   pist       ! ice surface temperature     [Kelvin] 
    1637       REAL(wp), INTENT(in), DIMENSION(:,:,:), OPTIONAL ::   phs        ! snow depth                  [m] 
    1638       REAL(wp), INTENT(in), DIMENSION(:,:,:), OPTIONAL ::   phi        ! ice thickness               [m] 
     1627      REAL(wp), INTENT(in)   , DIMENSION(:,:)             ::   picefr     ! ice fraction                [0 to 1] 
     1628      !                                                   !!           ! optional arguments, used only in 'mixed oce-ice' case or for Met-Office coupling 
     1629      REAL(wp), INTENT(in)   , DIMENSION(:,:,:), OPTIONAL ::   palbi      ! all skies ice albedo  
     1630      REAL(wp), INTENT(in)   , DIMENSION(:,:  ), OPTIONAL ::   psst       ! sea surface temperature     [Celsius] 
     1631      REAL(wp), INTENT(inout), DIMENSION(:,:,:), OPTIONAL ::   pist       ! ice surface temperature     [Kelvin] => inout for Met-Office 
     1632      REAL(wp), INTENT(in)   , DIMENSION(:,:,:), OPTIONAL ::   phs        ! snow depth                  [m] 
     1633      REAL(wp), INTENT(in)   , DIMENSION(:,:,:), OPTIONAL ::   phi        ! ice thickness               [m] 
    16391634      ! 
    16401635      INTEGER  ::   ji, jj, jl   ! dummy loop index 
     
    16431638      REAL(wp), DIMENSION(jpi,jpj)     ::   zemp_tot, zemp_ice, zemp_oce, ztprecip, zsprecip  , zevap_oce, zdevap_ice 
    16441639      REAL(wp), DIMENSION(jpi,jpj)     ::   zqns_tot, zqns_oce, zqsr_tot, zqsr_oce, zqprec_ice, zqemp_oce, zqemp_ice 
    1645       REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zqns_ice, zqsr_ice, zdqns_ice, zqevap_ice, zevap_ice    !!gm , zfrqsr_tr_i 
     1640      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zqns_ice, zqsr_ice, zdqns_ice, zqevap_ice, zevap_ice, zqtr_ice_top, ztsu 
    16461641      !!---------------------------------------------------------------------- 
    16471642      ! 
     
    18101805! ** NEED TO SORT OUT HOW THIS SHOULD WORK IN THE MULTI-CATEGORY CASE - CURRENTLY NOT ALLOWED WHEN INTERFACE INITIALISED ** 
    18111806         zqns_tot(:,:  ) = frcv(jpr_qnsmix)%z3(:,:,1) 
    1812          zqns_ice(:,:,1) = frcv(jpr_qnsmix)%z3(:,:,1)    & 
    1813             &            + frcv(jpr_dqnsdt)%z3(:,:,1) * ( pist(:,:,1) - ( (rt0 + psst(:,:  ) ) * ziceld(:,:)   & 
    1814             &                                           + pist(:,:,1) * picefr(:,:) ) ) 
     1807         IF ( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN 
     1808            DO jl = 1, jpl 
     1809               zqns_ice(:,:,jl) = frcv(jpr_qnsmix)%z3(:,:,jl)    & 
     1810                  &             + frcv(jpr_dqnsdt)%z3(:,:,jl) * ( pist(:,:,jl) - ( ( rt0 + psst(:,:) ) * ziceld(:,:)   & 
     1811                  &                                                                + pist(:,:,jl) * picefr(:,:) ) ) 
     1812            END DO 
     1813         ELSE 
     1814            DO jl = 1, jpl 
     1815               zqns_ice(:,:,jl) = frcv(jpr_qnsmix)%z3(:,:, 1)    & 
     1816                  &             + frcv(jpr_dqnsdt)%z3(:,:, 1) * ( pist(:,:,jl) - ( ( rt0 + psst(:,:) ) * ziceld(:,:)   & 
     1817                  &                                                                + pist(:,:,jl) * picefr(:,:) ) ) 
     1818            END DO 
     1819         ENDIF 
    18151820      END SELECT 
    18161821      !                                      
     
    19241929            END DO 
    19251930         ENDIF 
    1926          zqsr_tot(:,:  ) = frcv(jpr_qsrmix)%z3(:,:,1) 
    1927          zqsr_ice(:,:,1) = frcv(jpr_qsrice)%z3(:,:,1) 
    19281931      CASE( 'oce and ice' ) 
    19291932         zqsr_tot(:,:  ) =  ziceld(:,:) * frcv(jpr_qsroce)%z3(:,:,1) 
     
    19451948!       Create solar heat flux over ice using incoming solar heat flux and albedos 
    19461949!       ( see OASIS3 user guide, 5th edition, p39 ) 
    1947          zqsr_ice(:,:,1) = frcv(jpr_qsrmix)%z3(:,:,1) * ( 1.- palbi(:,:,1) )   & 
    1948             &            / (  1.- ( alb_oce_mix(:,:  ) * ziceld(:,:)       & 
    1949             &                     + palbi      (:,:,1) * picefr(:,:) ) ) 
     1950         IF ( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN 
     1951            DO jl = 1, jpl 
     1952               zqsr_ice(:,:,jl) = frcv(jpr_qsrmix)%z3(:,:,jl) * ( 1.- palbi(:,:,jl) )   & 
     1953                  &            / (  1.- ( alb_oce_mix(:,:   ) * ziceld(:,:)       & 
     1954                  &                     + palbi      (:,:,jl) * picefr(:,:) ) ) 
     1955            END DO 
     1956         ELSE 
     1957            DO jl = 1, jpl 
     1958               zqsr_ice(:,:,jl) = frcv(jpr_qsrmix)%z3(:,:, 1) * ( 1.- palbi(:,:,jl) )   & 
     1959                  &            / (  1.- ( alb_oce_mix(:,:   ) * ziceld(:,:)       & 
     1960                  &                     + palbi      (:,:,jl) * picefr(:,:) ) ) 
     1961            END DO 
     1962         ENDIF 
    19501963      CASE( 'none'      )       ! Not available as for now: needs additional coding   
    19511964      !                         ! since fields received, here zqsr_tot,  are not defined with none option 
     
    20072020      !                                                      ! ========================= ! 
    20082021      CASE ('coupled') 
    2009          qml_ice(:,:,:) = frcv(jpr_topm)%z3(:,:,:) 
    2010          qcn_ice(:,:,:) = frcv(jpr_botm)%z3(:,:,:) 
     2022         IF( ln_mixcpl ) THEN 
     2023            DO jl=1,jpl 
     2024               qml_ice(:,:,jl) = qml_ice(:,:,jl) * xcplmask(:,:,0) + frcv(jpr_topm)%z3(:,:,jl) * zmsk(:,:) 
     2025               qcn_ice(:,:,jl) = qcn_ice(:,:,jl) * xcplmask(:,:,0) + frcv(jpr_botm)%z3(:,:,jl) * zmsk(:,:) 
     2026            ENDDO 
     2027         ELSE 
     2028            qml_ice(:,:,:) = frcv(jpr_topm)%z3(:,:,:) 
     2029            qcn_ice(:,:,:) = frcv(jpr_botm)%z3(:,:,:) 
     2030         ENDIF 
    20112031      END SELECT 
    2012       ! 
    20132032      !                                                      ! ========================= ! 
    20142033      !                                                      !      Transmitted Qsr      !   [W/m2] 
     
    20172036         ! 
    20182037         !                    ! ===> used prescribed cloud fraction representative for polar oceans in summer (0.81) 
    2019          ztri = 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice    ! surface transmission parameter (Grenfell Maykut 77) 
     2038         ztri = 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice    ! surface transmission when hi>10cm (Grenfell Maykut 77) 
    20202039         ! 
    2021          qtr_ice_top(:,:,:) = ztri * qsr_ice(:,:,:) 
    2022          WHERE( phs(:,:,:) >= 0.0_wp )   qtr_ice_top(:,:,:) = 0._wp            ! snow fully opaque 
    2023          WHERE( phi(:,:,:) <= 0.1_wp )   qtr_ice_top(:,:,:) = qsr_ice(:,:,:)   ! thin ice transmits all solar radiation 
     2040         WHERE    ( phs(:,:,:) <= 0._wp .AND. phi(:,:,:) <  0.1_wp )       ! linear decrease from hi=0 to 10cm   
     2041            zqtr_ice_top(:,:,:) = qsr_ice(:,:,:) * ( ztri + ( 1._wp - ztri ) * ( 1._wp - phi(:,:,:) * 10._wp ) ) 
     2042         ELSEWHERE( phs(:,:,:) <= 0._wp .AND. phi(:,:,:) >= 0.1_wp )       ! constant (ztri) when hi>10cm 
     2043            zqtr_ice_top(:,:,:) = qsr_ice(:,:,:) * ztri 
     2044         ELSEWHERE                                                         ! zero when hs>0 
     2045            zqtr_ice_top(:,:,:) = 0._wp 
     2046         END WHERE 
    20242047         !      
    20252048      ELSEIF( ln_cndflx .AND. .NOT.ln_cndemulate ) THEN      !==  conduction flux as surface forcing  ==! 
     
    20272050         !                    ! ===> here we must receive the qtr_ice_top array from the coupler 
    20282051         !                           for now just assume zero (fully opaque ice) 
    2029          qtr_ice_top(:,:,:) = 0._wp 
     2052         zqtr_ice_top(:,:,:) = 0._wp 
     2053         ! 
     2054      ENDIF 
     2055      ! 
     2056      IF( ln_mixcpl ) THEN 
     2057         DO jl=1,jpl 
     2058            qtr_ice_top(:,:,jl) = qtr_ice_top(:,:,jl) * xcplmask(:,:,0) + zqtr_ice_top(:,:,jl) * zmsk(:,:) 
     2059         ENDDO 
     2060      ELSE 
     2061         qtr_ice_top(:,:,:) = zqtr_ice_top(:,:,:) 
     2062      ENDIF 
     2063      !                                                      ! ================== ! 
     2064      !                                                      !   ice skin temp.   ! 
     2065      !                                                      ! ================== ! 
     2066      ! needed by Met Office 
     2067      IF( srcv(jpr_ts_ice)%laction ) THEN  
     2068         WHERE    ( frcv(jpr_ts_ice)%z3(:,:,:) > 0.0  )   ;   ztsu(:,:,:) =   0. + rt0  
     2069         ELSEWHERE( frcv(jpr_ts_ice)%z3(:,:,:) < -60. )   ;   ztsu(:,:,:) = -60. + rt0 
     2070         ELSEWHERE                                        ;   ztsu(:,:,:) = frcv(jpr_ts_ice)%z3(:,:,:) + rt0 
     2071         END WHERE 
     2072         ! 
     2073         IF( ln_mixcpl ) THEN 
     2074            DO jl=1,jpl 
     2075               pist(:,:,jl) = pist(:,:,jl) * xcplmask(:,:,0) + ztsu(:,:,jl) * zmsk(:,:) 
     2076            ENDDO 
     2077         ELSE 
     2078            pist(:,:,:) = ztsu(:,:,:) 
     2079         ENDIF 
    20302080         ! 
    20312081      ENDIF 
     
    21902240         CASE default    ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_thick%clcat' ) 
    21912241         END SELECT 
    2192          IF( ssnd(jps_fice)%laction )   CALL cpl_snd( jps_fice, isec, ztmp3, info ) 
     2242         CALL cpl_snd( jps_fice, isec, ztmp3, info ) 
    21932243      ENDIF 
    21942244 
     
    22502300      !                                                      !      Ice melt ponds       !  
    22512301      !                                                      ! ------------------------- ! 
    2252       ! needed by Met Office 
     2302      ! needed by Met Office: 1) fraction of ponded ice 2) local/actual pond depth  
    22532303      IF( ssnd(jps_a_p)%laction .OR. ssnd(jps_ht_p)%laction ) THEN  
    22542304         SELECT CASE( sn_snd_mpnd%cldes)   
     
    22562306            SELECT CASE( sn_snd_mpnd%clcat )   
    22572307            CASE( 'yes' )   
    2258                ztmp3(:,:,1:jpl) =  a_ip(:,:,1:jpl) 
    2259                ztmp4(:,:,1:jpl) =  v_ip(:,:,1:jpl)   
     2308               ztmp3(:,:,1:jpl) =  a_ip_frac(:,:,1:jpl) 
     2309               ztmp4(:,:,1:jpl) =  h_ip(:,:,1:jpl)   
    22602310            CASE( 'no' )   
    22612311               ztmp3(:,:,:) = 0.0   
    22622312               ztmp4(:,:,:) = 0.0   
    22632313               DO jl=1,jpl   
    2264                  ztmp3(:,:,1) = ztmp3(:,:,1) + a_ip(:,:,jpl)   
    2265                  ztmp4(:,:,1) = ztmp4(:,:,1) + v_ip(:,:,jpl)  
     2314                 ztmp3(:,:,1) = ztmp3(:,:,1) + a_ip_frac(:,:,jpl)   
     2315                 ztmp4(:,:,1) = ztmp4(:,:,1) + h_ip(:,:,jpl)  
    22662316               ENDDO   
    22672317            CASE default   ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_mpnd%clcat' )   
Note: See TracChangeset for help on using the changeset viewer.