Changeset 1001 for palm/trunk/SOURCE/timestep.f90
 Timestamp:
 Sep 13, 2012 2:08:46 PM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

palm/trunk/SOURCE/timestep.f90
r979 r1001 4 4 ! Current revisions: 5 5 !  6 ! 6 ! all actions concerning leapfrog scheme removed 7 7 ! 8 8 ! Former revisions: … … 68 68 dt_plant_canopy_l, & 69 69 dt_plant_canopy_u, dt_plant_canopy_v, dt_plant_canopy_w, & 70 dt_u, dt_v, dt_w, lad_max, percent_change,&70 dt_u, dt_v, dt_w, lad_max, & 71 71 u_gtrans_l, u_max_cfl, vabs_max, value, v_gtrans_l, v_max_cfl 72 72 … … 277 277 ! 278 278 ! The time step is the minimum of the 34 components and the diffusion time 279 ! step minus a reduction to be on the safe side. Factor 0.5 is necessary 280 ! since the leapfrog scheme always progresses by 2 * delta t. 281 ! The user has to set the cfl_factor small enough to ensure that the 282 ! divergences do not become too large. 279 ! step minus a reduction (cfl_factor) to be on the safe side. 283 280 ! The time step must not exceed the maximum allowed value. 284 IF ( timestep_scheme(1:5) == 'runge' ) THEN 285 dt_3d = cfl_factor * MIN( dt_diff, dt_plant_canopy, dt_u, dt_v, dt_w ) 286 ELSE 287 dt_3d = cfl_factor * 0.5 * & 288 MIN( dt_diff, dt_plant_canopy, dt_u, dt_v, dt_w ) 289 ENDIF 281 dt_3d = cfl_factor * MIN( dt_diff, dt_plant_canopy, dt_u, dt_v, dt_w ) 290 282 dt_3d = MIN( dt_3d, dt_max ) 291 283 … … 339 331 340 332 ! 341 ! Ensure a smooth value (two significant digits) of the timestep. For 342 ! other schemes than RungeKutta, the following restrictions appear: 343 ! The current timestep is only then changed, if the change relative to 344 ! its previous value exceeds +5 % or 2 %. In case of a timestep 345 ! reduction, at least 30 iterations have to be performed before a timestep 346 ! enlargement is permitted again. 347 percent_change = dt_3d / old_dt  1.0 348 IF ( percent_change > 0.05 .OR. percent_change < 0.02 .OR. & 349 timestep_scheme(1:5) == 'runge' ) THEN 350 351 ! 352 ! Time step enlargement by no more than 2 %. 353 IF ( percent_change > 0.0 .AND. simulated_time /= 0.0 .AND. & 354 timestep_scheme(1:5) /= 'runge' ) THEN 355 dt_3d = 1.02 * old_dt 356 ENDIF 357 358 ! 359 ! A relatively smooth value of the time step is ensured by taking 360 ! only the first two significant digits. 361 div = 1000.0 362 DO WHILE ( dt_3d < div ) 363 div = div / 10.0 364 ENDDO 365 dt_3d = NINT( dt_3d * 100.0 / div ) * div / 100.0 366 367 ! 368 ! Now the time step can be adjusted. 369 IF ( percent_change < 0.0 .OR. timestep_scheme(1:5) == 'runge' ) & 370 THEN 371 ! 372 ! Time step reduction. 373 old_dt = dt_3d 374 dt_changed = .TRUE. 375 ELSE 376 ! 377 ! For other timestep schemes , the time step is only enlarged 378 ! after at least 30 iterations since the previous time step 379 ! change or, of course, after model initialization. 380 IF ( current_timestep_number >= last_dt_change + 30 .OR. & 381 simulated_time == 0.0 ) THEN 382 old_dt = dt_3d 383 dt_changed = .TRUE. 384 ELSE 385 dt_3d = old_dt 386 dt_changed = .FALSE. 387 ENDIF 388 389 ENDIF 390 ELSE 391 ! 392 ! No time step change since the difference is too small. 393 dt_3d = old_dt 394 dt_changed = .FALSE. 395 ENDIF 396 397 IF ( dt_changed ) last_dt_change = current_timestep_number 333 ! Ensure a smooth value (two significant digits) of the timestep. 334 div = 1000.0 335 DO WHILE ( dt_3d < div ) 336 div = div / 10.0 337 ENDDO 338 dt_3d = NINT( dt_3d * 100.0 / div ) * div / 100.0 339 340 ! 341 ! Adjust the time step 342 old_dt = dt_3d 398 343 399 344 ENDIF 345 400 346 CALL cpu_log( log_point(12), 'calculate_timestep', 'stop' ) 401 347
Note: See TracChangeset
for help on using the changeset viewer.