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 2528 for trunk/NEMOGCM/NEMO/OPA_SRC/step.F90 – NEMO

Ignore:
Timestamp:
2010-12-27T18:33:53+01:00 (13 years ago)
Author:
rblod
Message:

Update NEMOGCM from branch nemo_v3_3_beta

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/step.F90

    • Property svn:eol-style deleted
    r2191 r2528  
    2121   !!            3.2  !  2009-02  (G. Madec, R. Benshila)  reintroduicing z*-coordinate 
    2222   !!             -   !  2009-06  (S. Masson, G. Madec)  TKE restart compatible with key_cpl 
    23    !!---------------------------------------------------------------------- 
    24  
    25    !!---------------------------------------------------------------------- 
    26    !!   stp            : OPA system time-stepping 
    27    !!---------------------------------------------------------------------- 
    28    USE oce             ! ocean dynamics and tracers variables 
    29    USE dom_oce         ! ocean space and time domain variables  
    30    USE zdf_oce         ! ocean vertical physics variables 
    31    USE ldftra_oce      ! ocean tracer   - trends 
    32    USE ldfdyn_oce      ! ocean dynamics - trends 
    33    USE in_out_manager  ! I/O manager 
    34    USE iom             ! 
    35    USE lbclnk 
    36  
    37    USE daymod          ! calendar                         (day     routine) 
    38  
    39    USE dtatem          ! ocean temperature data           (dta_tem routine) 
    40    USE dtasal          ! ocean salinity    data           (dta_sal routine) 
    41    USE sbcmod          ! surface boundary condition       (sbc     routine) 
    42    USE sbcrnf          ! surface boundary condition: runoff variables 
    43    USE sbccpl          ! surface boundary condition: coupled formulation (call send at end of step) 
    44    USE cpl_oasis3, ONLY : lk_cpl 
    45  
     23   !!            3.3  !  2010-05  (K. Mogensen, A. Weaver, M. Martin, D. Lea) Assimilation interface 
     24   !!             -   !  2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase + merge TRC-TRA 
     25   !!---------------------------------------------------------------------- 
     26 
     27   !!---------------------------------------------------------------------- 
     28   !!   stp             : OPA system time-stepping 
     29   !!---------------------------------------------------------------------- 
     30   USE step_oce         ! time stepping definition modules  
    4631#if defined key_top 
    47    USE trcstp          ! passive tracer time-stepping      (trc_stp routine) 
    48 #endif 
    49  
    50    USE traqsr          ! solar radiation penetration      (tra_qsr routine) 
    51    USE trasbc          ! surface boundary condition       (tra_sbc routine) 
    52    USE trabbc          ! bottom boundary condition        (tra_bbc routine) 
    53    USE trabbl          ! bottom boundary layer            (tra_bbl routine) 
    54    USE tradmp          ! internal damping                 (tra_dmp routine) 
    55    USE traadv          ! advection scheme control     (tra_adv_ctl routine) 
    56    USE traldf          ! lateral mixing                   (tra_ldf routine) 
    57    USE cla             ! cross land advection             (tra_cla routine) 
    58    !   zdfkpp          ! KPP non-local tracer fluxes      (tra_kpp routine) 
    59    USE trazdf          ! vertical mixing                  (tra_zdf routine) 
    60    USE tranxt          ! time-stepping                    (tra_nxt routine) 
    61    USE tranpc          ! non-penetrative convection       (tra_npc routine) 
    62  
    63    USE eosbn2          ! equation of state                (eos_bn2 routine) 
    64  
    65    USE dynadv          ! advection                        (dyn_adv routine) 
    66    USE dynbfr          ! Bottom friction terms            (dyn_bfr routine) 
    67    USE dynvor          ! vorticity term                   (dyn_vor routine) 
    68    USE dynhpg          ! hydrostatic pressure grad.       (dyn_hpg routine) 
    69    USE dynldf          ! lateral momentum diffusion       (dyn_ldf routine) 
    70    USE dynzdf          ! vertical diffusion               (dyn_zdf routine) 
    71    USE dynspg_oce      ! surface pressure gradient        (dyn_spg routine) 
    72    USE dynspg          ! surface pressure gradient        (dyn_spg routine) 
    73    USE dynnxt          ! time-stepping                    (dyn_nxt routine) 
    74  
    75    USE obc_par         ! open boundary condition variables 
    76    USE obcdta          ! open boundary condition data     (obc_dta routine) 
    77    USE obcrst          ! open boundary cond. restart      (obc_rst routine) 
    78    USE obcrad          ! open boundary cond. radiation    (obc_rad routine) 
    79  
    80    USE bdy_par         ! unstructured open boundary data variables 
    81    USE bdydta          ! unstructured open boundary data  (bdy_dta routine) 
    82  
    83    USE sshwzv          ! vertical velocity and ssh        (ssh_wzv routine) 
    84  
    85    USE ldfslp          ! iso-neutral slopes               (ldf_slp routine) 
    86    USE ldfeiv          ! eddy induced velocity coef.      (ldf_eiv routine) 
    87  
    88    USE zdftmx          ! tide-induced vertical mixing     (zdf_tmx routine) 
    89    USE zdfbfr          ! bottom friction                  (zdf_bfr routine) 
    90    USE zdftke_old      ! old TKE vertical mixing      (zdf_tke_old routine) 
    91    USE zdftke          ! TKE vertical mixing              (zdf_tke routine) 
    92    USE zdfkpp          ! KPP vertical mixing              (zdf_kpp routine) 
    93    USE zdfddm          ! double diffusion mixing          (zdf_ddm routine) 
    94    USE zdfevd          ! enhanced vertical diffusion      (zdf_evd routine) 
    95    USE zdfric          ! Richardson vertical mixing       (zdf_ric routine) 
    96    USE zdfmxl          ! Mixed-layer depth                (zdf_mxl routine) 
    97  
    98    USE zpshde          ! partial step: hor. derivative     (zps_hde routine) 
    99  
    100    USE diawri          ! Standard run outputs             (dia_wri routine) 
    101    USE trdicp          ! Ocean momentum/tracers trends    (trd_wri routine) 
    102    USE trdmld          ! mixed-layer trends               (trd_mld routine) 
    103    USE trdmld_rst      ! restart for mixed-layer trends 
    104    USE trdmod_oce      ! ocean momentum/tracers trends 
    105    USE trdvor          ! vorticity budget                 (trd_vor routine) 
    106    USE diagap          ! hor. mean model-data gap         (dia_gap routine) 
    107    USE diahdy          ! dynamic height                   (dia_hdy routine) 
    108    USE diaptr          ! poleward transports              (dia_ptr routine) 
    109    USE diaar5          ! AR5 diagnosics                   (dia_ar5 routine) 
    110    USE diahth          ! thermocline depth                (dia_hth routine) 
    111    USE diafwb          ! freshwater budget                (dia_fwb routine) 
    112    USE flo_oce         ! floats variables 
    113    USE floats          ! floats computation               (flo_stp routine) 
    114  
    115    USE stpctl          ! time stepping control            (stp_ctl routine) 
    116    USE restart         ! ocean restart                    (rst_wri routine) 
    117    USE prtctl          ! Print control                    (prt_ctl routine) 
    118  
     32   USE trcstp           ! passive tracer time-stepping      (trc_stp routine) 
     33#endif 
    11934#if defined key_agrif 
    12035   USE agrif_opa_sponge ! Momemtum and tracers sponges 
    12136#endif 
     37   USE asminc           ! assimilation increments    (tra_asm_inc, dyn_asm_inc routines) 
    12238 
    12339   IMPLICIT NONE 
    12440   PRIVATE 
    12541 
    126    PUBLIC   stp        ! called by opa.F90 
     42   PUBLIC   stp   ! called by opa.F90 
    12743 
    12844   !! * Substitutions 
     
    13046#  include "zdfddm_substitute.h90" 
    13147   !!---------------------------------------------------------------------- 
    132    !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
     48   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    13349   !! $Id$ 
    134    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
    135    !!---------------------------------------------------------------------- 
    136  
     50   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     51   !!---------------------------------------------------------------------- 
    13752CONTAINS 
    13853 
     
    16681#if defined key_agrif 
    16782      kstp = nit000 + Agrif_Nb_Step() 
    168 !      IF( Agrif_Root() .and. lwp) Write(*,*) '---' 
    169 !      IF(lwp) Write(*,*) 'Grid Number',Agrif_Fixed(),' time step ',kstp 
    17083# if defined key_iomput 
    171       IF( Agrif_Nbstepint() == 0) CALL iom_swap 
     84      IF( Agrif_Nbstepint() == 0 )  CALL iom_swap 
    17285# endif    
    17386#endif    
    174       indic = 1                                       ! reset to no error condition 
    175  
     87                             indic = 0                ! reset to no error condition 
    17688      IF( kstp /= nit000 )   CALL day( kstp )         ! Calendar (day was already called at nit000 in day_init) 
    177  
    178       CALL iom_setkt( kstp )                          ! say to iom that we are at time step kstp 
    179        
     89                             CALL iom_setkt( kstp )   ! say to iom that we are at time step kstp 
     90 
    18091      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    18192      ! Update data, open boundaries, surface boundary condition (including sea-ice) 
     
    18697      IF( lk_obc     )   CALL obc_dta( kstp )         ! update dynamic and tracer data at open boundaries 
    18798      IF( lk_obc     )   CALL obc_rad( kstp )         ! compute phase velocities at open boundaries 
    188       IF( lk_bdy     )   CALL bdy_dta( kstp )         ! update dynamic and tracer data at unstructured open boundary 
     99      IF( lk_bdy     )   CALL bdy_dta_frs( kstp )     ! update dynamic and tracer data for FRS conditions (BDY) 
    189100 
    190101      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    196107      ! Ocean physics update                (ua, va, ta, sa used as workspace) 
    197108      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    198                          CALL bn2( tb, sb, rn2b )     ! before Brunt-Vaisala frequency 
    199                          CALL bn2( tn, sn, rn2  )     ! now    Brunt-Vaisala frequency 
     109                         CALL bn2( tsb, rn2b )        ! before Brunt-Vaisala frequency 
     110                         CALL bn2( tsn, rn2  )        ! now    Brunt-Vaisala frequency 
    200111      ! 
    201112      !  VERTICAL PHYSICS    
    202113                         CALL zdf_bfr( kstp )         ! bottom friction 
     114                          
    203115      !                                               ! Vertical eddy viscosity and diffusivity coefficients 
    204       IF( lk_zdfric     )   CALL zdf_ric    ( kstp )  ! Richardson number dependent Kz 
    205       IF( lk_zdftke_old )   CALL zdf_tke_old( kstp )  ! TKE closure scheme for Kz (old scheme) 
    206       IF( lk_zdftke     )   CALL zdf_tke    ( kstp )  ! TKE closure scheme for Kz 
    207       IF( lk_zdfkpp     )   CALL zdf_kpp    ( kstp )  ! KPP closure scheme for Kz 
    208       IF( lk_zdfcst     )   THEN                      ! Constant Kz (reset avt, avm[uv] to the background value) 
     116      IF( lk_zdfric  )   CALL zdf_ric( kstp )            ! Richardson number dependent Kz 
     117      IF( lk_zdftke  )   CALL zdf_tke( kstp )            ! TKE closure scheme for Kz 
     118      IF( lk_zdfgls  )   CALL zdf_gls( kstp )            ! GLS closure scheme for Kz 
     119      IF( lk_zdfkpp  )   CALL zdf_kpp( kstp )            ! KPP closure scheme for Kz 
     120      IF( lk_zdfcst  )   THEN                            ! Constant Kz (reset avt, avm[uv] to the background value) 
    209121         avt (:,:,:) = rn_avt0 * tmask(:,:,:) 
    210122         avmu(:,:,:) = rn_avm0 * umask(:,:,:) 
     
    220132      IF( lk_zdfddm .AND. .NOT. lk_zdfkpp )   & 
    221133         &               CALL zdf_ddm( kstp )         ! double diffusive mixing 
     134          
    222135                         CALL zdf_mxl( kstp )         ! mixed layer depth 
    223136 
    224                                                       ! write tke information in the restart file 
     137                                                      ! write TKE or GLS information in the restart file 
    225138      IF( lrst_oce .AND. lk_zdftke )   CALL tke_rst( kstp, 'WRITE' ) 
     139      IF( lrst_oce .AND. lk_zdfgls )   CALL gls_rst( kstp, 'WRITE' ) 
    226140      ! 
    227141      !  LATERAL  PHYSICS  
    228142      ! 
    229143      IF( lk_ldfslp ) THEN                            ! slope of lateral mixing 
    230                          CALL eos( tb, sb, rhd )                ! before in situ density 
    231          IF( ln_zps )    CALL zps_hde( kstp, tb, sb, rhd,  &    ! Partial steps: before horizontal gradient 
    232             &                              gtu, gsu, gru,  &    ! of t, s, rd at the last ocean level 
    233             &                              gtv, gsv, grv ) 
    234                          CALL ldf_slp( kstp, rhd, rn2b )        ! before slope of the lateral mixing 
     144                         CALL eos( tsb, rhd )                ! before in situ density 
     145         IF( ln_zps )    CALL zps_hde( kstp, jpts, tsb, gtsu, gtsv,  &    ! Partial steps: before horizontal gradient 
     146            &                                      rhd, gru , grv  )      ! of t, s, rd at the last ocean level 
     147         IF( ln_traldf_grif ) THEN                           ! before slope for Griffies operator 
     148                         CALL ldf_slp_grif( kstp ) 
     149         ELSE 
     150                         CALL ldf_slp( kstp, rhd, rn2b )     ! before slope for Madec operator 
     151         ENDIF 
    235152      ENDIF 
    236153#if defined key_traldf_c2d 
    237154      IF( lk_traldf_eiv )   CALL ldf_eiv( kstp )      ! eddy induced velocity coefficient 
    238 #  endif 
     155#endif 
    239156 
    240157      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    243160      IF( lk_floats  )   CALL flo_stp( kstp )         ! drifting Floats 
    244161      IF( lk_diahth  )   CALL dia_hth( kstp )         ! Thermocline depth (20 degres isotherm depth) 
    245       IF( lk_diagap  )   CALL dia_gap( kstp )         ! basin averaged diagnostics 
    246       IF( lk_diahdy  )   CALL dia_hdy( kstp )         ! dynamical heigh diagnostics 
    247162      IF( lk_diafwb  )   CALL dia_fwb( kstp )         ! Fresh water budget diagnostics 
    248163      IF( ln_diaptr  )   CALL dia_ptr( kstp )         ! Poleward TRansports diagnostics 
     
    260175      ! Active tracers                              (ua, va used as workspace) 
    261176      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    262                              ta(:,:,:) = 0.e0               ! set tracer trends to zero 
    263                              sa(:,:,:) = 0.e0 
    264  
     177                             tsa(:,:,:,:) = 0.e0            ! set tracer trends to zero 
     178 
     179      IF(  ln_asmiau .AND. & 
     180         & ln_trainc     )   CALL tra_asm_inc( kstp )       ! apply tracer assimilation increment 
    265181                             CALL tra_sbc    ( kstp )       ! surface boundary condition 
    266182      IF( ln_traqsr      )   CALL tra_qsr    ( kstp )       ! penetrative solar radiation qsr 
    267       IF( lk_trabbc      )   CALL tra_bbc    ( kstp )       ! bottom heat flux 
    268       IF( lk_trabbl_dif  )   CALL tra_bbl_dif( kstp )       ! diffusive bottom boundary layer scheme 
    269       IF( lk_trabbl_adv  )   CALL tra_bbl_adv( kstp )       ! advective (and/or diffusive) bottom boundary layer scheme 
     183      IF( ln_trabbc      )   CALL tra_bbc    ( kstp )       ! bottom heat flux 
     184      IF( lk_trabbl      )   CALL tra_bbl    ( kstp )       ! advective (and/or diffusive) bottom boundary layer scheme 
    270185      IF( lk_tradmp      )   CALL tra_dmp    ( kstp )       ! internal damping trends 
    271186                             CALL tra_adv    ( kstp )       ! horizontal & vertical advection 
    272       IF( n_cla == 1     )   CALL tra_cla    ( kstp )       ! Cross Land Advection (Update Hor. advection) 
    273       IF( lk_zdfkpp )        CALL tra_kpp    ( kstp )       ! KPP non-local tracer fluxes 
     187      IF( lk_zdfkpp      )   CALL tra_kpp    ( kstp )       ! KPP non-local tracer fluxes 
    274188                             CALL tra_ldf    ( kstp )       ! lateral mixing 
    275189#if defined key_agrif 
     190                             CALL tra_unswap 
    276191      IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_tra          ! tracers sponge 
     192                             CALL tra_swap 
    277193#endif 
    278194                             CALL tra_zdf    ( kstp )       ! vertical mixing and after tracer fields 
    279195 
    280196      IF( ln_dynhpg_imp  ) THEN                             ! semi-implicit hpg (time stepping then eos) 
    281          IF( ln_zdfnpc   )   CALL tra_npc    ( kstp )            ! update after fields by non-penetrative convection 
    282                              CALL tra_nxt    ( kstp )            ! tracer fields at next time step 
    283                              CALL eos( ta, sa, rhd, rhop )       ! Time-filtered in situ density for hpg computation 
    284          IF( ln_zps      )   CALL zps_hde( kstp, ta, sa, rhd,   &   ! Partial steps: time filtered hor. derivative 
    285             &                                   gtu, gsu, gru,  &   ! of t, s, rd at the bottom ocean level 
    286             &                                   gtv, gsv, grv ) 
     197         IF( ln_zdfnpc   )   CALL tra_npc( kstp )                ! update after fields by non-penetrative convection 
     198                             CALL tra_nxt( kstp )                ! tracer fields at next time step 
     199                             CALL eos    ( tsa, rhd, rhop )      ! Time-filtered in situ density for hpg computation 
     200         IF( ln_zps      )   CALL zps_hde( kstp, jpts, tsa, gtsu, gtsv,  &    ! zps: time filtered hor. derivative 
     201            &                                          rhd, gru , grv  )      ! of t, s, rd at the last ocean level 
    287202          
    288203      ELSE                                                  ! centered hpg  (eos then time stepping) 
    289                              CALL eos( tn, sn, rhd, rhop )       ! now in situ density for hpg computation 
    290          IF( ln_zps      )   CALL zps_hde( kstp, tn, sn, rhd,   &   ! Partial steps: now horizontal derivative 
    291             &                                   gtu, gsu, gru,  &   ! of t, s, rd at the bottom ocean level 
    292             &                                   gtv, gsv, grv ) 
    293          IF( ln_zdfnpc   )   CALL tra_npc    ( kstp )       ! update after fields by non-penetrative convection 
    294                              CALL tra_nxt    ( kstp )       ! tracer fields at next time step 
     204                             CALL eos    ( tsn, rhd, rhop )      ! now in situ density for hpg computation 
     205         IF( ln_zps      )   CALL zps_hde( kstp, jpts, tsn, gtsu, gtsv,  &    ! zps: now hor. derivative 
     206            &                                          rhd, gru , grv  )      ! of t, s, rd at the last ocean level 
     207         IF( ln_zdfnpc   )   CALL tra_npc( kstp )                ! update after fields by non-penetrative convection 
     208                             CALL tra_nxt( kstp )                ! tracer fields at next time step 
    295209      ENDIF  
     210                             CALL tra_unswap                ! udate T & S 3D arrays  (to be suppressed) 
    296211 
    297212      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    301216                               va(:,:,:) = 0.e0 
    302217 
     218      IF(  ln_asmiau .AND. & 
     219         & ln_dyninc       )   CALL dyn_asm_inc( kstp )     ! apply dynamics assimilation increment 
    303220                               CALL dyn_adv( kstp )         ! advection (vector or flux form) 
    304221                               CALL dyn_vor( kstp )         ! vorticity term including Coriolis 
     
    308225#endif 
    309226                               CALL dyn_hpg( kstp )         ! horizontal gradient of Hydrostatic pressure 
    310                                CALL dyn_bfr( kstp )           ! bottom friction    
     227                               CALL dyn_bfr( kstp )         ! bottom friction    
    311228                               CALL dyn_zdf( kstp )         ! vertical diffusion 
    312                                indic=0 
    313229                               CALL dyn_spg( kstp, indic )  ! surface pressure gradient 
    314230                               CALL dyn_nxt( kstp )         ! lateral velocity at next time step 
    315231 
    316232                               CALL ssh_nxt( kstp )         ! sea surface height at next time step 
     233 
     234      IF( ln_diahsb        )   CALL dia_hsb( kstp )         ! - ML - global conservation diagnostics 
     235      IF( lk_diaobs  )         CALL dia_obs( kstp )         ! obs-minus-model (assimilation) diagnostics (call after dynamics update) 
    317236 
    318237      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
Note: See TracChangeset for help on using the changeset viewer.