- Timestamp:
- 2020-12-02T14:55:21+01:00 (3 years ago)
- Location:
- NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3
- Property svn:externals
-
old new 8 8 9 9 # SETTE 10 ^/utils/CI/sette@13 292sette10 ^/utils/CI/sette@13559 sette
-
- Property svn:externals
-
NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/stpctl.F90
r13608 r13998 49 49 !! 50 50 !! ** Method : - Save the time step in numstp 51 !! - Print it each 50 time steps52 51 !! - Stop the run IF problem encountered by setting nstop > 0 53 52 !! Problems checked: |ssh| maximum larger than 10 m … … 68 67 REAL(wp) :: zzz ! local real 69 68 REAL(wp), DIMENSION(9) :: zmax, zmaxlocal 70 LOGICAL :: ll_wrtstp, ll_colruns, ll_wrtruns 69 LOGICAL :: ll_wrtstp, ll_colruns, ll_wrtruns, ll_0oce 71 70 LOGICAL, DIMENSION(jpi,jpj,jpk) :: llmsk 72 71 CHARACTER(len=20) :: clname … … 120 119 ! !== test of local extrema ==! 121 120 ! !== done by all processes at every time step ==! 122 llmsk(:,:,1) = ssmask(:,:) == 1._wp 121 ! 122 llmsk( 1:Nis1,:,:) = .FALSE. ! exclude halos from the checked region 123 llmsk(Nie1: jpi,:,:) = .FALSE. 124 llmsk(:, 1:Njs1,:) = .FALSE. 125 llmsk(:,Nje1: jpj,:) = .FALSE. 126 ! 127 llmsk(Nis0:Nie0,Njs0:Nje0,1) = ssmask(Nis0:Nie0,Njs0:Nje0) == 1._wp ! define only the inner domain 128 ! 129 ll_0oce = .NOT. ANY( llmsk(:,:,1) ) ! no ocean point in the inner domain? 130 ! 123 131 IF( ll_wd ) THEN 124 132 zmax(1) = MAXVAL( ABS( ssh(:,:,Kmm) + ssh_ref ), mask = llmsk(:,:,1) ) ! ssh max … … 126 134 zmax(1) = MAXVAL( ABS( ssh(:,:,Kmm) ), mask = llmsk(:,:,1) ) ! ssh max 127 135 ENDIF 128 llmsk( :,:,:) = umask(:,:,:) == 1._wp136 llmsk(Nis0:Nie0,Njs0:Nje0,:) = umask(Nis0:Nie0,Njs0:Nje0,:) == 1._wp ! define only the inner domain 129 137 zmax(2) = MAXVAL( ABS( uu(:,:,:,Kmm) ), mask = llmsk ) ! velocity max (zonal only) 130 llmsk( :,:,:) = tmask(:,:,:) == 1._wp138 llmsk(Nis0:Nie0,Njs0:Nje0,:) = tmask(Nis0:Nie0,Njs0:Nje0,:) == 1._wp ! define only the inner domain 131 139 zmax(3) = MAXVAL( -ts(:,:,:,jp_sal,Kmm), mask = llmsk ) ! minus salinity max 132 140 zmax(4) = MAXVAL( ts(:,:,:,jp_sal,Kmm), mask = llmsk ) ! salinity max … … 144 152 zmax(5:8) = 0._wp 145 153 ENDIF 146 zmax(9) = REAL( nstop, wp ) ! stop indicator 154 zmax(9) = REAL( nstop, wp ) ! stop indicator 155 ! 147 156 ! !== get global extrema ==! 148 157 ! !== done by all processes if writting run.stat ==! 149 158 IF( ll_colruns ) THEN 150 159 zmaxlocal(:) = zmax(:) 151 CALL mpp_max( "stpctl", zmax ) ! max over the global domain 160 CALL mpp_max( "stpctl", zmax ) ! max over the global domain: ok even of ll_0oce = .true. 152 161 nstop = NINT( zmax(9) ) ! update nstop indicator (now sheared among all local domains) 153 ENDIF 162 ELSE 163 ! if no ocean point: MAXVAL returns -HUGE => we must overwrite this value to avoid error handling bellow. 164 IF( ll_0oce ) zmax(1:4) = (/ 0._wp, 0._wp, -1._wp, 1._wp /) ! default "valid" values... 165 ENDIF 166 ! 167 zmax(3) = -zmax(3) ! move back from max(-zz) to min(zz) : easier to manage! 168 zmax(5) = -zmax(5) ! move back from max(-zz) to min(zz) : easier to manage! 169 IF( ll_colruns ) THEN 170 zmaxlocal(3) = -zmaxlocal(3) ! move back from max(-zz) to min(zz) : easier to manage! 171 zmaxlocal(5) = -zmaxlocal(5) ! move back from max(-zz) to min(zz) : easier to manage! 172 ENDIF 173 ! 154 174 ! !== write "run.stat" files ==! 155 175 ! !== done only by 1st subdomain at writting timestep ==! 156 176 IF( ll_wrtruns ) THEN 157 WRITE(numrun,9500) kt, zmax(1), zmax(2), -zmax(3), zmax(4) 158 istatus = NF90_PUT_VAR( nrunid, nvarid(1), (/ zmax(1)/), (/kt/), (/1/) ) 159 istatus = NF90_PUT_VAR( nrunid, nvarid(2), (/ zmax(2)/), (/kt/), (/1/) ) 160 istatus = NF90_PUT_VAR( nrunid, nvarid(3), (/-zmax(3)/), (/kt/), (/1/) ) 161 istatus = NF90_PUT_VAR( nrunid, nvarid(4), (/ zmax(4)/), (/kt/), (/1/) ) 162 istatus = NF90_PUT_VAR( nrunid, nvarid(5), (/-zmax(5)/), (/kt/), (/1/) ) 163 istatus = NF90_PUT_VAR( nrunid, nvarid(6), (/ zmax(6)/), (/kt/), (/1/) ) 164 IF( ln_zad_Aimp ) THEN 165 istatus = NF90_PUT_VAR( nrunid, nvarid(7), (/ zmax(7)/), (/kt/), (/1/) ) 166 istatus = NF90_PUT_VAR( nrunid, nvarid(8), (/ zmax(8)/), (/kt/), (/1/) ) 167 ENDIF 177 WRITE(numrun,9500) kt, zmax(1), zmax(2), zmax(3), zmax(4) 178 DO ji = 1, 6 + 2 * COUNT( (/ln_zad_Aimp/) ) 179 istatus = NF90_PUT_VAR( nrunid, nvarid(ji), (/zmax(ji)/), (/kt/), (/1/) ) 180 END DO 168 181 IF( kt == nitend ) istatus = NF90_CLOSE(nrunid) 169 182 ENDIF … … 171 184 ! !== done by all processes at every time step ==! 172 185 ! 173 IF( 174 & 175 & zmax(3) >= 0._wp .OR. & ! negative or zero sea surface salinity176 & 177 & 178 & 179 & 186 IF( zmax(1) > 20._wp .OR. & ! too large sea surface height ( > 20 m ) 187 & zmax(2) > 10._wp .OR. & ! too large velocity ( > 10 m/s) 188 & zmax(3) <= 0._wp .OR. & ! negative or zero sea surface salinity 189 & zmax(4) >= 100._wp .OR. & ! too large sea surface salinity ( > 100 ) 190 & zmax(4) < 0._wp .OR. & ! too large sea surface salinity (keep this line for sea-ice) 191 & ISNAN( zmax(1) + zmax(2) + zmax(3) ) .OR. & ! NaN encounter in the tests 192 & ABS( zmax(1) + zmax(2) + zmax(3) ) > HUGE(1._wp) ) THEN ! Infinity encounter in the tests 180 193 ! 181 194 iloc(:,:) = 0 … … 184 197 IF( lwm .AND. kt /= nitend ) istatus = NF90_CLOSE(nrunid) 185 198 ! get global loc on the min/max 186 CALL mpp_maxloc( 'stpctl', ABS(ssh(:,:, Kmm)), ssmask(:,: ), zzz, iloc(1:2,1) ) ! mpp_maxloc ok if mask = F 187 CALL mpp_maxloc( 'stpctl', ABS( uu(:,:,:, Kmm)), umask(:,:,:), zzz, iloc(1:3,2) ) 188 CALL mpp_minloc( 'stpctl', ts(:,:,:,jp_sal,Kmm) , tmask(:,:,:), zzz, iloc(1:3,3) ) 189 CALL mpp_maxloc( 'stpctl', ts(:,:,:,jp_sal,Kmm) , tmask(:,:,:), zzz, iloc(1:3,4) ) 199 llmsk(Nis0:Nie0,Njs0:Nje0,1) = ssmask(Nis0:Nie0,Njs0:Nje0 ) == 1._wp ! define only the inner domain 200 CALL mpp_maxloc( 'stpctl', ABS(ssh(:,:, Kmm)), llmsk(:,:,1), zzz, iloc(1:2,1) ) ! mpp_maxloc ok if mask = F 201 llmsk(Nis0:Nie0,Njs0:Nje0,:) = umask(Nis0:Nie0,Njs0:Nje0,:) == 1._wp ! define only the inner domain 202 CALL mpp_maxloc( 'stpctl', ABS( uu(:,:,:, Kmm)), llmsk(:,:,:), zzz, iloc(1:3,2) ) 203 llmsk(Nis0:Nie0,Njs0:Nje0,:) = tmask(Nis0:Nie0,Njs0:Nje0,:) == 1._wp ! define only the inner domain 204 CALL mpp_minloc( 'stpctl', ts(:,:,:,jp_sal,Kmm) , llmsk(:,:,:), zzz, iloc(1:3,3) ) 205 CALL mpp_maxloc( 'stpctl', ts(:,:,:,jp_sal,Kmm) , llmsk(:,:,:), zzz, iloc(1:3,4) ) 190 206 ! find which subdomain has the max. 191 207 iareamin(:) = jpnij+1 ; iareamax(:) = 0 ; iareasum(:) = 0 … … 200 216 ELSE ! find local min and max locations: 201 217 ! if we are here, this means that the subdomain contains some oce points -> no need to test the mask used in maxloc 202 iloc(1:2,1) = MAXLOC( ABS( ssh(:,:, Kmm)), mask = ssmask(:,: ) == 1._wp ) + (/ nimpp - 1, njmpp - 1 /) 203 iloc(1:3,2) = MAXLOC( ABS( uu(:,:,:, Kmm)), mask = umask(:,:,:) == 1._wp ) + (/ nimpp - 1, njmpp - 1, 0 /) 204 iloc(1:3,3) = MINLOC( ts(:,:,:,jp_sal,Kmm) , mask = tmask(:,:,:) == 1._wp ) + (/ nimpp - 1, njmpp - 1, 0 /) 205 iloc(1:3,4) = MAXLOC( ts(:,:,:,jp_sal,Kmm) , mask = tmask(:,:,:) == 1._wp ) + (/ nimpp - 1, njmpp - 1, 0 /) 218 llmsk(Nis0:Nie0,Njs0:Nje0,1) = ssmask(Nis0:Nie0,Njs0:Nje0 ) == 1._wp ! define only the inner domain 219 iloc(1:2,1) = MAXLOC( ABS( ssh(:,:, Kmm)), mask = llmsk(:,:,1) ) 220 llmsk(Nis0:Nie0,Njs0:Nje0,:) = umask(Nis0:Nie0,Njs0:Nje0,:) == 1._wp ! define only the inner domain 221 iloc(1:3,2) = MAXLOC( ABS( uu(:,:,:, Kmm)), mask = llmsk(:,:,:) ) 222 llmsk(Nis0:Nie0,Njs0:Nje0,:) = tmask(Nis0:Nie0,Njs0:Nje0,:) == 1._wp ! define only the inner domain 223 iloc(1:3,3) = MINLOC( ts(:,:,:,jp_sal,Kmm) , mask = llmsk(:,:,:) ) 224 iloc(1:3,4) = MAXLOC( ts(:,:,:,jp_sal,Kmm) , mask = llmsk(:,:,:) ) 225 DO ji = 1, 4 ! local domain indices ==> global domain indices, excluding halos 226 iloc(1:2,ji) = (/ mig0(iloc(1,ji)), mjg0(iloc(2,ji)) /) 227 END DO 206 228 iareamin(:) = narea ; iareamax(:) = narea ; iareasum(:) = 1 ! this is local information 207 229 ENDIF 208 230 ! 209 231 WRITE(ctmp1,*) ' stp_ctl: |ssh| > 20 m or |U| > 10 m/s or S <= 0 or S >= 100 or NaN encounter in the tests' 210 CALL wrt_line( ctmp2, kt, '|ssh| max', 211 CALL wrt_line( ctmp3, kt, '|U| max', 212 CALL wrt_line( ctmp4, kt, 'Sal min', -zmax(3), iloc(:,3), iareasum(3), iareamin(3), iareamax(3) )213 CALL wrt_line( ctmp5, kt, 'Sal max', 232 CALL wrt_line( ctmp2, kt, '|ssh| max', zmax(1), iloc(:,1), iareasum(1), iareamin(1), iareamax(1) ) 233 CALL wrt_line( ctmp3, kt, '|U| max', zmax(2), iloc(:,2), iareasum(2), iareamin(2), iareamax(2) ) 234 CALL wrt_line( ctmp4, kt, 'Sal min', zmax(3), iloc(:,3), iareasum(3), iareamin(3), iareamax(3) ) 235 CALL wrt_line( ctmp5, kt, 'Sal max', zmax(4), iloc(:,4), iareasum(4), iareamin(4), iareamax(4) ) 214 236 IF( Agrif_Root() ) THEN 215 237 WRITE(ctmp6,*) ' ===> output of last computed fields in output.abort* files'
Note: See TracChangeset
for help on using the changeset viewer.