[3331] | 1 | MODULE 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) |
---|
[9267] | 13 | !! 4.0 ! 2017-04 (G. Madec) regroup global communications |
---|
[3331] | 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 |
---|
[9267] | 21 | USE ice , ONLY : vt_i, u_ice, tm_i |
---|
| 22 | ! |
---|
[3331] | 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 | |
---|
[9441] | 27 | USE netcdf ! NetCDF library |
---|
[3331] | 28 | IMPLICIT NONE |
---|
| 29 | PRIVATE |
---|
| 30 | |
---|
| 31 | PUBLIC stp_ctl ! routine called by step.F90 |
---|
[9441] | 32 | |
---|
| 33 | INTEGER :: idrun, idtime, idssh, idu, ids, istatus |
---|
[3331] | 34 | !!---------------------------------------------------------------------- |
---|
[9598] | 35 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[5215] | 36 | !! $Id$ |
---|
[9598] | 37 | !! Software governed by the CeCILL licence (./LICENSE) |
---|
[3331] | 38 | !!---------------------------------------------------------------------- |
---|
| 39 | |
---|
| 40 | CONTAINS |
---|
| 41 | |
---|
| 42 | SUBROUTINE stp_ctl( kt, kindic ) |
---|
| 43 | !!---------------------------------------------------------------------- |
---|
| 44 | !! *** ROUTINE stp_ctl *** |
---|
| 45 | !! |
---|
| 46 | !! ** Purpose : Control the run |
---|
| 47 | !! |
---|
| 48 | !! ** Method : - Save the time step in numstp |
---|
| 49 | !! - Print it each 50 time steps |
---|
| 50 | !! |
---|
[9267] | 51 | !! ** Actions : "time.step" file = last ocean time-step |
---|
| 52 | !! "run.stat" file = run statistics |
---|
[3331] | 53 | !! |
---|
| 54 | !!---------------------------------------------------------------------- |
---|
[9267] | 55 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 56 | INTEGER, INTENT( inout ) :: kindic ! indicator of solver convergence |
---|
| 57 | !! |
---|
| 58 | REAL(wp), DIMENSION(3) :: zmax |
---|
[3331] | 59 | !!---------------------------------------------------------------------- |
---|
| 60 | |
---|
| 61 | IF( kt == nit000 .AND. lwp ) THEN |
---|
| 62 | WRITE(numout,*) |
---|
| 63 | WRITE(numout,*) 'stp_ctl : time-stepping control' |
---|
| 64 | WRITE(numout,*) '~~~~~~~' |
---|
[9267] | 65 | ! ! open time.step file |
---|
[3331] | 66 | CALL ctl_opn( numstp, 'time.step', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) |
---|
[9267] | 67 | ! ! open run.stat file |
---|
| 68 | CALL ctl_opn( numrun, 'run.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) |
---|
[9441] | 69 | |
---|
| 70 | IF( lwm ) THEN |
---|
| 71 | istatus = NF90_CREATE( 'run.stat.nc', NF90_CLOBBER, idrun ) |
---|
[9510] | 72 | istatus = NF90_DEF_DIM( idrun, 'time' , NF90_UNLIMITED, idtime ) |
---|
| 73 | istatus = NF90_DEF_VAR( idrun, 'vt_i_max' , NF90_DOUBLE, (/ idtime /), idssh ) |
---|
| 74 | istatus = NF90_DEF_VAR( idrun, 'abs_u_max', NF90_DOUBLE, (/ idtime /), idu ) |
---|
| 75 | istatus = NF90_DEF_VAR( idrun, 'tm_i_min' , NF90_DOUBLE, (/ idtime /), ids ) |
---|
[9441] | 76 | istatus = NF90_ENDDEF(idrun) |
---|
| 77 | ENDIF |
---|
| 78 | |
---|
[3331] | 79 | ENDIF |
---|
[9267] | 80 | ! |
---|
| 81 | IF(lwp) THEN !== current time step ==! ("time.step" file) |
---|
| 82 | WRITE ( numstp, '(1x, i8)' ) kt |
---|
| 83 | REWIND( numstp ) |
---|
| 84 | ENDIF |
---|
| 85 | ! !== test of extrema ==! |
---|
| 86 | zmax(1) = MAXVAL( vt_i (:,:) ) ! max ice thickness |
---|
| 87 | zmax(2) = MAXVAL( ABS( u_ice(:,:) ) ) ! max ice velocity (zonal only) |
---|
| 88 | zmax(3) = MAXVAL( -tm_i (:,:)+273.15_wp , mask = ssmask(:,:) == 1._wp ) ! min ice temperature |
---|
| 89 | ! |
---|
| 90 | IF( lk_mpp ) THEN |
---|
| 91 | CALL mpp_max_multiple( zmax(:), 3 ) ! max over the global domain |
---|
| 92 | ENDIF |
---|
| 93 | ! |
---|
| 94 | IF( MOD( kt, nwrite ) == 1 .AND. lwp ) THEN |
---|
| 95 | WRITE(numout,*) ' ==>> time-step= ', kt, ' vt_i max: ', zmax(1), ' |u_ice| max: ', zmax(2), ' tm_i min: ', -zmax(3) |
---|
| 96 | ENDIF |
---|
[3331] | 97 | |
---|
[9267] | 98 | ! !== run statistics ==! ("run.stat" file) |
---|
[9441] | 99 | IF(lwp) WRITE(numrun,9400) kt, zmax(1), zmax(2), - zmax(3) |
---|
| 100 | IF( lwm ) THEN |
---|
| 101 | istatus = NF90_PUT_VAR( idrun, idssh, (/ zmax(1)/), (/kt/), (/1/) ) |
---|
| 102 | istatus = NF90_PUT_VAR( idrun, idu, (/ zmax(2)/), (/kt/), (/1/) ) |
---|
| 103 | istatus = NF90_PUT_VAR( idrun, ids, (/-zmax(3)/), (/kt/), (/1/) ) |
---|
| 104 | IF( MOD( kt , 100 ) == 0 ) istatus = NF90_SYNC(idrun) |
---|
| 105 | IF( kt == nitend ) istatus = NF90_CLOSE(idrun) |
---|
| 106 | END IF |
---|
[9267] | 107 | ! |
---|
[9510] | 108 | 9400 FORMAT(' it :', i8, ' vt_i_max: ', D23.16, ' |u|_max: ', D23.16,' tm_i_min: ', D23.16) |
---|
[9267] | 109 | ! |
---|
[3331] | 110 | END SUBROUTINE stp_ctl |
---|
| 111 | |
---|
| 112 | !!====================================================================== |
---|
| 113 | END MODULE stpctl |
---|