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 branches/2016/dev_v3_6_STABLE_r6506_AGRIF_LIM3/NEMOGCM/NEMO/SAS_SRC – NEMO

source: branches/2016/dev_v3_6_STABLE_r6506_AGRIF_LIM3/NEMOGCM/NEMO/SAS_SRC/step.F90 @ 7060

Last change on this file since 7060 was 7060, checked in by clem, 8 years ago

update agrif+lim3

  • Property svn:keywords set to Id
File size: 6.3 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 in_out_manager   ! I/O manager
19   USE sbc_oce
20   USE sbccpl
21   USE iom              !
22   USE lbclnk
23#if defined key_iomput
24   USE xios
25#endif
26
27   USE daymod           ! calendar                         (day     routine)
28
29   USE sbcmod           ! surface boundary condition       (sbc     routine)
30   USE sbcrnf           ! surface boundary condition: runoff variables
31
32   USE eosbn2           ! equation of state                (eos_bn2 routine)
33
34   USE diawri           ! Standard run outputs             (dia_wri routine)
35   USE stpctl           ! time stepping control            (stp_ctl routine)
36   USE prtctl           ! Print control                    (prt_ctl routine)
37
38   USE timing           ! Timing           
39
40   USE bdy_par          ! clem: mandatory for LIM3
41#if defined key_bdy
42   USE bdydta           ! clem: mandatory for LIM3
43#endif
44
45#if defined key_agrif
46   USE agrif_oce, ONLY: lk_agrif_debug  !clem
47#endif
48   
49   IMPLICIT NONE
50   PRIVATE
51
52   PUBLIC   stp   ! called by opa.F90
53
54   !! * Substitutions
55#  include "domzgr_substitute.h90"
56#  include "zdfddm_substitute.h90"
57   !!----------------------------------------------------------------------
58   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
59   !! $Id$
60   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
61   !!----------------------------------------------------------------------
62CONTAINS
63
64#if defined key_agrif
65   SUBROUTINE stp( )
66      INTEGER             ::   kstp   ! ocean time-step index
67#else
68   SUBROUTINE stp( kstp )
69      INTEGER, INTENT(in) ::   kstp   ! ocean time-step index
70#endif
71      !!----------------------------------------------------------------------
72      !!                     ***  ROUTINE stp  ***
73      !!                     
74      !! ** Purpose : - Time stepping of SBC (surface boundary)
75      !!
76      !! ** Method  : -1- Update forcings and data 
77      !!              -2- Outputs and diagnostics
78      !!----------------------------------------------------------------------
79      INTEGER ::   indic    ! error indicator if < 0
80      !! ---------------------------------------------------------------------
81
82#if defined key_agrif
83      kstp = nit000 + Agrif_Nb_Step()
84      IF ( lk_agrif_debug ) THEN
85         IF ( Agrif_Root() .and. lwp) Write(*,*) '---'
86         IF (lwp) Write(*,*) 'Grid Number',Agrif_Fixed(),' time step ',kstp, 'int tstep',Agrif_NbStepint()
87      ENDIF
88
89      IF ( kstp == (nit000 + 1) ) lk_agrif_fstep = .FALSE.
90
91# if defined key_iomput
92      IF( Agrif_Nbstepint() == 0 )   CALL iom_swap( cxios_context )
93# endif   
94#endif   
95                             indic = 0                    ! although indic is not changed in stp_ctl
96                                                          ! need to keep the same interface
97      IF( kstp == nit000 )   CALL iom_init( cxios_context ) ! iom_put initialization (must be done after nemo_init for AGRIF+XIOS+OASIS)
98      IF( kstp /= nit000 )   CALL day( kstp )             ! Calendar (day was already called at nit000 in day_init)
99                             CALL iom_setkt( kstp - nit000 + 1, cxios_context )   ! tell iom we are at time step kstp
100
101      ! ==> clem: open boundaries is mandatory for LIM3 because ice BDY is not decoupled from 
102      !           the environment of ocean BDY. Therefore bdy is called in both OPA and SAS modules.
103      !           From SAS: ocean bdy data are wrong  (but we do not care) and ice bdy data are OK. 
104      !           This is not clean and should be changed in the future.
105#if defined key_bdy
106      IF( lk_bdy     )       CALL bdy_dta ( kstp, time_offset=+1 )   ! update dynamic & tracer data at open boundaries
107#endif
108      ! ==>
109                             CALL sbc    ( kstp )         ! Sea Boundary Condition (including sea-ice)
110
111                             CALL dia_wri( kstp )         ! ocean model: outputs
112
113#if defined key_agrif
114      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
115      ! AGRIF
116      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<     
117                             CALL Agrif_Integrate_ChildGrids( stp ) 
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', kstp )
127      ENDIF
128      IF( kstp == nit000   ) CALL iom_close( numror )     ! close input  ocean restart file (clem: not sure...)
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 == nitend .OR. indic < 0 ) THEN
137                             CALL iom_context_finalize( cxios_context ) ! needed for XIOS+AGRIF
138      ENDIF
139#endif
140      !
141      IF( nn_timing == 1 .AND.  kstp == nit000  )   CALL timing_reset
142      !
143   END SUBROUTINE stp
144
145   !!======================================================================
146END MODULE step
Note: See TracBrowser for help on using the repository browser.