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_r11756_SI3restart_XIOS/src/SAS – NEMO

source: NEMO/branches/2019/dev_r11756_SI3restart_XIOS/src/SAS/step.F90 @ 13108

Last change on this file since 13108 was 11923, checked in by andmirek, 5 years ago

Ticket #2323 all other SETTE/tests configurations

  • Property svn:keywords set to Id
File size: 7.0 KB
Line 
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
8   !!             .   !    .                                                     
9   !!             .   !    .                                                     
10   !!   NEMO     3.5  !  2012-03  (S. Alderson)
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)
19   USE sbc_oce          ! surface boundary condition: fields
20   USE sbcmod           ! surface boundary condition       (sbc     routine)
21   USE sbcrnf           ! surface boundary condition: runoff variables
22   USE sbccpl           ! surface boundary condition: coupled interface
23   USE eosbn2           ! equation of state                (eos_bn2 routine)
24   USE diawri           ! Standard run outputs             (dia_wri routine)
25   USE bdy_oce   , ONLY: ln_bdy
26   USE bdydta           ! mandatory for sea-ice
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
37
38#if defined key_agrif
39   USE agrif_oce, ONLY: lk_agrif_debug
40#if defined key_si3
41   USE agrif_ice_update
42#endif
43#endif
44   
45   IMPLICIT NONE
46   PRIVATE
47
48   PUBLIC   stp   ! called by nemogcm.F90
49
50   !!----------------------------------------------------------------------
51   !! NEMO/SAS 4.0 , NEMO Consortium (2018)
52   !! $Id$
53   !! Software governed by the CeCILL license (see ./LICENSE)
54   !!----------------------------------------------------------------------
55CONTAINS
56
57#if defined key_agrif
58   RECURSIVE SUBROUTINE stp( )
59      INTEGER             ::   kstp   ! ocean time-step index
60#else
61   SUBROUTINE stp( kstp )
62      INTEGER, INTENT(in) ::   kstp   ! ocean time-step index
63#endif
64      !!----------------------------------------------------------------------
65      !!                     ***  ROUTINE stp  ***
66      !!                     
67      !! ** Purpose : - Time stepping of SBC (surface boundary)
68      !!
69      !! ** Method  : -1- Update forcings and data 
70      !!              -2- Outputs and diagnostics
71      !!----------------------------------------------------------------------
72      INTEGER ::   indic    ! error indicator if < 0
73      !! ---------------------------------------------------------------------
74
75#if defined key_agrif
76      kstp = nit000 + Agrif_Nb_Step()
77      IF ( lk_agrif_debug ) THEN
78         IF ( Agrif_Root() .and. lwp) Write(*,*) '---'
79         IF (lwp) Write(*,*) 'Grid Number',Agrif_Fixed(),' time step ',kstp, 'int tstep',Agrif_NbStepint()
80      ENDIF
81
82      IF ( kstp == (nit000 + 1) ) lk_agrif_fstep = .FALSE.
83
84# if defined key_iomput
85      IF( Agrif_Nbstepint() == 0 )   CALL iom_swap( cxios_context )
86# endif   
87#endif   
88                             indic = 0                    ! although indic is not changed in stp_ctl
89                                                          ! need to keep the same interface
90      IF( kstp == nit000 ) THEN
91        CALL iom_init( cxios_context ) ! iom_put initialization (must be done after nemo_init for AGRIF+XIOS+OASIS)
92        IF( lwxios      )   CALL iom_init( cwxios_context              )  ! restart write context
93      ENDIF
94      IF( kstp /= nit000 )   CALL day( kstp )             ! Calendar (day was already called at nit000 in day_init)
95                             CALL iom_setkt( kstp - nit000 + 1, cxios_context )   ! tell iom we are at time step kstp
96
97      ! ==> clem: open boundaries is mandatory for sea-ice because ice BDY is not decoupled from 
98      !           the environment of ocean BDY. Therefore bdy is called in both OPA and SAS modules.
99      !           From SAS: ocean bdy data are wrong  (but we do not care) and ice bdy data are OK. 
100      !           This is not clean and should be changed in the future.
101      IF( ln_bdy     )       CALL bdy_dta ( kstp, kt_offset=+1 )   ! update dynamic & tracer data at open boundaries
102      ! ==>
103                             CALL sbc    ( kstp )         ! Sea Boundary Condition (including sea-ice)
104
105                             CALL dia_wri( kstp )         ! ocean model: outputs
106
107#if defined key_agrif
108      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
109      ! AGRIF
110      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<     
111                             CALL Agrif_Integrate_ChildGrids( stp ) 
112
113      IF( Agrif_NbStepint() == 0 ) THEN               ! AGRIF Update from zoom N to zoom 1 then to Parent
114#if defined key_si3
115                             CALL Agrif_Update_ice( )   ! update sea-ice
116#endif
117      ENDIF
118#endif
119                             
120      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
121      ! Control
122      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
123                             CALL stp_ctl( kstp, indic )
124      IF( indic < 0  )  THEN
125                             CALL ctl_stop( 'step: indic < 0' )
126                             CALL dia_wri_state( 'output.abort' )
127      ENDIF
128      IF( kstp == nit000   ) CALL iom_close( numror )     ! close input  ocean restart file
129     
130      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
131      ! Coupled mode
132      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
133      IF( lk_oasis    )  CALL sbc_cpl_snd( kstp )     ! coupled mode : field exchanges if OASIS-coupled ice
134
135#if defined key_iomput
136      IF( kstp == nitrst ) THEN
137         IF(.NOT.lwxios) THEN
138            CALL iom_close( numrow )     
139         ENDIF
140         lrst_oce = .FALSE.
141      ENDIF
142      IF( kstp == nitend .OR. indic < 0 ) THEN
143                  IF(lrxios) THEN
144#if defined key_si3
145                             CALL iom_context_finalize( crixios_context)
146#endif
147                             CALL iom_context_finalize( crxios_context)
148                  ENDIF
149
150                  IF(lwxios) CALL iom_context_finalize(      cwxios_context          )
151
152                             CALL iom_context_finalize( cxios_context ) ! needed for XIOS+AGRIF
153      ENDIF
154#endif
155      !
156      IF( ln_timing .AND.  kstp == nit000  )   CALL timing_reset
157      !
158   END SUBROUTINE stp
159
160   !!======================================================================
161END MODULE step
Note: See TracBrowser for help on using the repository browser.