Changeset 14053 for NEMO/trunk/src/SWE/stpctl.F90
- Timestamp:
- 2020-12-03T14:48:38+01:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/trunk/src/SWE/stpctl.F90
r13458 r14053 3 3 !! *** MODULE stpctl *** 4 4 !! Ocean run control : gross check of the ocean time stepping 5 !! *** Shallow Water Equation (SWE) case *** 6 !! ( No test on temperature and salinity ) 5 7 !!====================================================================== 6 !! History : OPA ! 1991-03 (G. Madec) Original code 7 !! 6.0 ! 1992-06 (M. Imbard) 8 !! 8.0 ! 1997-06 (A.M. Treguier) 9 !! NEMO 1.0 ! 2002-06 (G. Madec) F90: Free form and module 10 !! 2.0 ! 2009-07 (G. Madec) Add statistic for time-spliting 11 !! 3.7 ! 2016-09 (G. Madec) Remove solver 12 !! 4.0 ! 2017-04 (G. Madec) regroup global communications 8 !! History : SWE ! 2020-09 (A. Nasser, S. Techene ) OCE/stpctl adaptated to SWE 13 9 !!---------------------------------------------------------------------- 14 10 … … 21 17 USE zdf_oce , ONLY : ln_zad_Aimp ! ocean vertical physics variables 22 18 USE wet_dry, ONLY : ll_wd, ssh_ref ! reference depth for negative bathy 23 ! 19 ! 24 20 USE diawri ! Standard run outputs (dia_wri_state routine) 25 21 USE in_out_manager ! I/O manager 26 22 USE lbclnk ! ocean lateral boundary conditions (or mpp link) 27 23 USE lib_mpp ! distributed memory computing 28 !29 24 USE netcdf ! NetCDF library 25 30 26 IMPLICIT NONE 31 27 PRIVATE … … 35 31 INTEGER :: nrunid ! netcdf file id 36 32 INTEGER, DIMENSION(2) :: nvarid ! netcdf variable id 33 34 # include "domzgr_substitute.h90" 37 35 !!---------------------------------------------------------------------- 38 36 !! NEMO/OCE 4.0 , NEMO Consortium (2018) … … 49 47 !! 50 48 !! ** Method : - Save the time step in numstp 49 !! - Print it each 50 time steps 51 50 !! - Stop the run IF problem encountered by setting nstop > 0 52 !! Problems checked: negative sea surface height51 !! Problems checked: e3t0+ssh minimum smaller that 0 53 52 !! |U| maximum larger than 10 m/s 53 !! ( not for SWE : negative sea surface salinity ) 54 54 !! 55 55 !! ** Actions : "time.step" file = last ocean time-step … … 63 63 INTEGER :: idtime, istatus 64 64 INTEGER , DIMENSION(3) :: iareasum, iareamin, iareamax 65 INTEGER , DIMENSION(3, 2) :: iloc ! min/max loc indices65 INTEGER , DIMENSION(3,4) :: iloc ! min/max loc indices 66 66 REAL(wp) :: zzz ! local real 67 67 REAL(wp), DIMENSION(3) :: zmax, zmaxlocal … … 70 70 CHARACTER(len=20) :: clname 71 71 !!---------------------------------------------------------------------- 72 IF( nstop > 0 .AND. ngrdstop > -1 ) RETURN ! stpctl was already called by a child grid 73 ! 72 74 IF( nstop > 0 .AND. ngrdstop > -1 ) RETURN ! stpctl was already called by a child grid 73 75 ! … … 109 111 ! !== test of local extrema ==! 110 112 ! !== done by all processes at every time step ==! 111 !112 llmsk( 1:Nis1,:,:) = .FALSE. ! exclude halos from the checked region113 llmsk(Nie1: jpi,:,:) = .FALSE.114 llmsk(:, 1:Njs1,:) = .FALSE.115 llmsk(:,Nje1: jpj,:) = .FALSE.116 ! 113 zmax(1) = MINVAL( e3t_0(:,:,1)+ssh(:,:,Kmm) ) ! e3t_Kmm min 114 llmsk(:,:,:) = umask(:,:,:) == 1._wp 115 zmax(2) = MAXVAL( ABS( uu(:,:,:,Kmm) ), mask = llmsk ) ! velocity max (zonal only) 116 zmax(3) = REAL( nstop , wp ) ! stop indicator 117 ! !== get global extrema ==! 118 ! !== done by all processes if writting run.stat ==! 117 119 llmsk(Nis0:Nie0,Njs0:Nje0,1) = tmask(Nis0:Nie0,Njs0:Nje0,1) == 1._wp ! define only the inner domain 118 120 zmax(1) = MAXVAL( -e3t(:,:,1,Kmm) ), mask = llmsk(:,:,1) ) ! ssh max … … 131 133 IF( ll_wrtruns ) THEN 132 134 WRITE(numrun,9500) kt, zmax(1), zmax(2) 133 istatus = NF90_PUT_VAR( nrunid, nvarid(1), (/ -zmax(1)/), (/kt/), (/1/) )134 istatus = NF90_PUT_VAR( nrunid, nvarid(2), (/ 135 istatus = NF90_PUT_VAR( nrunid, nvarid(1), (/ zmax(1)/), (/kt/), (/1/) ) 136 istatus = NF90_PUT_VAR( nrunid, nvarid(2), (/ zmax(2)/), (/kt/), (/1/) ) 135 137 IF( kt == nitend ) istatus = NF90_CLOSE(nrunid) 136 END 138 ENDIF 137 139 ! !== error handling ==! 138 140 ! !== done by all processes at every time step ==! 139 141 ! 140 IF( zmax(1) > 0._wp .OR. & ! negative sea surface height 141 & zmax(2) > 10._wp .OR. & ! too large velocity ( > 10 m/s) 142 !!SWE specific : start 143 IF( zmax(1) <= 0._wp .OR. & ! negative e3t_Kmm 144 & zmax(2) > 10._wp .OR. & ! too large velocity ( > 10 m/s) 142 145 & ISNAN( zmax(1) + zmax(2) ) .OR. & ! NaN encounter in the tests 143 146 & ABS( zmax(1) + zmax(2) ) > HUGE(1._wp) ) THEN ! Infinity encounter in the tests … … 148 151 IF( lwm .AND. kt /= nitend ) istatus = NF90_CLOSE(nrunid) 149 152 ! get global loc on the min/max 150 llmsk(Nis0:Nie0,Njs0:Nje0,1) = tmask(Nis0:Nie0,Njs0:Nje0,1) == 1._wp ! define only the inner domain 151 CALL mpp_maxloc( 'stpctl', -e3t(:,:,1,Kmm) , llmsk(:,:,1), zzz, iloc(1:2,1) ) ! mpp_maxloc ok if mask = F 152 llmsk(Nis0:Nie0,Njs0:Nje0,:) = umask(Nis0:Nie0,Njs0:Nje0,:) == 1._wp ! define only the inner domain 153 CALL mpp_maxloc( 'stpctl', ABS(uu(:,:,:,Kmm)), llmsk(:,:,:), zzz, iloc(1:3,2) ) 153 CALL mpp_minloc( 'stpctl', e3t_0(:,:,1) + ssh(:,:,Kmm), ssmask(:,: ), zzz, iloc(1:2,1) ) ! mpp_maxloc ok if mask = F 154 CALL mpp_maxloc( 'stpctl', ABS( uu(:,:,:,Kmm)) , umask(:,:,:), zzz, iloc(1:3,2) ) 154 155 ! find which subdomain has the max. 155 156 iareamin(:) = jpnij+1 ; iareamax(:) = 0 ; iareasum(:) = 0 … … 164 165 ELSE ! find local min and max locations: 165 166 ! if we are here, this means that the subdomain contains some oce points -> no need to test the mask used in maxloc 166 llmsk(Nis0:Nie0,Njs0:Nje0,1) = tmask(Nis0:Nie0,Njs0:Nje0,1) == 1._wp ! define only the inner domain 167 iloc(1:2,1) = MAXLOC( -e3t(:,:,1,Kmm) , mask = llmsk(:,:,1) ) 168 llmsk(Nis0:Nie0,Njs0:Nje0,:) = umask(Nis0:Nie0,Njs0:Nje0,:) == 1._wp ! define only the inner domain 169 iloc(1:3,2) = MAXLOC( ABS(uu(:,:,:,Kmm)), mask = llmsk(:,:,:) ) 170 DO ji = 1, 2 ! local domain indices ==> global domain indices, excluding halos 171 iloc(1:2,ji) = (/ mig0(iloc(1,ji)), mjg0(iloc(2,ji)) /) 172 END DO 167 iloc(1:2,1) = MINLOC( e3t_0(:,:,1) + ssh(:,:,Kmm), mask = ssmask(:,: ) == 1._wp ) + (/ nimpp - 1, njmpp - 1 /) 168 iloc(1:3,2) = MAXLOC( ABS( uu(:,:,:, Kmm)), mask = umask(:,:,:) == 1._wp ) + (/ nimpp - 1, njmpp - 1, 0 /) 173 169 iareamin(:) = narea ; iareamax(:) = narea ; iareasum(:) = 1 ! this is local information 174 170 ENDIF 175 171 ! 176 WRITE(ctmp1,*) ' stp_ctl: |ssh| > 20 m or |U| > 10 m/s or S <= 0 or S >= 100or NaN encounter in the tests'177 CALL wrt_line( ctmp2, kt, ' |e3t| min', -zmax(1), iloc(:,1), iareasum(1), iareamin(1), iareamax(1) )178 CALL wrt_line( ctmp3, kt, '|U| max' , zmax(2), iloc(:,2), iareasum(2), iareamin(2), iareamax(2) )172 WRITE(ctmp1,*) ' stp_ctl: e3t0+ssh < 0 m or |U| > 10 m/s or NaN encounter in the tests' 173 CALL wrt_line( ctmp2, kt, 'e3t0+ssh min', zmax(1), iloc(:,1), iareasum(1), iareamin(1), iareamax(1) ) 174 CALL wrt_line( ctmp3, kt, '|U| max' , zmax(2), iloc(:,2), iareasum(2), iareamin(2), iareamax(2) ) 179 175 IF( Agrif_Root() ) THEN 180 176 WRITE(ctmp6,*) ' ===> output of last computed fields in output.abort* files' … … 194 190 ! 195 191 ENDIF 192 !!SWE specific : end 196 193 ! 197 194 IF( nstop > 0 ) THEN ! an error was detected and we did not abort yet... … … 200 197 ENDIF 201 198 ! 202 9500 FORMAT(' it :', i8, ' |ssh|_max: ', D23.16, ' |U|_max: ', D23.16,' S_min: ', D23.16,' S_max: ', D23.16)199 9500 FORMAT(' it :', i8, ' e3t_min: ', D23.16, ' |U|_max: ', D23.16) 203 200 ! 204 201 END SUBROUTINE stp_ctl
Note: See TracChangeset
for help on using the changeset viewer.