source: trunk/NEMOGCM/NEMO/SAS_SRC/step.F90 @ 5510

Last change on this file since 5510 was 5510, checked in by clem, 6 years ago

enable the use of BDY with ice (LIM3) in case of SAS. Calls to bdy had to be added in SAS eventhough it is not very clean. This is something that needs to be rethought in the future but it does the job for now

  • Property svn:keywords set to Id
File size: 5.2 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   IMPLICIT NONE
46   PRIVATE
47
48   PUBLIC   stp   ! called by opa.F90
49
50   !! * Substitutions
51#  include "domzgr_substitute.h90"
52#  include "zdfddm_substitute.h90"
53   !!----------------------------------------------------------------------
54   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
55   !! $Id$
56   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
57   !!----------------------------------------------------------------------
58CONTAINS
59
60#if defined key_agrif
61   SUBROUTINE stp( )
62      INTEGER             ::   kstp   ! ocean time-step index
63#else
64   SUBROUTINE stp( kstp )
65      INTEGER, INTENT(in) ::   kstp   ! ocean time-step index
66#endif
67      !!----------------------------------------------------------------------
68      !!                     ***  ROUTINE stp  ***
69      !!                     
70      !! ** Purpose : - Time stepping of SBC (surface boundary)
71      !!
72      !! ** Method  : -1- Update forcings and data 
73      !!              -2- Outputs and diagnostics
74      !!----------------------------------------------------------------------
75      INTEGER ::   indic    ! error indicator if < 0
76      !! ---------------------------------------------------------------------
77
78#if defined key_agrif
79      kstp = nit000 + Agrif_Nb_Step()
80# if defined key_iomput
81      IF( Agrif_Nbstepint() == 0 )   CALL iom_swap( cxios_context )
82# endif   
83#endif   
84      IF( kstp == nit000 )   CALL iom_init( cxios_context ) ! iom_put initialization (must be done after nemo_init for AGRIF+XIOS+OASIS)
85      IF( kstp /= nit000 )   CALL day( kstp )             ! Calendar (day was already called at nit000 in day_init)
86                             CALL iom_setkt( kstp - nit000 + 1, cxios_context )   ! tell iom we are at time step kstp
87
88      ! ==> clem: open boundaries is mandatory for LIM3 because ice BDY is not decoupled from 
89      !           the environment of ocean BDY. Therefore bdy is called in both OPA and SAS modules.
90      !           From SAS: ocean bdy data are wrong  (but we do not care) and ice bdy data are OK. 
91      !           This is not clean and should be changed in the future.
92#if defined key_bdy
93      IF( lk_bdy     )       CALL bdy_dta ( kstp, time_offset=+1 )   ! update dynamic & tracer data at open boundaries
94#endif
95      ! ==>
96                             CALL sbc    ( kstp )         ! Sea Boundary Condition (including sea-ice)
97
98                             CALL dia_wri( kstp )         ! ocean model: outputs
99
100                             indic = 0                    ! although indic is not changed in stp_ctl
101                                                          ! need to keep the same interface
102                             CALL stp_ctl( kstp, indic )
103      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
104      ! Coupled mode
105      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
106      IF( lk_oasis    )  CALL sbc_cpl_snd( kstp )     ! coupled mode : field exchanges if OASIS-coupled ice
107
108#if defined key_iomput
109      IF( kstp == nitend .OR. indic < 0 ) THEN
110                             CALL iom_context_finalize( cxios_context ) ! needed for XIOS+AGRIF
111      ENDIF
112#endif
113      !
114      IF( nn_timing == 1 .AND.  kstp == nit000  )   CALL timing_reset
115      !
116   END SUBROUTINE stp
117
118   !!======================================================================
119END MODULE step
Note: See TracBrowser for help on using the repository browser.