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/OCE/SBC/sbcmod.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/OCE/SBC/sbcmod.F90

    r11405 r13463  
    1515   !!            3.6  ! 2014-11  (P. Mathiot, C. Harris) add ice shelves melting 
    1616   !!            4.0  ! 2016-06  (L. Brodeau) new general bulk formulation 
     17   !!            4.0  ! 2019-03  (F. Lemarié & G. Samson)  add ABL compatibility (ln_abl=TRUE) 
    1718   !!---------------------------------------------------------------------- 
    1819 
     
    2425   USE oce            ! ocean dynamics and tracers 
    2526   USE dom_oce        ! ocean space and time domain 
     27   USE closea         ! closed seas 
    2628   USE phycst         ! physical constants 
    2729   USE sbc_oce        ! Surface boundary condition: ocean fields 
     
    3234   USE sbcflx         ! surface boundary condition: flux formulation 
    3335   USE sbcblk         ! surface boundary condition: bulk formulation 
     36   USE sbcabl         ! atmospheric boundary layer 
    3437   USE sbcice_if      ! surface boundary condition: ice-if sea-ice model 
    3538#if defined key_si3 
     
    3740#endif 
    3841   USE sbcice_cice    ! surface boundary condition: CICE sea-ice model 
    39    USE sbcisf         ! surface boundary condition: ice-shelf 
    4042   USE sbccpl         ! surface boundary condition: coupled formulation 
    4143   USE cpl_oasis3     ! OASIS routines for coupling 
     44   USE sbcclo         ! surface boundary condition: closed sea correction 
    4245   USE sbcssr         ! surface boundary condition: sea surface restoring 
    4346   USE sbcrnf         ! surface boundary condition: runoffs 
    4447   USE sbcapr         ! surface boundary condition: atmo pressure  
    45    USE sbcisf         ! surface boundary condition: ice shelf 
    4648   USE sbcfwb         ! surface boundary condition: freshwater budget 
    4749   USE icbstp         ! Icebergs 
     
    5961   USE timing         ! Timing 
    6062   USE wet_dry 
    61    USE diurnal_bulk, ONLY:   ln_diurnal_only   ! diurnal SST diagnostic 
     63   USE diu_bulk, ONLY:   ln_diurnal_only   ! diurnal SST diagnostic 
    6264 
    6365   IMPLICIT NONE 
     
    7678CONTAINS 
    7779 
    78    SUBROUTINE sbc_init 
     80   SUBROUTINE sbc_init( Kbb, Kmm, Kaa ) 
    7981      !!--------------------------------------------------------------------- 
    8082      !!                    ***  ROUTINE sbc_init *** 
     
    8890      !!              - nsbc: type of sbc 
    8991      !!---------------------------------------------------------------------- 
     92      INTEGER, INTENT(in) ::   Kbb, Kmm, Kaa         ! ocean time level indices 
    9093      INTEGER ::   ios, icpt                         ! local integer 
    9194      LOGICAL ::   ll_purecpl, ll_opa, ll_not_nemo   ! local logical 
    9295      !! 
    9396      NAMELIST/namsbc/ nn_fsbc  ,                                                    & 
    94          &             ln_usr   , ln_flx   , ln_blk       ,                          & 
     97         &             ln_usr   , ln_flx   , ln_blk   , ln_abl,                      & 
    9598         &             ln_cpl   , ln_mixcpl, nn_components,                          & 
    9699         &             nn_ice   , ln_ice_embd,                                       & 
    97100         &             ln_traqsr, ln_dm2dc ,                                         & 
    98          &             ln_rnf   , nn_fwb   , ln_ssr   , ln_isf    , ln_apr_dyn ,     & 
    99          &             ln_wave  , ln_cdgw  , ln_sdw   , ln_tauwoc  , ln_stcor   ,     & 
     101         &             ln_rnf   , nn_fwb     , ln_ssr   , ln_apr_dyn,              & 
     102         &             ln_wave  , ln_cdgw  , ln_sdw   , ln_tauwoc  , ln_stcor  ,     & 
    100103         &             ln_tauw  , nn_lsm, nn_sdrift 
    101104      !!---------------------------------------------------------------------- 
     
    108111      ! 
    109112      !                       !**  read Surface Module namelist 
    110       REWIND( numnam_ref )          !* Namelist namsbc in reference namelist : Surface boundary 
    111113      READ  ( numnam_ref, namsbc, IOSTAT = ios, ERR = 901) 
    112 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc in reference namelist', lwp ) 
    113       REWIND( numnam_cfg )          !* Namelist namsbc in configuration namelist : Parameters of the run 
     114901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc in reference namelist' ) 
    114115      READ  ( numnam_cfg, namsbc, IOSTAT = ios, ERR = 902 ) 
    115 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc in configuration namelist', lwp ) 
     116902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc in configuration namelist' ) 
    116117      IF(lwm) WRITE( numond, namsbc ) 
    117118      ! 
     
    119120      ncom_fsbc = nn_fsbc    ! make nn_fsbc available for lib_mpp 
    120121#endif 
    121       !                             !* overwrite namelist parameter using CPP key information 
    122 #if defined key_agrif 
    123       IF( Agrif_Root() ) THEN                ! AGRIF zoom (cf r1242: possibility to run without ice in fine grid) 
    124          IF( lk_si3  )   nn_ice      = 2 
    125          IF( lk_cice )   nn_ice      = 3 
    126       ENDIF 
    127 #else 
    128       IF( lk_si3  )   nn_ice      = 2 
    129       IF( lk_cice )   nn_ice      = 3 
    130 #endif 
     122      ! 
    131123      ! 
    132124      IF(lwp) THEN                  !* Control print 
     
    137129         WRITE(numout,*) '         flux         formulation                   ln_flx        = ', ln_flx 
    138130         WRITE(numout,*) '         bulk         formulation                   ln_blk        = ', ln_blk 
     131         WRITE(numout,*) '         ABL          formulation                   ln_abl        = ', ln_abl 
    139132         WRITE(numout,*) '      Type of coupling (Ocean/Ice/Atmosphere) : ' 
    140133         WRITE(numout,*) '         ocean-atmosphere coupled formulation       ln_cpl        = ', ln_cpl 
     
    153146         WRITE(numout,*) '         Patm gradient added in ocean & ice Eqs.    ln_apr_dyn    = ', ln_apr_dyn 
    154147         WRITE(numout,*) '         runoff / runoff mouths                     ln_rnf        = ', ln_rnf 
    155          WRITE(numout,*) '         iceshelf formulation                       ln_isf        = ', ln_isf 
    156148         WRITE(numout,*) '         nb of iterations if land-sea-mask applied  nn_lsm        = ', nn_lsm 
    157149         WRITE(numout,*) '         surface wave                               ln_wave       = ', ln_wave 
     
    185177      ! 
    186178      IF( .NOT.ln_usr ) THEN     ! the model calendar needs some specificities (except in user defined case) 
    187          IF( MOD( rday , rdt ) /= 0. )   CALL ctl_stop( 'the time step must devide the number of second of in a day' ) 
     179         IF( MOD( rday , rn_Dt ) /= 0. )   CALL ctl_stop( 'the time step must devide the number of second of in a day' ) 
    188180         IF( MOD( rday , 2.  ) /= 0. )   CALL ctl_stop( 'the number of second of in a day must be an even number'    ) 
    189          IF( MOD( rdt  , 2.  ) /= 0. )   CALL ctl_stop( 'the time step (in second) must be an even number'           ) 
     181         IF( MOD( rn_Dt  , 2.  ) /= 0. )   CALL ctl_stop( 'the time step (in second) must be an even number'           ) 
    190182      ENDIF 
    191183      !                       !**  check option consistency 
     
    225217      CASE( 1 )                        !- Ice-cover climatology ("Ice-if" model)   
    226218      CASE( 2 )                        !- SI3  ice model 
     219         IF( .NOT.( ln_blk .OR. ln_cpl .OR. ln_abl .OR. ln_usr ) )   & 
     220            &                   CALL ctl_stop( 'sbc_init : SI3 sea-ice model requires ln_blk or ln_cpl or ln_abl or ln_usr = T' ) 
    227221      CASE( 3 )                        !- CICE ice model 
    228          IF( .NOT.( ln_blk .OR. ln_cpl ) )   CALL ctl_stop( 'sbc_init : CICE sea-ice model requires ln_blk or ln_cpl = T' ) 
    229          IF( lk_agrif                    )   CALL ctl_stop( 'sbc_init : CICE sea-ice model not currently available with AGRIF' )  
     222         IF( .NOT.( ln_blk .OR. ln_cpl .OR. ln_abl .OR. ln_usr ) )   & 
     223            &                   CALL ctl_stop( 'sbc_init : CICE sea-ice model requires ln_blk or ln_cpl or ln_abl or ln_usr = T' ) 
     224         IF( lk_agrif                                )   & 
     225            &                   CALL ctl_stop( 'sbc_init : CICE sea-ice model not currently available with AGRIF' )  
    230226      CASE DEFAULT                     !- not supported 
    231227      END SELECT 
     228      IF( ln_diurnal .AND. .NOT. ln_blk  )   CALL ctl_stop( "sbc_init: diurnal flux processing only implemented for bulk forcing" ) 
    232229      ! 
    233230      !                       !**  allocate and set required variables 
     
    239236#endif 
    240237      ! 
    241       IF( .NOT.ln_isf ) THEN        !* No ice-shelf in the domain : allocate and set to zero 
    242          IF( sbc_isf_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_init : unable to allocate sbc_isf arrays' ) 
    243          fwfisf  (:,:)   = 0._wp   ;   risf_tsc  (:,:,:) = 0._wp 
    244          fwfisf_b(:,:)   = 0._wp   ;   risf_tsc_b(:,:,:) = 0._wp 
    245       END IF 
     238      ! 
     239      IF( sbc_ssr_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_init : unable to allocate sbc_ssr arrays' ) 
     240      IF( .NOT.ln_ssr ) THEN               !* Initialize qrp and erp if no restoring  
     241         qrp(:,:) = 0._wp 
     242         erp(:,:) = 0._wp 
     243      ENDIF 
     244      ! 
     245 
    246246      IF( nn_ice == 0 ) THEN        !* No sea-ice in the domain : ice fraction is always zero 
    247247         IF( nn_components /= jp_iam_opa )   fr_i(:,:) = 0._wp    ! except for OPA in SAS-OPA coupled case 
     
    254254 
    255255      !                          ! Choice of the Surface Boudary Condition (set nsbc) 
     256      nday_qsr = -1   ! allow initialization at the 1st call !LB: now warm-layer of COARE* calls "sbc_dcy_param" of sbcdcy.F90! 
    256257      IF( ln_dm2dc ) THEN           !* daily mean to diurnal cycle 
    257          nday_qsr = -1   ! allow initialization at the 1st call 
    258          IF( .NOT.( ln_flx .OR. ln_blk ) .AND. nn_components /= jp_iam_opa )   & 
    259             &   CALL ctl_stop( 'qsr diurnal cycle from daily values requires a flux or bulk formulation' ) 
     258         !LB:nday_qsr = -1   ! allow initialization at the 1st call 
     259         IF( .NOT.( ln_flx .OR. ln_blk .OR. ln_abl ) .AND. nn_components /= jp_iam_opa )   & 
     260            &   CALL ctl_stop( 'qsr diurnal cycle from daily values requires flux, bulk or abl formulation' ) 
    260261      ENDIF 
    261262      !                             !* Choice of the Surface Boudary Condition 
     
    270271      IF( ln_flx          ) THEN   ;   nsbc = jp_flx     ; icpt = icpt + 1   ;   ENDIF       ! flux                 formulation 
    271272      IF( ln_blk          ) THEN   ;   nsbc = jp_blk     ; icpt = icpt + 1   ;   ENDIF       ! bulk                 formulation 
     273      IF( ln_abl          ) THEN   ;   nsbc = jp_abl     ; icpt = icpt + 1   ;   ENDIF       ! ABL                  formulation 
    272274      IF( ll_purecpl      ) THEN   ;   nsbc = jp_purecpl ; icpt = icpt + 1   ;   ENDIF       ! Pure Coupled         formulation 
    273275      IF( ll_opa          ) THEN   ;   nsbc = jp_none    ; icpt = icpt + 1   ;   ENDIF       ! opa coupling via SAS module 
     
    281283         CASE( jp_flx     )   ;   WRITE(numout,*) '   ==>>>   flux formulation' 
    282284         CASE( jp_blk     )   ;   WRITE(numout,*) '   ==>>>   bulk formulation' 
     285         CASE( jp_abl     )   ;   WRITE(numout,*) '   ==>>>   ABL  formulation' 
    283286         CASE( jp_purecpl )   ;   WRITE(numout,*) '   ==>>>   pure coupled formulation' 
    284287!!gm abusive use of jp_none ??   ===>>> need to be check and changed by adding a jp_sas parameter 
     
    296299      !     SAS time-step has to be declared in OASIS (mandatory) -> nn_fsbc has to be modified accordingly 
    297300      IF( nn_components /= jp_iam_nemo ) THEN 
    298          IF( nn_components == jp_iam_opa )   nn_fsbc = cpl_freq('O_SFLX') / NINT(rdt) 
    299          IF( nn_components == jp_iam_sas )   nn_fsbc = cpl_freq('I_SFLX') / NINT(rdt) 
     301         IF( nn_components == jp_iam_opa )   nn_fsbc = cpl_freq('O_SFLX') / NINT(rn_Dt) 
     302         IF( nn_components == jp_iam_sas )   nn_fsbc = cpl_freq('I_SFLX') / NINT(rn_Dt) 
    300303         ! 
    301304         IF(lwp)THEN 
     
    307310      ! 
    308311      !                             !* check consistency between model timeline and nn_fsbc 
    309       IF( MOD( nitend - nit000 + 1, nn_fsbc) /= 0 .OR.   & 
    310           MOD( nstock             , nn_fsbc) /= 0 ) THEN 
    311          WRITE(ctmp1,*) 'sbc_init : experiment length (', nitend - nit000 + 1, ') or nstock (', nstock,   & 
    312             &           ' is NOT a multiple of nn_fsbc (', nn_fsbc, ')' 
    313          CALL ctl_stop( ctmp1, 'Impossible to properly do model restart' ) 
    314       ENDIF 
    315       ! 
    316       IF( MOD( rday, REAL(nn_fsbc, wp) * rdt ) /= 0 )   & 
     312      IF( ln_rst_list .OR. nn_stock /= -1 ) THEN   ! we will do restart files 
     313         IF( MOD( nitend - nit000 + 1, nn_fsbc) /= 0 ) THEN 
     314            WRITE(ctmp1,*) 'sbc_init : experiment length (', nitend - nit000 + 1, ') is NOT a multiple of nn_fsbc (', nn_fsbc, ')' 
     315            CALL ctl_stop( ctmp1, 'Impossible to properly do model restart' ) 
     316         ENDIF 
     317         IF( .NOT. ln_rst_list .AND. MOD( nn_stock, nn_fsbc) /= 0 ) THEN   ! we don't use nn_stock if ln_rst_list 
     318            WRITE(ctmp1,*) 'sbc_init : nn_stock (', nn_stock, ') is NOT a multiple of nn_fsbc (', nn_fsbc, ')' 
     319            CALL ctl_stop( ctmp1, 'Impossible to properly do model restart' ) 
     320         ENDIF 
     321      ENDIF 
     322      ! 
     323      IF( MOD( rday, REAL(nn_fsbc, wp) * rn_Dt ) /= 0 )   & 
    317324         &  CALL ctl_warn( 'sbc_init : nn_fsbc is NOT a multiple of the number of time steps in a day' ) 
    318325      ! 
    319       IF( ln_dm2dc .AND. NINT(rday) / ( nn_fsbc * NINT(rdt) ) < 8  )   & 
     326      IF( ln_dm2dc .AND. NINT(rday) / ( nn_fsbc * NINT(rn_Dt) ) < 8  )   & 
    320327         &   CALL ctl_warn( 'sbc_init : diurnal cycle for qsr: the sampling of the diurnal cycle is too small...' ) 
    321328      ! 
     
    323330      !                       !**  associated modules : initialization 
    324331      ! 
    325                           CALL sbc_ssm_init            ! Sea-surface mean fields initialization 
     332                          CALL sbc_ssm_init ( Kbb, Kmm ) ! Sea-surface mean fields initialization 
     333      ! 
     334      IF( l_sbc_clo   )   CALL sbc_clo_init              ! closed sea surface initialisation 
    326335      ! 
    327336      IF( ln_blk      )   CALL sbc_blk_init            ! bulk formulae initialization 
    328337 
     338      IF( ln_abl      )   CALL sbc_abl_init            ! Atmospheric Boundary Layer (ABL) 
     339 
    329340      IF( ln_ssr      )   CALL sbc_ssr_init            ! Sea-Surface Restoring initialization 
    330341      ! 
    331       IF( ln_isf      )   CALL sbc_isf_init            ! Compute iceshelves 
    332       ! 
    333                           CALL sbc_rnf_init            ! Runof initialization 
    334       ! 
    335       IF( ln_apr_dyn )    CALL sbc_apr_init            ! Atmo Pressure Forcing initialization 
     342      ! 
     343                          CALL sbc_rnf_init( Kmm )       ! Runof initialization 
     344      ! 
     345      IF( ln_apr_dyn )    CALL sbc_apr_init              ! Atmo Pressure Forcing initialization 
    336346      ! 
    337347#if defined key_si3 
     
    339349                          IF( sbc_ice_alloc() /= 0 )   CALL ctl_stop('STOP', 'sbc_ice_alloc : unable to allocate arrays' ) 
    340350      ELSEIF( nn_ice == 2 ) THEN 
    341                           CALL ice_init                ! ICE initialization 
     351                          CALL ice_init( Kbb, Kmm, Kaa )         ! ICE initialization 
    342352      ENDIF 
    343353#endif 
    344       IF( nn_ice == 3 )   CALL cice_sbc_init( nsbc )   ! CICE initialization 
    345       ! 
    346       IF( ln_wave     )   CALL sbc_wave_init           ! surface wave initialisation 
     354      IF( nn_ice == 3 )   CALL cice_sbc_init( nsbc, Kbb, Kmm )   ! CICE initialization 
     355      ! 
     356      IF( ln_wave     )   CALL sbc_wave_init                     ! surface wave initialisation 
    347357      ! 
    348358      IF( lwxios ) THEN 
     
    359369 
    360370 
    361    SUBROUTINE sbc( kt ) 
     371   SUBROUTINE sbc( kt, Kbb, Kmm ) 
    362372      !!--------------------------------------------------------------------- 
    363373      !!                    ***  ROUTINE sbc  *** 
     
    376386      !!---------------------------------------------------------------------- 
    377387      INTEGER, INTENT(in) ::   kt   ! ocean time step 
     388      INTEGER, INTENT(in) ::   Kbb, Kmm   ! ocean time level indices 
    378389      ! 
    379390      LOGICAL ::   ll_sas, ll_opa   ! local logical 
     
    394405         emp_b (:,:) = emp (:,:) 
    395406         sfx_b (:,:) = sfx (:,:) 
    396          IF ( ln_rnf ) THEN 
     407         IF( ln_rnf ) THEN 
    397408            rnf_b    (:,:  ) = rnf    (:,:  ) 
    398409            rnf_tsc_b(:,:,:) = rnf_tsc(:,:,:) 
    399410         ENDIF 
    400          IF( ln_isf )  THEN 
    401             fwfisf_b  (:,:  ) = fwfisf  (:,:  )                
    402             risf_tsc_b(:,:,:) = risf_tsc(:,:,:)               
    403          ENDIF 
    404411        ! 
    405412      ENDIF 
     
    411418      ll_opa = nn_components == jp_iam_opa 
    412419      ! 
    413       IF( .NOT.ll_sas )   CALL sbc_ssm ( kt )            ! mean ocean sea surface variables (sst_m, sss_m, ssu_m, ssv_m) 
    414       IF( ln_wave     )   CALL sbc_wave( kt )            ! surface waves 
     420      IF( .NOT.ll_sas )   CALL sbc_ssm ( kt, Kbb, Kmm )  ! mean ocean sea surface variables (sst_m, sss_m, ssu_m, ssv_m) 
     421      IF( ln_wave     )   CALL sbc_wave( kt, Kmm )       ! surface waves 
    415422 
    416423      ! 
     
    419426      SELECT CASE( nsbc )                                ! Compute ocean surface boundary condition 
    420427      !                                                  ! (i.e. utau,vtau, qns, qsr, emp, sfx) 
    421       CASE( jp_usr   )     ;   CALL usrdef_sbc_oce( kt )                    ! user defined formulation  
    422       CASE( jp_flx     )   ;   CALL sbc_flx       ( kt )                    ! flux formulation 
     428      CASE( jp_usr   )     ;   CALL usrdef_sbc_oce( kt, Kbb )                        ! user defined formulation  
     429      CASE( jp_flx     )   ;   CALL sbc_flx       ( kt )                             ! flux formulation 
    423430      CASE( jp_blk     ) 
    424          IF( ll_sas    )       CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice )   ! OPA-SAS coupling: SAS receiving fields from OPA 
     431         IF( ll_sas    )       CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice, Kbb, Kmm )   ! OPA-SAS coupling: SAS receiving fields from OPA 
    425432                               CALL sbc_blk       ( kt )                    ! bulk formulation for the ocean 
    426433                               ! 
    427       CASE( jp_purecpl )   ;   CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice )   ! pure coupled formulation 
     434      CASE( jp_abl     ) 
     435         IF( ll_sas    )       CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice, Kbb, Kmm )   ! OPA-SAS coupling: SAS receiving fields from OPA 
     436                               CALL sbc_abl       ( kt )                    ! ABL  formulation for the ocean 
     437                               ! 
     438      CASE( jp_purecpl )   ;   CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice, Kbb, Kmm )   ! pure coupled formulation 
    428439      CASE( jp_none    ) 
    429          IF( ll_opa    )       CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice )   ! OPA-SAS coupling: OPA receiving fields from SAS 
     440         IF( ll_opa    )       CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice, Kbb, Kmm )  ! OPA-SAS coupling: OPA receiving fields from SAS 
    430441      END SELECT 
    431442      ! 
    432       IF( ln_mixcpl )          CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice )   ! forced-coupled mixed formulation after forcing 
    433       ! 
    434       IF ( ln_wave .AND. (ln_tauwoc .OR. ln_tauw) ) CALL sbc_wstress( )      ! Wind stress provided by waves  
     443      IF( ln_mixcpl )          CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice, Kbb, Kmm )  ! forced-coupled mixed formulation after forcing 
     444      ! 
     445      IF ( ln_wave .AND. (ln_tauwoc .OR. ln_tauw) ) CALL sbc_wstress( )              ! Wind stress provided by waves  
    435446      ! 
    436447      !                                            !==  Misc. Options  ==! 
    437448      ! 
    438449      SELECT CASE( nn_ice )                                       ! Update heat and freshwater fluxes over sea-ice areas 
    439       CASE(  1 )   ;         CALL sbc_ice_if   ( kt )             ! Ice-cover climatology ("Ice-if" model) 
     450      CASE(  1 )   ;         CALL sbc_ice_if   ( kt, Kbb, Kmm )   ! Ice-cover climatology ("Ice-if" model) 
    440451#if defined key_si3 
    441       CASE(  2 )   ;         CALL ice_stp  ( kt, nsbc )          ! SI3 ice model 
     452      CASE(  2 )   ;         CALL ice_stp  ( kt, Kbb, Kmm, nsbc ) ! SI3 ice model 
    442453#endif 
    443454      CASE(  3 )   ;         CALL sbc_ice_cice ( kt, nsbc )       ! CICE ice model 
     
    446457      IF( ln_icebergs    )   THEN 
    447458                                     CALL icb_stp( kt )           ! compute icebergs 
    448          ! icebergs may advect into haloes during the icb step and alter emp. 
    449          ! A lbc_lnk is necessary here to ensure restartability (#2113) 
    450          IF( .NOT. ln_passive_mode ) CALL lbc_lnk( 'sbcmod', emp, 'T', 1. ) ! ensure restartability with icebergs 
    451       ENDIF 
    452  
    453       IF( ln_isf         )   CALL sbc_isf( kt )                   ! compute iceshelves 
     459         ! Icebergs do not melt over the haloes.  
     460         ! So emp values over the haloes are no more consistent with the inner domain values.  
     461         ! A lbc_lnk is therefore needed to ensure reproducibility and restartability. 
     462         ! see ticket #2113 for discussion about this lbc_lnk. 
     463         IF( .NOT. ln_passive_mode ) CALL lbc_lnk( 'sbcmod', emp, 'T', 1.0_wp ) ! ensure restartability with icebergs 
     464      ENDIF 
    454465 
    455466      IF( ln_rnf         )   CALL sbc_rnf( kt )                   ! add runoffs to fresh water fluxes 
    456467 
    457       IF( ln_ssr         )   CALL sbc_ssr( kt )                   ! add SST/SSS damping term 
    458  
    459       IF( nn_fwb    /= 0 )   CALL sbc_fwb( kt, nn_fwb, nn_fsbc )  ! control the freshwater budget 
     468      IF( ln_ssr         )   CALL sbc_ssr( kt )                        ! add SST/SSS damping term 
     469 
     470      IF( nn_fwb    /= 0 )   CALL sbc_fwb( kt, nn_fwb, nn_fsbc, Kmm )  ! control the freshwater budget 
    460471 
    461472      ! Special treatment of freshwater fluxes over closed seas in the model domain 
    462473      ! Should not be run if ln_diurnal_only 
    463       IF( l_sbc_clo .AND. (.NOT. ln_diurnal_only) )   CALL sbc_clo( kt )    
     474      IF( l_sbc_clo     )   CALL sbc_clo( kt )    
    464475 
    465476!!$!RBbug do not understand why see ticket 667 
    466477!!$!clem: it looks like it is necessary for the north fold (in certain circumstances). Don't know why. 
    467 !!$      CALL lbc_lnk( 'sbcmod', emp, 'T', 1. ) 
    468       IF ( ll_wd ) THEN     ! If near WAD point limit the flux for now 
     478!!$      CALL lbc_lnk( 'sbcmod', emp, 'T', 1.0_wp ) 
     479      IF( ll_wd ) THEN     ! If near WAD point limit the flux for now 
    469480         zthscl = atanh(rn_wd_sbcfra)                     ! taper frac default is .999  
    470          zwdht(:,:) = sshn(:,:) + ht_0(:,:) - rn_wdmin1   ! do this calc of water 
     481         zwdht(:,:) = ssh(:,:,Kmm) + ht_0(:,:) - rn_wdmin1   ! do this calc of water 
    471482                                                     ! depth above wd limit once 
    472483         WHERE( zwdht(:,:) <= 0.0 ) 
     
    497508            IF(lwp) WRITE(numout,*) '          nit000-1 surface forcing fields red in the restart file' 
    498509            IF(lrxios) CALL iom_swap( TRIM(crxios_context) ) 
    499             CALL iom_get( numror, jpdom_autoglo, 'utau_b', utau_b, ldxios = lrxios )   ! before i-stress  (U-point) 
    500             CALL iom_get( numror, jpdom_autoglo, 'vtau_b', vtau_b, ldxios = lrxios )   ! before j-stress  (V-point) 
    501             CALL iom_get( numror, jpdom_autoglo, 'qns_b' , qns_b, ldxios = lrxios )   ! before non solar heat flux (T-point) 
     510            CALL iom_get( numror, jpdom_auto, 'utau_b', utau_b, ldxios = lrxios, cd_type = 'U', psgn = -1._wp )   ! before i-stress  (U-point) 
     511            CALL iom_get( numror, jpdom_auto, 'vtau_b', vtau_b, ldxios = lrxios, cd_type = 'V', psgn = -1._wp )   ! before j-stress  (V-point) 
     512            CALL iom_get( numror, jpdom_auto,  'qns_b',  qns_b, ldxios = lrxios )   ! before non solar heat flux (T-point) 
    502513            ! The 3D heat content due to qsr forcing is treated in traqsr 
    503             ! CALL iom_get( numror, jpdom_autoglo, 'qsr_b' , qsr_b, ldxios = lrxios  ) ! before     solar heat flux (T-point) 
    504             CALL iom_get( numror, jpdom_autoglo, 'emp_b', emp_b, ldxios = lrxios  )    ! before     freshwater flux (T-point) 
     514            ! CALL iom_get( numror, jpdom_auto, 'qsr_b' , qsr_b, ldxios = lrxios  ) ! before     solar heat flux (T-point) 
     515            CALL iom_get( numror, jpdom_auto, 'emp_b', emp_b, ldxios = lrxios  )    ! before     freshwater flux (T-point) 
    505516            ! To ensure restart capability with 3.3x/3.4 restart files    !! to be removed in v3.6 
    506517            IF( iom_varid( numror, 'sfx_b', ldstop = .FALSE. ) > 0 ) THEN 
    507                CALL iom_get( numror, jpdom_autoglo, 'sfx_b', sfx_b, ldxios = lrxios )  ! before salt flux (T-point) 
     518               CALL iom_get( numror, jpdom_auto, 'sfx_b', sfx_b, ldxios = lrxios )  ! before salt flux (T-point) 
    508519            ELSE 
    509520               sfx_b (:,:) = sfx(:,:) 
     
    550561         CALL iom_put( "taum"  , taum       )                   ! wind stress module 
    551562         CALL iom_put( "wspd"  , wndm       )                   ! wind speed  module over free ocean or leads in presence of sea-ice 
     563         CALL iom_put( "qrp", qrp )                             ! heat flux damping 
     564         CALL iom_put( "erp", erp )                             ! freshwater flux damping 
    552565      ENDIF 
    553566      ! 
     
    555568      CALL iom_put( "vtau", vtau )   ! j-wind stress 
    556569      ! 
    557       IF(ln_ctl) THEN         ! print mean trends (used for debugging) 
    558          CALL prt_ctl(tab2d_1=fr_i              , clinfo1=' fr_i    - : ', mask1=tmask ) 
    559          CALL prt_ctl(tab2d_1=(emp-rnf + fwfisf), clinfo1=' emp-rnf - : ', mask1=tmask ) 
    560          CALL prt_ctl(tab2d_1=(sfx-rnf + fwfisf), clinfo1=' sfx-rnf - : ', mask1=tmask ) 
     570      IF(sn_cfctl%l_prtctl) THEN     ! print mean trends (used for debugging) 
     571         CALL prt_ctl(tab2d_1=fr_i             , clinfo1=' fr_i     - : ', mask1=tmask ) 
     572         CALL prt_ctl(tab2d_1=(emp-rnf)        , clinfo1=' emp-rnf - : ', mask1=tmask ) 
     573         CALL prt_ctl(tab2d_1=(sfx-rnf)        , clinfo1=' sfx-rnf - : ', mask1=tmask ) 
    561574         CALL prt_ctl(tab2d_1=qns              , clinfo1=' qns      - : ', mask1=tmask ) 
    562575         CALL prt_ctl(tab2d_1=qsr              , clinfo1=' qsr      - : ', mask1=tmask ) 
    563576         CALL prt_ctl(tab3d_1=tmask            , clinfo1=' tmask    - : ', mask1=tmask, kdim=jpk ) 
    564          CALL prt_ctl(tab3d_1=tsn(:,:,:,jp_tem), clinfo1=' sst      - : ', mask1=tmask, kdim=1   ) 
    565          CALL prt_ctl(tab3d_1=tsn(:,:,:,jp_sal), clinfo1=' sss      - : ', mask1=tmask, kdim=1   ) 
    566          CALL prt_ctl(tab2d_1=utau             , clinfo1=' utau     - : ', mask1=umask,                      & 
    567             &         tab2d_2=vtau             , clinfo2=' vtau     - : ', mask2=vmask ) 
     577         CALL prt_ctl(tab3d_1=ts(:,:,:,jp_tem,Kmm), clinfo1=' sst      - : ', mask1=tmask, kdim=1   ) 
     578         CALL prt_ctl(tab3d_1=ts(:,:,:,jp_sal,Kmm), clinfo1=' sss      - : ', mask1=tmask, kdim=1   ) 
     579         CALL prt_ctl(tab2d_1=utau                , clinfo1=' utau     - : ', mask1=umask,                      & 
     580            &         tab2d_2=vtau                , clinfo2=' vtau     - : ', mask2=vmask ) 
    568581      ENDIF 
    569582 
Note: See TracChangeset for help on using the changeset viewer.