Changeset 2118 for palm/trunk/SOURCE/timestep.f90
 Timestamp:
 Jan 17, 2017 4:38:49 PM (4 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

palm/trunk/SOURCE/timestep.f90
r2101 r2118 20 20 ! Current revisions: 21 21 !  22 ! 22 ! OpenACC directives and related part of code removed 23 23 ! 24 24 ! Former revisions: … … 182 182 u_gtrans_l = 0.0_wp 183 183 v_gtrans_l = 0.0_wp 184 !$acc parallel present( u, v )185 184 DO i = nxl, nxr 186 185 DO j = nys, nyn … … 191 190 ENDDO 192 191 ENDDO 193 !$acc end parallel194 192 uv_gtrans_l(1) = u_gtrans_l / REAL( (nxrnxl+1)*(nynnys+1)*(nztnzb), KIND=wp ) 195 193 uv_gtrans_l(2) = v_gtrans_l / REAL( (nxrnxl+1)*(nynnys+1)*(nztnzb), KIND=wp ) … … 210 208 ! Determine the maxima of the velocity components, including their 211 209 ! grid index positions. 212 #if defined( __openacc )213 IF ( dt_fixed ) THEN ! otherwise do it further below for better cache usage214 u_max_l = 999999.9_wp215 u_min_l = 999999.9_wp216 v_max_l = 999999.9_wp217 v_min_l = 999999.9_wp218 w_max_l = 999999.9_wp219 w_min_l = 999999.9_wp220 !$acc parallel present( u, v, w )221 DO i = nxl, nxr222 DO j = nys, nyn223 DO k = nzb+1, nzt224 u_max_l = MAX( u_max_l, u(k,j,i) )225 u_min_l = MIN( u_min_l, u(k,j,i) )226 v_max_l = MAX( v_max_l, v(k,j,i) )227 v_min_l = MIN( v_min_l, v(k,j,i) )228 w_max_l = MAX( w_max_l, w(k,j,i) )229 w_min_l = MIN( w_min_l, w(k,j,i) )230 ENDDO231 ENDDO232 ENDDO233 !$acc end parallel234 #if defined( __parallel )235 reduce_l(1) = u_max_l236 reduce_l(2) = v_max_l237 reduce_l(3) = w_max_l238 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr )239 CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MAX, comm2d, ierr )240 u_max = reduce(1)241 v_max = reduce(2)242 w_max = reduce(3)243 reduce_l(1) = u_min_l244 reduce_l(2) = v_min_l245 reduce_l(3) = w_min_l246 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr )247 CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MIN, comm2d, ierr )248 IF ( ABS( reduce(1) ) > u_max ) u_max = reduce(1)249 IF ( ABS( reduce(2) ) > v_max ) v_max = reduce(2)250 IF ( ABS( reduce(3) ) > w_max ) w_max = reduce(3)251 #else252 IF ( ABS( u_min_l ) > u_max_l ) THEN253 u_max = u_min_l254 ELSE255 u_max = u_max_l256 ENDIF257 IF ( ABS( v_min_l ) > v_max_l ) THEN258 v_max = v_min_l259 ELSE260 v_max = v_max_l261 ENDIF262 IF ( ABS( w_min_l ) > w_max_l ) THEN263 w_max = w_min_l264 ELSE265 w_max = w_max_l266 ENDIF267 #endif268 ENDIF269 #else270 210 CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, u, 'abs', 0.0_wp, & 271 211 u_max, u_max_ijk ) … … 274 214 CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, w, 'abs', 0.0_wp, & 275 215 w_max, w_max_ijk ) 276 #endif277 216 278 217 IF ( .NOT. dt_fixed ) THEN 279 #if defined( __openacc )280 !281 ! Variable time step:282 ! Calculate the maximum time step according to the CFLcriterion,283 ! individually for each velocity component284 dt_u_l = 999999.9_wp285 dt_v_l = 999999.9_wp286 dt_w_l = 999999.9_wp287 u_max_l = 999999.9_wp288 u_min_l = 999999.9_wp289 v_max_l = 999999.9_wp290 v_min_l = 999999.9_wp291 w_max_l = 999999.9_wp292 w_min_l = 999999.9_wp293 !$acc parallel loop collapse(3) present( u, v, w )294 DO i = nxl, nxr295 DO j = nys, nyn296 DO k = nzb+1, nzt297 dt_u_l = MIN( dt_u_l, ( dx / ( ABS( u(k,j,i)  u_gtrans ) + 1.0E10_wp ) ) )298 dt_v_l = MIN( dt_v_l, ( dy / ( ABS( v(k,j,i)  v_gtrans ) + 1.0E10_wp ) ) )299 dt_w_l = MIN( dt_w_l, ( dzu(k) / ( ABS( w(k,j,i) ) + 1.0E10_wp ) ) )300 u_max_l = MAX( u_max_l, u(k,j,i) )301 u_min_l = MIN( u_min_l, u(k,j,i) )302 v_max_l = MAX( v_max_l, v(k,j,i) )303 v_min_l = MIN( v_min_l, v(k,j,i) )304 w_max_l = MAX( w_max_l, w(k,j,i) )305 w_min_l = MIN( w_min_l, w(k,j,i) )306 ENDDO307 ENDDO308 ENDDO309 !$acc end parallel310 311 #if defined( __parallel )312 reduce_l(1) = dt_u_l313 reduce_l(2) = dt_v_l314 reduce_l(3) = dt_w_l315 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr )316 CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MIN, comm2d, ierr )317 dt_u = reduce(1)318 dt_v = reduce(2)319 dt_w = reduce(3)320 321 reduce_l(1) = u_max_l322 reduce_l(2) = v_max_l323 reduce_l(3) = w_max_l324 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr )325 CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MAX, comm2d, ierr )326 u_max = reduce(1)327 v_max = reduce(2)328 w_max = reduce(3)329 reduce_l(1) = u_min_l330 reduce_l(2) = v_min_l331 reduce_l(3) = w_min_l332 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr )333 CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MIN, comm2d, ierr )334 IF ( ABS( reduce(1) ) > u_max ) u_max = reduce(1)335 IF ( ABS( reduce(2) ) > v_max ) v_max = reduce(2)336 IF ( ABS( reduce(3) ) > w_max ) w_max = reduce(3)337 #else338 dt_u = dt_u_l339 dt_v = dt_v_l340 dt_w = dt_w_l341 342 IF ( ABS( u_min_l ) > u_max_l ) THEN343 u_max = u_min_l344 ELSE345 u_max = u_max_l346 ENDIF347 IF ( ABS( v_min_l ) > v_max_l ) THEN348 v_max = v_min_l349 ELSE350 v_max = v_max_l351 ENDIF352 IF ( ABS( w_min_l ) > w_max_l ) THEN353 w_max = w_min_l354 ELSE355 w_max = w_max_l356 ENDIF357 #endif358 359 #else360 218 ! 361 219 ! Variable time step: … … 390 248 #endif 391 249 392 #endif393 394 250 ! 395 251 ! Compute time step according to the diffusion criterion. … … 404 260 ENDDO 405 261 406 !$OMP PARALLEL private(i,j,k,value) reduction(MIN: dt_diff_l) 407 !$OMP DO 408 !$acc parallel loop collapse(3) present( kh, km ) 262 !$OMP PARALLEL private(i,j,k,value) reduction(MIN: dt_diff_l) 263 !$OMP DO 409 264 DO i = nxl, nxr 410 265 DO j = nys, nyn … … 415 270 ENDDO 416 271 ENDDO 417 !$acc end parallel 418 !$OMP END PARALLEL 272 !$OMP END PARALLEL 419 273 #if defined( __parallel ) 420 274 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr )
Note: See TracChangeset
for help on using the changeset viewer.