Changeset 14318 for NEMO/trunk/src/SAS
- Timestamp:
- 2021-01-20T11:49:35+01:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/trunk/src/SAS/stpctl.F90
r13616 r14318 34 34 PUBLIC stp_ctl ! routine called by step.F90 35 35 36 INTEGER :: nrunid ! netcdf file id 37 INTEGER, DIMENSION(3) :: nvarid ! netcdf variable id 36 INTEGER, PARAMETER :: jpvar = 3 37 INTEGER :: nrunid ! netcdf file id 38 INTEGER, DIMENSION(jpvar) :: nvarid ! netcdf variable id 38 39 !!---------------------------------------------------------------------- 39 40 !! NEMO/SAS 4.0 , NEMO Consortium (2018) … … 46 47 !!---------------------------------------------------------------------- 47 48 !! *** ROUTINE stp_ctl *** 48 !! 49 !! 49 50 !! ** Purpose : Control the run 50 51 !! … … 62 63 INTEGER, INTENT(in ) :: Kmm ! ocean time level index 63 64 !! 65 INTEGER, PARAMETER :: jptst = 3 64 66 INTEGER :: ji ! dummy loop indices 65 67 INTEGER :: idtime, istatus 66 INTEGER , DIMENSION( 4):: iareasum, iareamin, iareamax67 INTEGER , DIMENSION(3, 3):: iloc ! min/max loc indices68 INTEGER , DIMENSION(jptst) :: iareasum, iareamin, iareamax 69 INTEGER , DIMENSION(3,jptst) :: iloc ! min/max loc indices 68 70 REAL(wp) :: zzz ! local real 69 REAL(wp), DIMENSION(4) :: zmax, zmaxlocal 71 REAL(wp), DIMENSION(jpvar+1) :: zmax 72 REAL(wp), DIMENSION(jptst) :: zmaxlocal 70 73 LOGICAL :: ll_wrtstp, ll_colruns, ll_wrtruns, ll_0oce 71 74 LOGICAL, DIMENSION(jpi,jpj) :: llmsk … … 75 78 ! 76 79 ll_wrtstp = ( MOD( kt-nit000, sn_cfctl%ptimincr ) == 0 ) .OR. ( kt == nitend ) 77 ll_colruns = ll_wrtstp .AND. sn_cfctl%l_runstat .AND. jpnij > 1 80 ll_colruns = ll_wrtstp .AND. sn_cfctl%l_runstat .AND. jpnij > 1 78 81 ll_wrtruns = ( ll_colruns .OR. jpnij == 1 ) .AND. lwm 79 82 ! … … 107 110 istatus = NF90_ENDDEF(nrunid) 108 111 ENDIF 109 ! 112 ! 110 113 ENDIF 111 114 ! … … 131 134 zmax(2) = MAXVAL( ABS( u_ice(:,:) ) , mask = llmsk ) ! max ice velocity (zonal only) 132 135 zmax(3) = MAXVAL( -tm_i (:,:) + rt0, mask = llmsk ) ! min ice temperature (in degC) 133 zmax( 4) = REAL( nstop, wp )! stop indicator136 zmax(jpvar+1) = REAL( nstop, wp ) ! stop indicator 134 137 ! 135 138 ! !== get global extrema ==! 136 139 ! !== done by all processes if writting run.stat ==! 137 140 IF( ll_colruns ) THEN 138 zmaxlocal(:) = zmax( :)141 zmaxlocal(:) = zmax(1:jptst) 139 142 CALL mpp_max( "stpctl", zmax ) ! max over the global domain: ok even of ll_0oce = .true. 140 nstop = NINT( zmax( 4) )! update nstop indicator (now sheared among all local domains)143 nstop = NINT( zmax(jpvar+1) ) ! update nstop indicator (now sheared among all local domains) 141 144 ELSE 142 145 ! if no ocean point: MAXVAL returns -HUGE => we must overwrite this value to avoid error handling bellow. 143 IF( ll_0oce ) zmax(1: 3) = 0._wp! default "valid" values...146 IF( ll_0oce ) zmax(1:jptst) = 0._wp ! default "valid" values... 144 147 ENDIF 145 148 ! … … 150 153 ! !== done only by 1st subdomain at writting timestep ==! 151 154 IF( ll_wrtruns ) THEN 152 WRITE(numrun,9500) kt, zmax(1 ), zmax(2), zmax(3)153 DO ji = 1, 3155 WRITE(numrun,9500) kt, zmax(1:jptst) 156 DO ji = 1, jpvar 154 157 istatus = NF90_PUT_VAR( nrunid, nvarid(ji), (/zmax(ji)/), (/kt/), (/1/) ) 155 158 END DO … … 159 162 ! !== done by all processes at every time step ==! 160 163 ! 161 IF( zmax(1) > 100._wp .OR. & ! too large ice thickness maximum ( > 100 m)162 & zmax(2) > 10._wp .OR. & ! too large ice velocity ( > 10 m/s)163 & zmax(3) < -101._wp .OR. & ! too cold ice temperature ( < -100 degC)164 & ISNAN( zmax(1) + zmax(2) + zmax(3) ) .OR. & ! NaN encounter in the tests165 & ABS( zmax(1) + zmax(2) + zmax(3) ) > HUGE(1._wp) ) THEN ! Infinity encounter in the tests164 IF( zmax(1) > 100._wp .OR. & ! too large ice thickness maximum ( > 100 m) 165 & zmax(2) > 10._wp .OR. & ! too large ice velocity ( > 10 m/s) 166 & zmax(3) < -101._wp .OR. & ! too cold ice temperature ( < -100 degC) 167 & ISNAN( SUM(zmax(1:jptst)) ) .OR. & ! NaN encounter in the tests 168 & ABS( SUM(zmax(1:jptst)) ) > HUGE(1._wp) ) THEN ! Infinity encounter in the tests 166 169 ! 167 170 iloc(:,:) = 0 … … 175 178 ! find which subdomain has the max. 176 179 iareamin(:) = jpnij+1 ; iareamax(:) = 0 ; iareasum(:) = 0 177 DO ji = 1, 4180 DO ji = 1, jptst 178 181 IF( zmaxlocal(ji) == zmax(ji) ) THEN 179 182 iareamin(ji) = narea ; iareamax(ji) = narea ; iareasum(ji) = 1 … … 188 191 iloc(1:2,2) = MAXLOC( ABS( u_ice(:,:) ) , mask = llmsk ) 189 192 iloc(1:2,3) = MINLOC( tm_i(:,:) - rt0, mask = llmsk ) 190 DO ji = 1, 3! local domain indices ==> global domain indices, excluding halos193 DO ji = 1, jptst ! local domain indices ==> global domain indices, excluding halos 191 194 iloc(1:2,ji) = (/ mig0(iloc(1,ji)), mjg0(iloc(2,ji)) /) 192 195 END DO … … 206 209 CALL dia_wri_state( Kmm, 'output.abort' ) ! create an output.abort file 207 210 ! 208 IF( ll_colruns . or. jpnij == 1 ) THEN ! all processes synchronized -> use lwp to print in opened ocean.output files211 IF( ll_colruns .OR. jpnij == 1 ) THEN ! all processes synchronized -> use lwp to print in opened ocean.output files 209 212 IF(lwp) THEN ; CALL ctl_stop( ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6 ) 210 213 ELSE ; nstop = MAX(1, nstop) ! make sure nstop > 0 (automatically done when calling ctl_stop) … … 247 250 !!---------------------------------------------------------------------- 248 251 WRITE(clkt , '(i9)') kt 249 252 250 253 WRITE(clfmt, '(i1)') INT(LOG10(REAL(jpnij ,wp))) + 1 ! how many digits to we need to write ? (we decide max = 9) 251 254 !!! WRITE(clsum, '(i'//clfmt//')') ksum ! this is creating a compilation error with AGRIF
Note: See TracChangeset
for help on using the changeset viewer.