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

source: NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/src/SAS/step.F90 @ 10756

Last change on this file since 10756 was 10756, checked in by acc, 5 years ago

Branch 2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps. Changes to OFF, SAO and SAS to enable SETTE testing. SAS/step.F90 is based on the yet-to-be-finalised version of OCE/step.F90 and so may need updating later

  • Property svn:keywords set to Id
File size: 8.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   PUBLIC   update_pointers ! called by nemo_init
50
51   !!----------------------------------------------------------------------
52   !! NEMO/SAS 4.0 , NEMO Consortium (2018)
53   !! $Id$
54   !! Software governed by the CeCILL license (see ./LICENSE)
55   !!----------------------------------------------------------------------
56CONTAINS
57
58#if defined key_agrif
59   RECURSIVE SUBROUTINE stp( )
60      INTEGER             ::   kstp   ! ocean time-step index
61#else
62   SUBROUTINE stp( kstp )
63      INTEGER, INTENT(in) ::   kstp   ! ocean time-step index
64#endif
65      !!----------------------------------------------------------------------
66      !!                     ***  ROUTINE stp  ***
67      !!                     
68      !! ** Purpose : - Time stepping of SBC (surface boundary)
69      !!
70      !! ** Method  : -1- Update forcings and data 
71      !!              -2- Outputs and diagnostics
72      !!----------------------------------------------------------------------
73      INTEGER ::   indic    ! error indicator if < 0
74      !! ---------------------------------------------------------------------
75
76#if defined key_agrif
77      kstp = nit000 + Agrif_Nb_Step()
78      IF ( lk_agrif_debug ) THEN
79         IF ( Agrif_Root() .and. lwp) Write(*,*) '---'
80         IF (lwp) Write(*,*) 'Grid Number',Agrif_Fixed(),' time step ',kstp, 'int tstep',Agrif_NbStepint()
81      ENDIF
82
83      IF ( kstp == (nit000 + 1) ) lk_agrif_fstep = .FALSE.
84
85# if defined key_iomput
86      IF( Agrif_Nbstepint() == 0 )   CALL iom_swap( cxios_context )
87# endif   
88#endif   
89                             indic = 0                    ! although indic is not changed in stp_ctl
90                                                          ! need to keep the same interface
91      IF( kstp == nit000 )   CALL iom_init( cxios_context ) ! iom_put initialization (must be done after nemo_init for AGRIF+XIOS+OASIS)
92      IF( kstp /= nit000 )   CALL day( kstp )             ! Calendar (day was already called at nit000 in day_init)
93                             CALL iom_setkt( kstp - nit000 + 1, cxios_context )   ! tell iom we are at time step kstp
94
95      ! ==> clem: open boundaries is mandatory for sea-ice because ice BDY is not decoupled from 
96      !           the environment of ocean BDY. Therefore bdy is called in both OPA and SAS modules.
97      !           From SAS: ocean bdy data are wrong  (but we do not care) and ice bdy data are OK. 
98      !           This is not clean and should be changed in the future.
99      IF( ln_bdy     )       CALL bdy_dta ( kstp, time_offset=+1 )   ! update dynamic & tracer data at open boundaries
100      ! ==>
101                             CALL sbc    ( kstp )         ! Sea Boundary Condition (including sea-ice)
102
103                             CALL dia_wri( kstp )         ! ocean model: outputs
104
105#if defined key_agrif
106      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
107      ! AGRIF
108      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<     
109                             CALL Agrif_Integrate_ChildGrids( stp ) 
110
111      IF( Agrif_NbStepint() == 0 ) THEN               ! AGRIF Update from zoom N to zoom 1 then to Parent
112#if defined key_si3
113                             CALL Agrif_Update_ice( )   ! update sea-ice
114#endif
115      ENDIF
116#endif
117      ! Swap time levels
118      IF( .NOT. (neuler == 0 .AND. kstp == nit000)  ) THEN
119         Nrhs = Nm1
120         Nm1 = Nnn
121         Nnn = Np1
122         Np1 = Nrhs
123      ENDIF
124      !
125      ! Update temporary pointers
126      CALL update_pointers()
127      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
128      ! Control
129      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
130                             CALL stp_ctl( kstp, indic )
131      IF( indic < 0  )  THEN
132                             CALL ctl_stop( 'step: indic < 0' )
133                             CALL dia_wri_state( 'output.abort' )
134      ENDIF
135      IF( kstp == nit000   ) CALL iom_close( numror )     ! close input  ocean restart file
136     
137      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
138      ! Coupled mode
139      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
140      IF( lk_oasis    )  CALL sbc_cpl_snd( kstp )     ! coupled mode : field exchanges if OASIS-coupled ice
141
142#if defined key_iomput
143      IF( kstp == nitrst ) THEN
144         IF(.NOT.lwxios) THEN
145            CALL iom_close( numrow )     
146         ELSE
147            CALL iom_context_finalize( cwxios_context )
148         ENDIF
149         lrst_oce = .FALSE.
150      ENDIF
151      IF( kstp == nitend .OR. indic < 0 ) THEN
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   SUBROUTINE update_pointers
161      !!----------------------------------------------------------------------
162      !!                     ***  ROUTINE update_pointers  ***
163      !!
164      !! ** Purpose :   Associate temporary pointer arrays.
165      !!                For IMMERSE development phase only - to be deleted
166      !!
167      !! ** Method  :
168      !!----------------------------------------------------------------------
169
170      ub => uu(:,:,:,Nm1); un => uu(:,:,:,Nnn); ua => uu(:,:,:,Np1)
171      vb => vv(:,:,:,Nm1); vn => vv(:,:,:,Nnn); va => vv(:,:,:,Np1)
172
173      e3t_b => e3t(:,:,:,Nm1); e3t_n => e3t(:,:,:,Nnn); e3t_a => e3t(:,:,:,Np1)
174      e3u_b => e3u(:,:,:,Nm1); e3u_n => e3u(:,:,:,Nnn); e3u_a => e3u(:,:,:,Np1)
175      e3v_b => e3v(:,:,:,Nm1); e3v_n => e3v(:,:,:,Nnn); e3v_a => e3v(:,:,:,Np1)
176
177      e3f_n => e3f(:,:,:)
178
179      e3w_b  => e3w (:,:,:,Nm1_2lev); e3w_n  => e3w (:,:,:,Nnn_2lev)
180      e3uw_b => e3uw(:,:,:,Nm1_2lev); e3uw_n => e3uw(:,:,:,Nnn_2lev)
181      e3vw_b => e3vw(:,:,:,Nm1_2lev); e3vw_n => e3vw(:,:,:,Nnn_2lev)
182
183   END SUBROUTINE update_pointers
184
185   !!======================================================================
186END MODULE step
Note: See TracBrowser for help on using the repository browser.