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.
step.F90 in NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps_rewrite_time_filterswap/src/SAS – NEMO

source: NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps_rewrite_time_filterswap/src/SAS/step.F90 @ 11053

Last change on this file since 11053 was 11053, checked in by davestorkey, 5 years ago

2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps_rewrite_time_filterswap : Merge in latest changes from main branch and finish conversion of "h" variables. NB. This version still doesn't work!

  • Property svn:keywords set to Id
File size: 7.0 KB
RevLine 
[3331]1MODULE step
2   !!======================================================================
3   !!                       ***  MODULE step  ***
4   !! Time-stepping    : manager of the ocean, tracer and ice time stepping
5   !!                    version for standalone surface scheme
6   !!======================================================================
7   !! History :  OPA  !  1991-03  (G. Madec)  Original code
[3362]8   !!             .   !    .                                                     
9   !!             .   !    .                                                     
10   !!   NEMO     3.5  !  2012-03  (S. Alderson)
[3331]11   !!----------------------------------------------------------------------
12
13   !!----------------------------------------------------------------------
14   !!   stp             : OPA system time-stepping
15   !!----------------------------------------------------------------------
16   USE oce              ! ocean dynamics and tracers variables
17   USE dom_oce          ! ocean space and time domain variables
18   USE daymod           ! calendar                         (day     routine)
[6140]19   USE sbc_oce          ! surface boundary condition: fields
[3331]20   USE sbcmod           ! surface boundary condition       (sbc     routine)
21   USE sbcrnf           ! surface boundary condition: runoff variables
[6140]22   USE sbccpl           ! surface boundary condition: coupled interface
[3331]23   USE eosbn2           ! equation of state                (eos_bn2 routine)
24   USE diawri           ! Standard run outputs             (dia_wri routine)
[7646]25   USE bdy_oce   , ONLY: ln_bdy
[9019]26   USE bdydta           ! mandatory for sea-ice
[6140]27   USE stpctl           ! time stepping control            (stp_ctl routine)
28   !
29   USE in_out_manager   ! I/O manager
30   USE prtctl           ! Print control                    (prt_ctl routine)
31   USE iom              !
32   USE lbclnk           !
33   USE timing           ! Timing           
34#if defined key_iomput
35   USE xios
36#endif
[5510]37
[7646]38#if defined key_agrif
[9019]39   USE agrif_oce, ONLY: lk_agrif_debug
[9570]40#if defined key_si3
[9596]41   USE agrif_ice_update
[7646]42#endif
[9510]43#endif
[7646]44   
[3331]45   IMPLICIT NONE
46   PRIVATE
47
[6140]48   PUBLIC   stp   ! called by nemogcm.F90
[3331]49
50   !!----------------------------------------------------------------------
[10922]51   !! time level indices
52   !!----------------------------------------------------------------------
53   INTEGER, PUBLIC :: Nbb, Nnn, Naa, Nrhs          !! used by nemo_init
54   !!----------------------------------------------------------------------
[10068]55   !! NEMO/SAS 4.0 , NEMO Consortium (2018)
[5215]56   !! $Id$
[10068]57   !! Software governed by the CeCILL license (see ./LICENSE)
[3331]58   !!----------------------------------------------------------------------
59CONTAINS
60
61#if defined key_agrif
[7761]62   RECURSIVE SUBROUTINE stp( )
[3331]63      INTEGER             ::   kstp   ! ocean time-step index
64#else
65   SUBROUTINE stp( kstp )
66      INTEGER, INTENT(in) ::   kstp   ! ocean time-step index
67#endif
68      !!----------------------------------------------------------------------
69      !!                     ***  ROUTINE stp  ***
70      !!                     
[3358]71      !! ** Purpose : - Time stepping of SBC (surface boundary)
[3331]72      !!
73      !! ** Method  : -1- Update forcings and data 
[3358]74      !!              -2- Outputs and diagnostics
[3331]75      !!----------------------------------------------------------------------
76      INTEGER ::   indic    ! error indicator if < 0
77      !! ---------------------------------------------------------------------
78
79#if defined key_agrif
80      kstp = nit000 + Agrif_Nb_Step()
[7646]81      IF ( lk_agrif_debug ) THEN
82         IF ( Agrif_Root() .and. lwp) Write(*,*) '---'
83         IF (lwp) Write(*,*) 'Grid Number',Agrif_Fixed(),' time step ',kstp, 'int tstep',Agrif_NbStepint()
84      ENDIF
85
86      IF ( kstp == (nit000 + 1) ) lk_agrif_fstep = .FALSE.
87
[3331]88# if defined key_iomput
[5407]89      IF( Agrif_Nbstepint() == 0 )   CALL iom_swap( cxios_context )
[3331]90# endif   
91#endif   
[7646]92                             indic = 0                    ! although indic is not changed in stp_ctl
93                                                          ! need to keep the same interface
[5407]94      IF( kstp == nit000 )   CALL iom_init( cxios_context ) ! iom_put initialization (must be done after nemo_init for AGRIF+XIOS+OASIS)
[3331]95      IF( kstp /= nit000 )   CALL day( kstp )             ! Calendar (day was already called at nit000 in day_init)
[5407]96                             CALL iom_setkt( kstp - nit000 + 1, cxios_context )   ! tell iom we are at time step kstp
[3331]97
[9019]98      ! ==> clem: open boundaries is mandatory for sea-ice because ice BDY is not decoupled from 
[5510]99      !           the environment of ocean BDY. Therefore bdy is called in both OPA and SAS modules.
100      !           From SAS: ocean bdy data are wrong  (but we do not care) and ice bdy data are OK. 
101      !           This is not clean and should be changed in the future.
[10975]102      IF( ln_bdy     )       CALL bdy_dta ( kstp,     Nnn, time_offset=+1 )   ! update dynamic & tracer data at open boundaries
[5510]103      ! ==>
[10975]104                             CALL sbc    ( kstp, Nbb, Nnn )                   ! Sea Boundary Condition (including sea-ice)
[3331]105
[11053]106                             CALL dia_wri( kstp,      Nnn )                   ! ocean model: outputs
[3331]107
[7646]108#if defined key_agrif
109      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
110      ! AGRIF
111      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<     
112                             CALL Agrif_Integrate_ChildGrids( stp ) 
[9510]113
114      IF( Agrif_NbStepint() == 0 ) THEN               ! AGRIF Update from zoom N to zoom 1 then to Parent
[9570]115#if defined key_si3
[9781]116                             CALL Agrif_Update_ice( )   ! update sea-ice
[7646]117#endif
[9510]118      ENDIF
119#endif
[10874]120                             
[7646]121      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
122      ! Control
123      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
[3331]124                             CALL stp_ctl( kstp, indic )
[7646]125      IF( indic < 0  )  THEN
126                             CALL ctl_stop( 'step: indic < 0' )
[11053]127                             CALL dia_wri_state( 'output.abort', Nnn )
[7646]128      ENDIF
[11053]129      IF( kstp == nit000   ) CALL iom_close( numror )           ! close input  ocean restart file
[7646]130     
[5407]131      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
132      ! Coupled mode
133      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
[11053]134      IF( lk_oasis    )  CALL sbc_cpl_snd( kstp, Nbb, Nnn )     ! coupled mode : field exchanges if OASIS-coupled ice
[5407]135
[3769]136#if defined key_iomput
[9367]137      IF( kstp == nitrst ) THEN
138         IF(.NOT.lwxios) THEN
139            CALL iom_close( numrow )     
140         ELSE
141            CALL iom_context_finalize( cwxios_context )
142         ENDIF
143         lrst_oce = .FALSE.
144      ENDIF
145      IF( kstp == nitend .OR. indic < 0 ) THEN
[5407]146                             CALL iom_context_finalize( cxios_context ) ! needed for XIOS+AGRIF
147      ENDIF
[3769]148#endif
[3331]149      !
[9019]150      IF( ln_timing .AND.  kstp == nit000  )   CALL timing_reset
[3331]151      !
152   END SUBROUTINE stp
153
154   !!======================================================================
155END MODULE step
Note: See TracBrowser for help on using the repository browser.