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_merge_2016/NEMOGCM/NEMO/SAS_SRC – NEMO

source: branches/2016/dev_merge_2016/NEMOGCM/NEMO/SAS_SRC/step.F90 @ 7421

Last change on this file since 7421 was 7421, checked in by flavoni, 8 years ago

#1811 merge dev_CNRS_MERATOR_2016 with dev_merge_2016 branch

  • 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 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 bdy_par          ! clem: mandatory for LIM3
27   USE bdydta           ! clem: mandatory for LIM3
28   USE stpctl           ! time stepping control            (stp_ctl routine)
29   !
30   USE in_out_manager   ! I/O manager
31   USE prtctl           ! Print control                    (prt_ctl routine)
32   USE iom              !
33   USE lbclnk           !
34   USE timing           ! Timing           
35#if defined key_iomput
36   USE xios
37#endif
38
39#if defined key_agrif
40   USE agrif_oce, ONLY: lk_agrif_debug  !clem
41#endif
42   
43   IMPLICIT NONE
44   PRIVATE
45
46   PUBLIC   stp   ! called by nemogcm.F90
47
48   !!----------------------------------------------------------------------
49   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
50   !! $Id$
51   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
52   !!----------------------------------------------------------------------
53CONTAINS
54
55#if defined key_agrif
56   SUBROUTINE stp( )
57      INTEGER             ::   kstp   ! ocean time-step index
58#else
59   SUBROUTINE stp( kstp )
60      INTEGER, INTENT(in) ::   kstp   ! ocean time-step index
61#endif
62      !!----------------------------------------------------------------------
63      !!                     ***  ROUTINE stp  ***
64      !!                     
65      !! ** Purpose : - Time stepping of SBC (surface boundary)
66      !!
67      !! ** Method  : -1- Update forcings and data 
68      !!              -2- Outputs and diagnostics
69      !!----------------------------------------------------------------------
70      INTEGER ::   indic    ! error indicator if < 0
71      !! ---------------------------------------------------------------------
72
73#if defined key_agrif
74      kstp = nit000 + Agrif_Nb_Step()
75      IF ( lk_agrif_debug ) THEN
76         IF ( Agrif_Root() .and. lwp) Write(*,*) '---'
77         IF (lwp) Write(*,*) 'Grid Number',Agrif_Fixed(),' time step ',kstp, 'int tstep',Agrif_NbStepint()
78      ENDIF
79
80      IF ( kstp == (nit000 + 1) ) lk_agrif_fstep = .FALSE.
81
82# if defined key_iomput
83      IF( Agrif_Nbstepint() == 0 )   CALL iom_swap( cxios_context )
84# endif   
85#endif   
86                             indic = 0                    ! although indic is not changed in stp_ctl
87                                                          ! need to keep the same interface
88      IF( kstp == nit000 )   CALL iom_init( cxios_context ) ! iom_put initialization (must be done after nemo_init for AGRIF+XIOS+OASIS)
89      IF( kstp /= nit000 )   CALL day( kstp )             ! Calendar (day was already called at nit000 in day_init)
90                             CALL iom_setkt( kstp - nit000 + 1, cxios_context )   ! tell iom we are at time step kstp
91
92      ! ==> clem: open boundaries is mandatory for LIM3 because ice BDY is not decoupled from 
93      !           the environment of ocean BDY. Therefore bdy is called in both OPA and SAS modules.
94      !           From SAS: ocean bdy data are wrong  (but we do not care) and ice bdy data are OK. 
95      !           This is not clean and should be changed in the future.
96      IF( ln_bdy     )       CALL bdy_dta ( kstp, time_offset=+1 )   ! update dynamic & tracer data at open boundaries
97      ! ==>
98                             CALL sbc    ( kstp )         ! Sea Boundary Condition (including sea-ice)
99
100                             CALL dia_wri( kstp )         ! ocean model: outputs
101
102#if defined key_agrif
103      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
104      ! AGRIF
105      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<     
106                             CALL Agrif_Integrate_ChildGrids( stp ) 
107#endif
108                             
109      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
110      ! Control
111      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
112                             CALL stp_ctl( kstp, indic )
113      IF( indic < 0  )  THEN
114                             CALL ctl_stop( 'step: indic < 0' )
115                             CALL dia_wri_state( 'output.abort', kstp )
116      ENDIF
117      IF( kstp == nit000   ) CALL iom_close( numror )     ! close input  ocean restart file (clem: not sure...)
118     
119      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
120      ! Coupled mode
121      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
122      IF( lk_oasis    )  CALL sbc_cpl_snd( kstp )     ! coupled mode : field exchanges if OASIS-coupled ice
123
124#if defined key_iomput
125      IF( kstp == nitend .OR. indic < 0 ) THEN
126                             CALL iom_context_finalize( cxios_context ) ! needed for XIOS+AGRIF
127      ENDIF
128#endif
129      !
130      IF( nn_timing == 1 .AND.  kstp == nit000  )   CALL timing_reset
131      !
132   END SUBROUTINE stp
133
134   !!======================================================================
135END MODULE step
Note: See TracBrowser for help on using the repository browser.