Changeset 4101 for palm/trunk/SOURCE/timestep.f90
- Timestamp:
- Jul 17, 2019 3:14:26 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/timestep.f90
r3658 r4101 25 25 ! ----------------- 26 26 ! $Id$ 27 ! - consider 2*Km within diffusion criterion as Km is considered twice within 28 ! the diffusion of e, 29 ! - in RANS mode, instead of considering each wind component individually use 30 ! the wind speed of 3d wind vector in CFL criterion 31 ! - do not limit the increase of dt based on its previous value in RANS mode 32 ! 33 ! 3658 2019-01-07 20:28:54Z knoop 27 34 ! OpenACC port for SPEC 28 35 ! … … 146 153 USE control_parameters, & 147 154 ONLY: cfl_factor, coupling_mode, dt_3d, dt_fixed, dt_max, & 148 galilei_transformation, old_dt, message_string, rans_mode,&155 galilei_transformation, message_string, rans_mode, & 149 156 stop_dt, terminate_coupled, terminate_coupled_remote, & 150 157 timestep_reason, u_gtrans, use_ug_for_galilei_tr, v_gtrans … … 218 225 !$ACC HOST(kh(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) & 219 226 !$ACC HOST(km(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) 220 221 !222 !-- Save former time step as reference223 old_dt = dt_3d224 227 225 228 ! … … 284 287 ! 285 288 !-- Variable time step: 286 !-- Calculate the maximum time step according to the CFL-criterion, 287 !-- individually for each velocity component 289 !-- Calculate the maximum time step according to the CFL-criterion 288 290 dt_u_l = 999999.9_wp 289 291 dt_v_l = 999999.9_wp 290 292 dt_w_l = 999999.9_wp 291 !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) & 292 !$ACC COPY(dt_u_l, dt_v_l, dt_w_l, u_stokes_zu, v_stokes_zu) & 293 !$ACC REDUCTION(MIN: dt_u_l, dt_v_l, dt_w_l) & 294 !$ACC PRESENT(u, v, w, dzu) 295 DO i = nxl, nxr 296 DO j = nys, nyn 297 DO k = nzb+1, nzt 298 dt_u_l = MIN( dt_u_l, ( dx / & 299 ( ABS( u(k,j,i) - u_gtrans + u_stokes_zu(k) ) & 300 + 1.0E-10_wp ) ) ) 301 dt_v_l = MIN( dt_v_l, ( dy / & 302 ( ABS( v(k,j,i) - v_gtrans + v_stokes_zu(k) ) & 303 + 1.0E-10_wp ) ) ) 304 dt_w_l = MIN( dt_w_l, ( dzu(k) / & 305 ( ABS( w(k,j,i) ) + 1.0E-10_wp ) ) ) 293 294 IF ( .NOT. rans_mode ) THEN 295 ! 296 !-- Consider each velocity component individually 297 298 !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) & 299 !$ACC COPY(dt_u_l, dt_v_l, dt_w_l, u_stokes_zu, v_stokes_zu) & 300 !$ACC REDUCTION(MIN: dt_u_l, dt_v_l, dt_w_l) & 301 !$ACC PRESENT(u, v, w, dzu) 302 DO i = nxl, nxr 303 DO j = nys, nyn 304 DO k = nzb+1, nzt 305 dt_u_l = MIN( dt_u_l, ( dx / & 306 ( ABS( u(k,j,i) - u_gtrans + u_stokes_zu(k) ) & 307 + 1.0E-10_wp ) ) ) 308 dt_v_l = MIN( dt_v_l, ( dy / & 309 ( ABS( v(k,j,i) - v_gtrans + v_stokes_zu(k) ) & 310 + 1.0E-10_wp ) ) ) 311 dt_w_l = MIN( dt_w_l, ( dzu(k) / & 312 ( ABS( w(k,j,i) ) + 1.0E-10_wp ) ) ) 313 ENDDO 306 314 ENDDO 307 315 ENDDO 308 ENDDO 316 317 ELSE 318 ! 319 !-- Consider the wind speed at the scalar-grid point 320 !-- !> @note considering the wind speed instead of each individual wind 321 !-- !> component is only a workaround so far. This might has to be 322 !-- !> changed in the future. 323 324 !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) & 325 !$ACC COPY(dt_u_l, u_stokes_zu, v_stokes_zu) & 326 !$ACC REDUCTION(MIN: dt_u_l) & 327 !$ACC PRESENT(u, v, w, dzu) 328 DO i = nxl, nxr 329 DO j = nys, nyn 330 DO k = nzb+1, nzt 331 dt_u_l = MIN( dt_u_l, ( MIN( dx, dy, dzu(k) ) / ( & 332 SQRT( ( 0.5 * ( u(k,j,i) + u(k,j,i+1) ) - u_gtrans + u_stokes_zu(k) )**2 & 333 + ( 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - v_gtrans + v_stokes_zu(k) )**2 & 334 + ( 0.5 * ( w(k,j,i) + w(k-1,j,i) ) )**2 ) & 335 + 1.0E-10_wp ) ) ) 336 ENDDO 337 ENDDO 338 ENDDO 339 340 dt_v_l = dt_u_l 341 dt_w_l = dt_u_l 342 343 ENDIF 309 344 310 345 #if defined( __parallel ) … … 342 377 DO j = nys, nyn 343 378 DO k = nzb+1, nzt 344 dt_diff_l = MIN( dt_diff_l, dxyz2_min(k) / & 345 ( MAX( kh(k,j,i), ABS( km(k,j,i) ) ) & 379 dt_diff_l = MIN( dt_diff_l, & 380 dxyz2_min(k) / & 381 ( MAX( kh(k,j,i), 2.0_wp * ABS( km(k,j,i) ) ) & 346 382 + 1E-20_wp ) ) 347 383 ENDDO … … 363 399 dt_3d = cfl_factor * MIN( dt_diff, dt_u, dt_v, dt_w, dt_precipitation ) 364 400 dt_3d = MIN( dt_3d, dt_max ) 365 !366 !-- In RANS mode, the time step must not increase by more than a factor of 2367 IF ( rans_mode ) dt_3d = MIN( dt_3d, dt_max, 2.0_wp * old_dt )368 401 369 402 ! … … 390 423 WRITE( message_string, * ) 'Time step has reached minimum limit.', & 391 424 '&dt = ', dt_3d, ' s Simulation is terminated.', & 392 '&old_dt = ', old_dt, ' s', &393 425 '&dt_u = ', dt_u, ' s', & 394 426 '&dt_v = ', dt_v, ' s', &
Note: See TracChangeset
for help on using the changeset viewer.