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.
stpctl.F90 in NEMO/trunk/src/SAS – NEMO

source: NEMO/trunk/src/SAS/stpctl.F90 @ 12377

Last change on this file since 12377 was 12377, checked in by acc, 4 years ago

The big one. Merging all 2019 developments from the option 1 branch back onto the trunk.

This changeset reproduces 2019/dev_r11943_MERGE_2019 on the trunk using a 2-URL merge
onto a working copy of the trunk. I.e.:

svn merge --ignore-ancestry \

svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/trunk \
svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/branches/2019/dev_r11943_MERGE_2019 ./

The --ignore-ancestry flag avoids problems that may otherwise arise from the fact that
the merge history been trunk and branch may have been applied in a different order but
care has been taken before this step to ensure that all applicable fixes and updates
are present in the merge branch.

The trunk state just before this step has been branched to releases/release-4.0-HEAD
and that branch has been immediately tagged as releases/release-4.0.2. Any fixes
or additions in response to tickets on 4.0, 4.0.1 or 4.0.2 should be done on
releases/release-4.0-HEAD. From now on future 'point' releases (e.g. 4.0.2) will
remain unchanged with periodic releases as needs demand. Note release-4.0-HEAD is a
transitional naming convention. Future full releases, say 4.2, will have a release-4.2
branch which fulfills this role and the first point release (e.g. 4.2.0) will be made
immediately following the release branch creation.

2020 developments can be started from any trunk revision later than this one.

  • Property svn:keywords set to Id
