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 7351 for branches/2016/dev_INGV_UKMO_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90 – NEMO

Ignore:
Timestamp:
2016-11-28T17:04:10+01:00 (7 years ago)
Author:
emanuelaclementi
Message:

ticket #1805 step 3: /2016/dev_INGV_UKMO_2016 aligned to the trunk at revision 7161

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2016/dev_INGV_UKMO_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90

    r7350 r7351  
    1717 
    1818   !!---------------------------------------------------------------------- 
    19    !!   sbc_init       : read namsbc namelist 
    20    !!   sbc            : surface ocean momentum, heat and freshwater boundary conditions 
     19   !!   sbc_init      : read namsbc namelist 
     20   !!   sbc           : surface ocean momentum, heat and freshwater boundary conditions 
    2121   !!---------------------------------------------------------------------- 
    22    USE oce              ! ocean dynamics and tracers 
    23    USE dom_oce          ! ocean space and time domain 
    24    USE phycst           ! physical constants 
    25    USE sbc_oce          ! Surface boundary condition: ocean fields 
    26    USE trc_oce          ! shared ocean-passive tracers variables 
    27    USE sbc_ice          ! Surface boundary condition: ice fields 
    28    USE sbcdcy           ! surface boundary condition: diurnal cycle 
    29    USE sbcssm           ! surface boundary condition: sea-surface mean variables 
    30    USE sbcana           ! surface boundary condition: analytical formulation 
    31    USE sbcflx           ! surface boundary condition: flux formulation 
    32    USE sbcblk_clio      ! surface boundary condition: bulk formulation : CLIO 
    33    USE sbcblk_core      ! surface boundary condition: bulk formulation : CORE 
    34    USE sbcblk_mfs       ! surface boundary condition: bulk formulation : MFS 
    35    USE sbcice_if        ! surface boundary condition: ice-if sea-ice model 
    36    USE sbcice_lim       ! surface boundary condition: LIM 3.0 sea-ice model 
    37    USE sbcice_lim_2     ! surface boundary condition: LIM 2.0 sea-ice model 
    38    USE sbcice_cice      ! surface boundary condition: CICE    sea-ice model 
    39    USE sbccpl           ! surface boundary condition: coupled florulation 
    40    USE cpl_oasis3       ! OASIS routines for coupling 
    41    USE sbcssr           ! surface boundary condition: sea surface restoring 
    42    USE sbcrnf           ! surface boundary condition: runoffs 
    43    USE sbcisf           ! surface boundary condition: ice shelf 
    44    USE sbcfwb           ! surface boundary condition: freshwater budget 
    45    USE closea           ! closed sea 
    46    USE icbstp           ! Icebergs! 
    47  
    48    USE prtctl           ! Print control                    (prt_ctl routine) 
    49    USE iom              ! IOM library 
    50    USE in_out_manager   ! I/O manager 
    51    USE lib_mpp          ! MPP library 
    52    USE timing           ! Timing 
    53    USE sbcwave          ! Wave module 
    54    USE bdy_par          ! Require lk_bdy 
     22   USE oce            ! ocean dynamics and tracers 
     23   USE dom_oce        ! ocean space and time domain 
     24   USE phycst         ! physical constants 
     25   USE sbc_oce        ! Surface boundary condition: ocean fields 
     26   USE trc_oce        ! shared ocean-passive tracers variables 
     27   USE sbc_ice        ! Surface boundary condition: ice fields 
     28   USE sbcdcy         ! surface boundary condition: diurnal cycle 
     29   USE sbcssm         ! surface boundary condition: sea-surface mean variables 
     30   USE sbcana         ! surface boundary condition: analytical formulation 
     31   USE sbcflx         ! surface boundary condition: flux formulation 
     32   USE sbcblk_clio    ! surface boundary condition: bulk formulation : CLIO 
     33   USE sbcblk_core    ! surface boundary condition: bulk formulation : CORE 
     34   USE sbcblk_mfs     ! surface boundary condition: bulk formulation : MFS 
     35   USE sbcice_if      ! surface boundary condition: ice-if sea-ice model 
     36   USE sbcice_lim     ! surface boundary condition: LIM 3.0 sea-ice model 
     37   USE sbcice_lim_2   ! surface boundary condition: LIM 2.0 sea-ice model 
     38   USE sbcice_cice    ! surface boundary condition: CICE    sea-ice model 
     39   USE sbccpl         ! surface boundary condition: coupled florulation 
     40   USE cpl_oasis3     ! OASIS routines for coupling 
     41   USE sbcssr         ! surface boundary condition: sea surface restoring 
     42   USE sbcrnf         ! surface boundary condition: runoffs 
     43   USE sbcisf         ! surface boundary condition: ice shelf 
     44   USE sbcfwb         ! surface boundary condition: freshwater budget 
     45   USE closea         ! closed sea 
     46   USE icbstp         ! Icebergs 
     47   USE traqsr         ! active tracers: light penetration 
     48   USE sbcwave        ! Wave module 
     49   USE bdy_par        ! Require lk_bdy 
     50   ! 
     51   USE prtctl         ! Print control                    (prt_ctl routine) 
     52   USE iom            ! IOM library 
     53   USE in_out_manager ! I/O manager 
     54   USE lib_mpp        ! MPP library 
     55   USE timing         ! Timing 
     56 
     57   USE diurnal_bulk, ONLY: & 
     58      & ln_diurnal_only  
    5559 
    5660   IMPLICIT NONE 
     
    6266   INTEGER ::   nsbc   ! type of surface boundary condition (deduced from namsbc informations) 
    6367       
    64    !! * Substitutions 
    65 #  include "domzgr_substitute.h90" 
    6668   !!---------------------------------------------------------------------- 
    6769   !! NEMO/OPA 4.0 , NEMO-consortium (2011)  
     
    8587      INTEGER ::   icpt   ! local integer 
    8688      !! 
    87       NAMELIST/namsbc/ nn_fsbc   , ln_ana    , ln_flx, ln_blk_clio, ln_blk_core, ln_mixcpl,   & 
    88          &             ln_blk_mfs, ln_apr_dyn, nn_ice, nn_ice_embd, ln_dm2dc   , ln_rnf   ,   & 
    89          &             ln_ssr    , nn_isf    , nn_fwb, ln_cdgw    , ln_wave    , ln_sdw   ,   & 
    90          &             ln_tauoc  , ln_stcor  , nn_lsm, nn_limflx  , nn_components, ln_cpl  
     89      NAMELIST/namsbc/ nn_fsbc  , ln_ana   , ln_flx, ln_blk_clio, ln_blk_core, ln_blk_mfs,   & 
     90         &             ln_cpl   , ln_mixcpl, nn_components      , nn_limflx  ,               & 
     91         &             ln_traqsr, ln_dm2dc ,                                                 & 
     92         &             nn_ice   , nn_ice_embd,                                               & 
     93         &             ln_rnf   , ln_ssr   , ln_isf   , nn_fwb    , ln_apr_dyn,              & 
     94         &             ln_wave  , ln_cdgw  , ln_sdw   , ln_tauoc  , ln_stcor  ,              & 
     95         &             nn_lsm 
    9196      INTEGER  ::   ios 
    9297      INTEGER  ::   ierr, ierr0, ierr1, ierr2, ierr3, jpm 
    9398      LOGICAL  ::   ll_purecpl 
    9499      !!---------------------------------------------------------------------- 
    95  
     100      ! 
    96101      IF(lwp) THEN 
    97102         WRITE(numout,*) 
     
    99104         WRITE(numout,*) '~~~~~~~~ ' 
    100105      ENDIF 
    101  
     106      ! 
    102107      REWIND( numnam_ref )              ! Namelist namsbc in reference namelist : Surface boundary 
    103108      READ  ( numnam_ref, namsbc, IOSTAT = ios, ERR = 901) 
    104 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc in reference namelist', lwp ) 
    105  
     109901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc in reference namelist', lwp ) 
     110      ! 
    106111      REWIND( numnam_cfg )              ! Namelist namsbc in configuration namelist : Parameters of the run 
    107112      READ  ( numnam_cfg, namsbc, IOSTAT = ios, ERR = 902 ) 
    108 902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc in configuration namelist', lwp ) 
    109       IF(lwm) WRITE ( numond, namsbc ) 
    110  
     113902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc in configuration namelist', lwp ) 
     114      IF(lwm) WRITE( numond, namsbc ) 
     115      ! 
    111116      !                          ! overwrite namelist parameter using CPP key information 
    112117      IF( Agrif_Root() ) THEN                ! AGRIF zoom 
     
    119124          nn_ice      =   0 
    120125      ENDIF 
    121  
     126      ! 
    122127      IF(lwp) THEN               ! Control print 
    123128         WRITE(numout,*) '        Namelist namsbc (partly overwritten with CPP key setting)' 
    124129         WRITE(numout,*) '           frequency update of sbc (and ice)             nn_fsbc     = ', nn_fsbc 
    125          WRITE(numout,*) '           Type of sbc : ' 
    126          WRITE(numout,*) '              analytical formulation                     ln_ana      = ', ln_ana 
    127          WRITE(numout,*) '              flux       formulation                     ln_flx      = ', ln_flx 
    128          WRITE(numout,*) '              CLIO bulk  formulation                     ln_blk_clio = ', ln_blk_clio 
    129          WRITE(numout,*) '              CORE bulk  formulation                     ln_blk_core = ', ln_blk_core 
    130          WRITE(numout,*) '              MFS  bulk  formulation                     ln_blk_mfs  = ', ln_blk_mfs 
    131          WRITE(numout,*) '              ocean-atmosphere coupled formulation       ln_cpl      = ', ln_cpl 
    132          WRITE(numout,*) '              forced-coupled mixed formulation           ln_mixcpl   = ', ln_mixcpl 
    133          WRITE(numout,*) '              wave physics                               ln_wave     = ', ln_wave 
    134          WRITE(numout,*) '                 Stokes drift corr. to vert. velocity    ln_sdw      = ', ln_sdw 
    135          WRITE(numout,*) '                 wave modified ocean stress              ln_tauoc    = ', ln_tauoc 
    136          WRITE(numout,*) '                 Stokes coriolis term                    ln_stcor    = ', ln_stcor 
    137          WRITE(numout,*) '                 neutral drag coefficient (CORE, MFS)    ln_cdgw     = ', ln_cdgw 
    138          WRITE(numout,*) '              OASIS coupling (with atm or sas)           lk_oasis    = ', lk_oasis 
    139          WRITE(numout,*) '              components of your executable            nn_components = ', nn_components 
    140          WRITE(numout,*) '              Multicategory heat flux formulation (LIM3) nn_limflx   = ', nn_limflx 
     130         WRITE(numout,*) '           Type of air-sea fluxes : ' 
     131         WRITE(numout,*) '              analytical formulation                     ln_ana        = ', ln_ana 
     132         WRITE(numout,*) '              flux       formulation                     ln_flx        = ', ln_flx 
     133         WRITE(numout,*) '              CLIO bulk  formulation                     ln_blk_clio   = ', ln_blk_clio 
     134         WRITE(numout,*) '              CORE bulk  formulation                     ln_blk_core   = ', ln_blk_core 
     135         WRITE(numout,*) '              MFS  bulk  formulation                     ln_blk_mfs    = ', ln_blk_mfs 
     136         WRITE(numout,*) '           Type of coupling (Ocean/Ice/Atmosphere) : ' 
     137         WRITE(numout,*) '              ocean-atmosphere coupled formulation       ln_cpl        = ', ln_cpl 
     138         WRITE(numout,*) '              forced-coupled mixed formulation           ln_mixcpl     = ', ln_mixcpl 
     139         WRITE(numout,*) '              OASIS coupling (with atm or sas)           lk_oasis      = ', lk_oasis 
     140         WRITE(numout,*) '              components of your executable              nn_components = ', nn_components 
     141         WRITE(numout,*) '              Multicategory heat flux formulation (LIM3) nn_limflx     = ', nn_limflx 
     142         WRITE(numout,*) '           Sea-ice : ' 
     143         WRITE(numout,*) '              ice management in the sbc (=0/1/2/3)       nn_ice        = ', nn_ice  
     144         WRITE(numout,*) '              ice-ocean embedded/levitating (=0/1/2)     nn_ice_embd   = ', nn_ice_embd 
    141145         WRITE(numout,*) '           Misc. options of sbc : ' 
    142          WRITE(numout,*) '              Patm gradient added in ocean & ice Eqs.    ln_apr_dyn  = ', ln_apr_dyn 
    143          WRITE(numout,*) '              ice management in the sbc (=0/1/2/3)       nn_ice      = ', nn_ice  
    144          WRITE(numout,*) '              ice-ocean embedded/levitating (=0/1/2)     nn_ice_embd = ', nn_ice_embd 
    145          WRITE(numout,*) '              daily mean to diurnal cycle qsr            ln_dm2dc    = ', ln_dm2dc  
    146          WRITE(numout,*) '              runoff / runoff mouths                     ln_rnf      = ', ln_rnf 
    147          WRITE(numout,*) '              iceshelf formulation                       nn_isf      = ', nn_isf 
    148          WRITE(numout,*) '              Sea Surface Restoring on SST and/or SSS    ln_ssr      = ', ln_ssr 
    149          WRITE(numout,*) '              FreshWater Budget control  (=0/1/2)        nn_fwb      = ', nn_fwb 
    150          WRITE(numout,*) '              closed sea (=0/1) (set in namdom)          nn_closea   = ', nn_closea 
    151          WRITE(numout,*) '              n. of iterations if land-sea-mask applied  nn_lsm      = ', nn_lsm 
    152       ENDIF 
    153  
    154       ! LIM3 Multi-category heat flux formulation 
    155       SELECT CASE ( nn_limflx) 
    156       CASE ( -1 ) 
    157          IF(lwp) WRITE(numout,*) '              Use of per-category fluxes (nn_limflx = -1) ' 
    158       CASE ( 0  ) 
    159          IF(lwp) WRITE(numout,*) '              Average per-category fluxes (nn_limflx = 0) '  
    160       CASE ( 1  ) 
    161          IF(lwp) WRITE(numout,*) '              Average then redistribute per-category fluxes (nn_limflx = 1) ' 
    162       CASE ( 2  ) 
    163          IF(lwp) WRITE(numout,*) '              Redistribute a single flux over categories (nn_limflx = 2) ' 
    164       END SELECT 
    165       ! 
    166       IF ( nn_components /= jp_iam_nemo .AND. .NOT. lk_oasis )   & 
    167          &      CALL ctl_stop( 'STOP', 'sbc_init : OPA-SAS coupled via OASIS, but key_oasis3 disabled' ) 
    168       IF ( nn_components == jp_iam_opa .AND. ln_cpl )   & 
    169          &      CALL ctl_stop( 'STOP', 'sbc_init : OPA-SAS coupled via OASIS, but ln_cpl = T in OPA' ) 
    170       IF ( nn_components == jp_iam_opa .AND. ln_mixcpl )   & 
    171          &      CALL ctl_stop( 'STOP', 'sbc_init : OPA-SAS coupled via OASIS, but ln_mixcpl = T in OPA' ) 
    172       IF ( ln_cpl .AND. .NOT. lk_oasis )    & 
    173          &      CALL ctl_stop( 'STOP', 'sbc_init : OASIS-coupled atmosphere model, but key_oasis3 disabled' ) 
     146         WRITE(numout,*) '              Light penetration in temperature Eq.       ln_traqsr     = ', ln_traqsr 
     147         WRITE(numout,*) '                 daily mean to diurnal cycle qsr            ln_dm2dc   = ', ln_dm2dc  
     148         WRITE(numout,*) '              Sea Surface Restoring on SST and/or SSS    ln_ssr        = ', ln_ssr 
     149         WRITE(numout,*) '              FreshWater Budget control  (=0/1/2)        nn_fwb        = ', nn_fwb 
     150         WRITE(numout,*) '              Patm gradient added in ocean & ice Eqs.    ln_apr_dyn    = ', ln_apr_dyn 
     151         WRITE(numout,*) '              runoff / runoff mouths                     ln_rnf        = ', ln_rnf 
     152         WRITE(numout,*) '              iceshelf formulation                       ln_isf        = ', ln_isf 
     153         WRITE(numout,*) '              closed sea (=0/1) (set in namdom)          nn_closea     = ', nn_closea 
     154         WRITE(numout,*) '              nb of iterations if land-sea-mask applied  nn_lsm        = ', nn_lsm 
     155         WRITE(numout,*) '              surface wave                               ln_wave       = ', ln_wave 
     156         WRITE(numout,*) '                 Stokes drift corr. to vert. velocity    ln_sdw        = ', ln_sdw 
     157         WRITE(numout,*) '                 wave modified ocean stress              ln_tauoc      = ', ln_tauoc 
     158         WRITE(numout,*) '                 Stokes coriolis term                    ln_stcor      = ', ln_stcor 
     159         WRITE(numout,*) '                 neutral drag coefficient (CORE, MFS)    ln_cdgw       = ', ln_cdgw 
     160      ENDIF 
     161      ! 
     162      IF(lwp) THEN 
     163         WRITE(numout,*) 
     164         SELECT CASE ( nn_limflx )        ! LIM3 Multi-category heat flux formulation 
     165         CASE ( -1 )   ;   WRITE(numout,*) '   LIM3: use per-category fluxes (nn_limflx = -1) ' 
     166         CASE ( 0  )   ;   WRITE(numout,*) '   LIM3: use average per-category fluxes (nn_limflx = 0) '  
     167         CASE ( 1  )   ;   WRITE(numout,*) '   LIM3: use average then redistribute per-category fluxes (nn_limflx = 1) ' 
     168         CASE ( 2  )   ;   WRITE(numout,*) '   LIM3: Redistribute a single flux over categories (nn_limflx = 2) ' 
     169         END SELECT 
     170      ENDIF 
     171      ! 
     172      IF( nn_components /= jp_iam_nemo .AND. .NOT. lk_oasis )   & 
     173         &      CALL ctl_stop( 'sbc_init : OPA-SAS coupled via OASIS, but key_oasis3 disabled' ) 
     174      IF( nn_components == jp_iam_opa .AND. ln_cpl )   & 
     175         &      CALL ctl_stop( 'sbc_init : OPA-SAS coupled via OASIS, but ln_cpl = T in OPA' ) 
     176      IF( nn_components == jp_iam_opa .AND. ln_mixcpl )   & 
     177         &      CALL ctl_stop( 'sbc_init : OPA-SAS coupled via OASIS, but ln_mixcpl = T in OPA' ) 
     178      IF( ln_cpl .AND. .NOT. lk_oasis )    & 
     179         &      CALL ctl_stop( 'sbc_init : OASIS-coupled atmosphere model, but key_oasis3 disabled' ) 
    174180      IF( ln_mixcpl .AND. .NOT. lk_oasis )    & 
    175181         &      CALL ctl_stop( 'the forced-coupled mixed mode (ln_mixcpl) requires the cpp key key_oasis3' ) 
     
    183189 
    184190      !                          ! Checks: 
    185       IF( nn_isf .EQ. 0 ) THEN                      ! variable initialisation if no ice shelf  
    186          IF( sbc_isf_alloc() /= 0 )   CALL ctl_stop( 'sbc_init : unable to allocate sbc_isf arrays' ) 
     191      IF( .NOT. ln_isf ) THEN                      ! variable initialisation if no ice shelf  
     192         IF( sbc_isf_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_init : unable to allocate sbc_isf arrays' ) 
    187193         fwfisf  (:,:)   = 0.0_wp ; fwfisf_b  (:,:)   = 0.0_wp 
    188194         risf_tsc(:,:,:) = 0.0_wp ; risf_tsc_b(:,:,:) = 0.0_wp 
    189          rdivisf       = 0.0_wp 
    190195      END IF 
    191       IF( nn_ice == 0 .AND. nn_components /= jp_iam_opa )   fr_i(:,:) = 0.e0 ! no ice in the domain, ice fraction is always zero 
    192  
    193       sfx(:,:) = 0.0_wp                            ! the salt flux due to freezing/melting will be computed (i.e. will be non-zero)  
     196      IF( nn_ice == 0 .AND. nn_components /= jp_iam_opa )   fr_i(:,:) = 0._wp    ! no ice in the domain, ice fraction is always zero 
     197 
     198      sfx(:,:) = 0._wp                             ! the salt flux due to freezing/melting will be computed (i.e. will be non-zero)  
    194199                                                   ! only if sea-ice is present 
    195200  
    196       fmmflx(:,:) = 0.0_wp                        ! freezing-melting array initialisation 
     201      fmmflx(:,:) = 0._wp                          ! freezing-melting array initialisation 
    197202       
    198       taum(:,:) = 0.0_wp                           ! Initialise taum for use in gls in case of reduced restart 
     203      taum(:,:) = 0._wp                            ! Initialise taum for use in gls in case of reduced restart 
    199204 
    200205      !                                            ! restartability    
     
    255260      IF(lwp) THEN 
    256261         WRITE(numout,*) 
    257          IF( nsbc == jp_gyre    )   WRITE(numout,*) '              GYRE analytical formulation' 
    258          IF( nsbc == jp_ana     )   WRITE(numout,*) '              analytical formulation' 
    259          IF( nsbc == jp_flx     )   WRITE(numout,*) '              flux formulation' 
    260          IF( nsbc == jp_clio    )   WRITE(numout,*) '              CLIO bulk formulation' 
    261          IF( nsbc == jp_core    )   WRITE(numout,*) '              CORE bulk formulation' 
    262          IF( nsbc == jp_purecpl )   WRITE(numout,*) '              pure coupled formulation' 
    263          IF( nsbc == jp_mfs     )   WRITE(numout,*) '              MFS Bulk formulation' 
    264          IF( nsbc == jp_none    )   WRITE(numout,*) '              OPA coupled to SAS via oasis' 
    265          IF( ln_mixcpl          )   WRITE(numout,*) '              + forced-coupled mixed formulation' 
     262         SELECT CASE( nsbc ) 
     263         CASE( jp_gyre    )   ;   WRITE(numout,*) '   GYRE analytical formulation' 
     264         CASE( jp_ana     )   ;   WRITE(numout,*) '   analytical formulation' 
     265         CASE( jp_flx     )   ;   WRITE(numout,*) '   flux formulation' 
     266         CASE( jp_clio    )   ;   WRITE(numout,*) '   CLIO bulk formulation' 
     267         CASE( jp_core    )   ;   WRITE(numout,*) '   CORE bulk formulation' 
     268         CASE( jp_purecpl )   ;   WRITE(numout,*) '   pure coupled formulation' 
     269         CASE( jp_mfs     )   ;   WRITE(numout,*) '   MFS Bulk formulation' 
     270         CASE( jp_none    )   ;   WRITE(numout,*) '   OPA coupled to SAS via oasis' 
     271            IF( ln_mixcpl )       WRITE(numout,*) '       + forced-coupled mixed formulation' 
     272         END SELECT 
    266273         IF( nn_components/= jp_iam_nemo )  & 
    267             &                       WRITE(numout,*) '              + OASIS coupled SAS' 
     274            &                     WRITE(numout,*) '       + OASIS coupled SAS' 
    268275      ENDIF 
    269276      ! 
    270277      IF( lk_oasis )   CALL sbc_cpl_init (nn_ice)   ! OASIS initialisation. must be done before: (1) first time step 
    271278      !                                             !                                            (2) the use of nn_fsbc 
    272  
    273 !     nn_fsbc initialization if OPA-SAS coupling via OASIS 
    274 !     sas model time step has to be declared in OASIS (mandatory) -> nn_fsbc has to be modified accordingly 
    275       IF ( nn_components /= jp_iam_nemo ) THEN 
    276          IF ( nn_components == jp_iam_opa ) nn_fsbc = cpl_freq('O_SFLX') / NINT(rdt) 
    277          IF ( nn_components == jp_iam_sas ) nn_fsbc = cpl_freq('I_SFLX') / NINT(rdt) 
     279      !     nn_fsbc initialization if OPA-SAS coupling via OASIS 
     280      !     sas model time step has to be declared in OASIS (mandatory) -> nn_fsbc has to be modified accordingly 
     281      IF( nn_components /= jp_iam_nemo ) THEN 
     282         IF( nn_components == jp_iam_opa )   nn_fsbc = cpl_freq('O_SFLX') / NINT(rdt) 
     283         IF( nn_components == jp_iam_sas )   nn_fsbc = cpl_freq('I_SFLX') / NINT(rdt) 
    278284         ! 
    279285         IF(lwp)THEN 
     
    283289         ENDIF 
    284290      ENDIF 
    285  
     291      ! 
    286292      IF( MOD( nitend - nit000 + 1, nn_fsbc) /= 0 .OR.   & 
    287293          MOD( nstock             , nn_fsbc) /= 0 ) THEN  
     
    296302      IF( ln_dm2dc .AND. ( ( NINT(rday) / ( nn_fsbc * NINT(rdt) ) )  < 8 ) )   & 
    297303         &   CALL ctl_warn( 'diurnal cycle for qsr: the sampling of the diurnal cycle is too small...' ) 
    298  
    299                                CALL sbc_ssm_init               ! Sea-surface mean fields initialisation 
    300       ! 
    301       IF( ln_ssr           )   CALL sbc_ssr_init               ! Sea-Surface Restoring initialisation 
    302       ! 
    303                                CALL sbc_rnf_init               ! Runof initialisation 
    304       ! 
    305       IF( nn_ice == 3      )   CALL sbc_lim_init               ! LIM3 initialisation 
    306  
    307       IF( nn_ice == 4      )   CALL cice_sbc_init( nsbc )      ! CICE initialisation 
    308        
     304      ! 
     305                          CALL sbc_ssm_init               ! Sea-surface mean fields initialisation 
     306      ! 
     307      IF( ln_ssr      )   CALL sbc_ssr_init               ! Sea-Surface Restoring initialisation 
     308      ! 
     309                          CALL sbc_rnf_init               ! Runof initialisation 
     310      ! 
     311      IF( nn_ice == 3 )   CALL sbc_lim_init               ! LIM3 initialisation 
     312      ! 
     313      IF( nn_ice == 4 )   CALL cice_sbc_init( nsbc )      ! CICE initialisation 
     314      ! 
    309315   END SUBROUTINE sbc_init 
    310316 
     
    337343         vtau_b(:,:) = vtau(:,:)                         ! (except at nit000 where before fields 
    338344         qns_b (:,:) = qns (:,:)                         !  are set at the end of the routine) 
    339          ! The 3D heat content due to qsr forcing is treated in traqsr 
    340          ! qsr_b (:,:) = qsr (:,:) 
    341          emp_b(:,:) = emp(:,:) 
    342          sfx_b(:,:) = sfx(:,:) 
     345         emp_b (:,:) = emp (:,:) 
     346         sfx_b (:,:) = sfx (:,:) 
     347         IF ( ln_rnf ) THEN 
     348            rnf_b    (:,:  ) = rnf    (:,:  ) 
     349            rnf_tsc_b(:,:,:) = rnf_tsc(:,:,:) 
     350         ENDIF 
    343351      ENDIF 
    344352      !                                            ! ---------------------------------------- ! 
     
    346354      !                                            ! ---------------------------------------- ! 
    347355      ! 
    348       IF( nn_components /= jp_iam_sas )   CALL sbc_ssm( kt )   ! ocean sea surface variables (sst_m, sss_m, ssu_m, ssv_m) 
     356      IF( nn_components /= jp_iam_sas )   CALL sbc_ssm ( kt )  ! ocean sea surface variables (sst_m, sss_m, ssu_m, ssv_m) 
    349357      !                                                        ! averaged over nf_sbc time-step 
    350  
    351       IF (ln_wave) CALL sbc_wave( kt ) 
     358      IF( ln_wave                     )   CALL sbc_wave( kt )  ! surface waves 
     359       
     360       
    352361                                                   !==  sbc formulation  ==! 
    353362                                                             
     
    367376      CASE( jp_mfs   )   ;   CALL sbc_blk_mfs ( kt )                    ! bulk formulation : MFS for the ocean 
    368377      CASE( jp_none  )  
    369          IF( nn_components == jp_iam_opa ) & 
    370                              CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice )   ! OPA-SAS coupling: OPA receiving fields from SAS 
     378         IF( nn_components == jp_iam_opa )   & 
     379            &                CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice )   ! OPA-SAS coupling: OPA receiving fields from SAS 
    371380      END SELECT 
    372381      IF ( ln_wave .AND. ln_tauoc) THEN                                 ! Wave stress subctracted 
     
    384393      IF( ln_mixcpl )        CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice )   ! forced-coupled mixed formulation after forcing 
    385394 
    386  
     395      ! 
    387396      !                                            !==  Misc. Options  ==! 
    388        
     397      ! 
    389398      SELECT CASE( nn_ice )                                       ! Update heat and freshwater fluxes over sea-ice areas 
    390399      CASE(  1 )   ;         CALL sbc_ice_if   ( kt )                ! Ice-cover climatology ("Ice-if" model) 
     
    396405      IF( ln_icebergs    )   CALL icb_stp( kt )                   ! compute icebergs 
    397406 
    398       IF( nn_isf   /= 0  )   CALL sbc_isf( kt )                    ! compute iceshelves 
     407      IF( ln_isf         )   CALL sbc_isf( kt )                   ! compute iceshelves 
    399408 
    400409      IF( ln_rnf         )   CALL sbc_rnf( kt )                   ! add runoffs to fresh water fluxes 
     
    404413      IF( nn_fwb    /= 0 )   CALL sbc_fwb( kt, nn_fwb, nn_fsbc )  ! control the freshwater budget 
    405414 
    406       IF( nn_closea == 1 )   CALL sbc_clo( kt )                   ! treatment of closed sea in the model domain  
    407       !                                                           ! (update freshwater fluxes) 
     415      ! treatment of closed sea in the model domain  
     416      ! (update freshwater fluxes) 
     417      ! Should not be ran if ln_diurnal_only 
     418      IF( .NOT.(ln_diurnal_only) .AND. (nn_closea == 1) )   CALL sbc_clo( kt )    
     419 
    408420!RBbug do not understand why see ticket 667 
    409421!clem: it looks like it is necessary for the north fold (in certain circumstances). Don't know why. 
     
    451463         CALL iom_rstput( kt, nitrst, numrow, 'sfx_b'  , sfx  ) 
    452464      ENDIF 
    453  
    454465      !                                                ! ---------------------------------------- ! 
    455466      !                                                !        Outputs and control print         ! 
    456467      !                                                ! ---------------------------------------- ! 
    457468      IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN 
    458          CALL iom_put( "empmr" , emp  - rnf )                   ! upward water flux 
     469         CALL iom_put( "empmr"  , emp    - rnf )                ! upward water flux 
     470         CALL iom_put( "empbmr" , emp_b  - rnf )                ! before upward water flux ( needed to recalculate the time evolution of ssh in offline ) 
    459471         CALL iom_put( "saltflx", sfx  )                        ! downward salt flux   
    460472                                                                ! (includes virtual salt flux beneath ice  
     
    473485      ! 
    474486      IF(ln_ctl) THEN         ! print mean trends (used for debugging) 
    475          CALL prt_ctl(tab2d_1=fr_i              , clinfo1=' fr_i     - : ', mask1=tmask, ovlap=1 ) 
    476          CALL prt_ctl(tab2d_1=(emp-rnf + fwfisf), clinfo1=' emp-rnf  - : ', mask1=tmask, ovlap=1 ) 
    477          CALL prt_ctl(tab2d_1=(sfx-rnf + fwfisf), clinfo1=' sfx-rnf  - : ', mask1=tmask, ovlap=1 ) 
     487         CALL prt_ctl(tab2d_1=fr_i              , clinfo1=' fr_i    - : ', mask1=tmask, ovlap=1 ) 
     488         CALL prt_ctl(tab2d_1=(emp-rnf + fwfisf), clinfo1=' emp-rnf - : ', mask1=tmask, ovlap=1 ) 
     489         CALL prt_ctl(tab2d_1=(sfx-rnf + fwfisf), clinfo1=' sfx-rnf - : ', mask1=tmask, ovlap=1 ) 
    478490         CALL prt_ctl(tab2d_1=qns              , clinfo1=' qns      - : ', mask1=tmask, ovlap=1 ) 
    479491         CALL prt_ctl(tab2d_1=qsr              , clinfo1=' qsr      - : ', mask1=tmask, ovlap=1 ) 
Note: See TracChangeset for help on using the changeset viewer.