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 @ 10922

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

2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps : Convert IOM, LDF, OBS and SBC directories and compatibility changes elsewhere that these changes enforce. Changes pass SETTE and compare with original trunk results. Outstanding issues (currently with work-arounds) in DIU/step_diu.F90 and fld_bdy_interp within SBC/fldread.F90; proper soltions pending

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