File size: 5.7 KB
Line 
1MODULE stpctl
2   !!======================================================================
3   !!                       ***  MODULE  stpctl  ***
4   !! Ocean run control :  gross check of the ocean time stepping
5   !!                      version for standalone surface scheme
6   !!======================================================================
7   !! History :  OPA  ! 1991-03  (G. Madec) Original code
8   !!            6.0  ! 1992-06  (M. Imbard)
9   !!            8.0  ! 1997-06  (A.M. Treguier)
10   !!   NEMO     1.0  ! 2002-06  (G. Madec)  F90: Free form and module
11   !!            2.0  ! 2009-07  (G. Madec)  Add statistic for time-spliting
12   !!            3.5  ! 2012-03  (S. Alderson)
13   !!            4.0  ! 2017-04  (G. Madec)  regroup global communications
14   !!----------------------------------------------------------------------
15
16   !!----------------------------------------------------------------------
17   !!   stp_ctl      : Control the run
18   !!----------------------------------------------------------------------
19   USE oce             ! ocean dynamics and tracers variables
20   USE dom_oce         ! ocean space and time domain variables
21   USE ice      , ONLY : vt_i, u_ice, tm_i
22   !
23   USE in_out_manager  ! I/O manager
24   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
25   USE lib_mpp         ! distributed memory computing
26
27   USE netcdf          ! NetCDF library
28   IMPLICIT NONE
29   PRIVATE
30
31   PUBLIC stp_ctl           ! routine called by step.F90
32
33   INTEGER  ::   idrun, idtime, idssh, idu, ids, istatus
34   LOGICAL  ::   lsomeoce
35   !!----------------------------------------------------------------------
36   !! NEMO/SAS 4.0 , NEMO Consortium (2018)
37   !! $Id$
38   !! Software governed by the CeCILL license (see ./LICENSE)
39   !!----------------------------------------------------------------------
40
41CONTAINS
42
43   SUBROUTINE stp_ctl( kt, kindic )
44      !!----------------------------------------------------------------------
45      !!                    ***  ROUTINE stp_ctl  ***
46      !!                     
47      !! ** Purpose :   Control the run
48      !!
49      !! ** Method  : - Save the time step in numstp
50      !!              - Print it each 50 time steps
51      !!
52      !! ** Actions :   "time.step" file = last ocean time-step
53      !!                "run.stat"  file = run statistics
54      !!               
55      !!----------------------------------------------------------------------
56      INTEGER, INTENT( in    ) ::   kt       ! ocean time-step index
57      INTEGER, INTENT( inout ) ::   kindic   ! indicator of solver convergence
58      !!
59      REAL(wp), DIMENSION(3) ::   zmax
60      LOGICAL                ::   ll_wrtstp, ll_colruns, ll_wrtruns
61      CHARACTER(len=20) :: clname
62      !!----------------------------------------------------------------------
63      !
64      ll_wrtstp  = ( MOD( kt, sn_cfctl%ptimincr ) == 0 ) .OR. ( kt == nitend )
65      ll_colruns = ll_wrtstp .AND. ( sn_cfctl%l_runstat )
66      ll_wrtruns = ll_colruns .AND. lwm
67      IF( kt == nit000 .AND. lwp ) THEN
68         WRITE(numout,*)
69         WRITE(numout,*) 'stp_ctl : time-stepping control'
70         WRITE(numout,*) '~~~~~~~'
71         !                                ! open time.step file
72         IF( lwm ) CALL ctl_opn( numstp, 'time.step', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )
73         !                                ! open run.stat file(s) at start whatever
74         !                                ! the value of sn_cfctl%ptimincr
75         IF( lwm .AND. ( sn_cfctl%l_runstat ) ) THEN
76            CALL ctl_opn( numrun, 'run.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )
77            clname = 'run.stat.nc'
78            IF( .NOT. Agrif_Root() )   clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname)
79            istatus = NF90_CREATE( 'run.stat.nc', NF90_CLOBBER, idrun )
80            istatus = NF90_DEF_DIM( idrun, 'time'     , NF90_UNLIMITED, idtime )
81            istatus = NF90_DEF_VAR( idrun, 'vt_i_max' , NF90_DOUBLE, (/ idtime /), idssh )
82            istatus = NF90_DEF_VAR( idrun, 'abs_u_max', NF90_DOUBLE, (/ idtime /), idu )
83            istatus = NF90_DEF_VAR( idrun, 'tm_i_min' , NF90_DOUBLE, (/ idtime /), ids )
84            istatus = NF90_ENDDEF(idrun)
85         ENDIF
86      ENDIF
87      IF( kt == nit000 )   lsomeoce = COUNT( ssmask(:,:) == 1._wp ) > 0
88      !
89      IF(lwm .AND. ll_wrtstp) THEN        !==  current time step  ==!   ("time.step" file)
90         WRITE ( numstp, '(1x, i8)' )   kt
91         REWIND( numstp )
92      ENDIF
93      !                                   !==  test of extrema  ==!
94      IF( ll_colruns ) THEN
95         zmax(1) = MAXVAL(      vt_i (:,:) )                                           ! max ice thickness
96         zmax(2) = MAXVAL( ABS( u_ice(:,:) ) )                                         ! max ice velocity (zonal only)
97         zmax(3) = MAXVAL(     -tm_i (:,:)+273.15_wp , mask = ssmask(:,:) == 1._wp )   ! min ice temperature
98         CALL mpp_max( "stpctl", zmax )                                   ! max over the global domain
99      END IF
100      !                                            !==  run statistics  ==!   ("run.stat" file)
101      IF( ll_wrtruns ) THEN
102         WRITE(numrun,9500) kt, zmax(1), zmax(2), - zmax(3)
103         istatus = NF90_PUT_VAR( idrun, idssh, (/ zmax(1)/), (/kt/), (/1/) )
104         istatus = NF90_PUT_VAR( idrun,   idu, (/ zmax(2)/), (/kt/), (/1/) )
105         istatus = NF90_PUT_VAR( idrun,   ids, (/-zmax(3)/), (/kt/), (/1/) )
106         IF( MOD( kt , 100 ) == 0 ) istatus = NF90_SYNC(idrun)
107         IF( kt == nitend         ) istatus = NF90_CLOSE(idrun)
108      END IF
109      !
1109500  FORMAT(' it :', i8, '    vt_i_max: ', D23.16, ' |u|_max: ', D23.16,' tm_i_min: ', D23.16)
111      !
112   END SUBROUTINE stp_ctl
113
114   !!======================================================================
115END MODULE stpctl
Note: See TracBrowser for help on using the repository browser.