Changeset 2130 for palm/trunk
- Timestamp:
- Jan 24, 2017 4:25:39 PM (8 years ago)
- Location:
- palm/trunk/SOURCE
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/Makefile
r2119 r2130 20 20 # Current revisions: 21 21 # ------------------ 22 # 22 # dependency for timestep updated 23 23 # 24 24 # Former revisions: … … 584 584 urban_surface_mod.o virtual_flight_mod.o wind_turbine_model_mod.o 585 585 time_to_string.o: mod_kinds.o 586 timestep.o: modules.o cpulog_mod.o mod_kinds.o microphysics_mod.o 586 timestep.o: modules.o cpulog_mod.o mod_kinds.o microphysics_mod.o \ 587 pmc_interface_mod.o 587 588 timestep_scheme_steering.o: modules.o mod_kinds.o 588 589 transpose.o: modules.o cpulog_mod.o mod_kinds.o -
palm/trunk/SOURCE/timestep.f90
r2119 r2130 20 20 ! Current revisions: 21 21 ! ------------------ 22 ! 22 ! bugfix: in case of nested runs the stop condition in case of too small 23 ! timesteps is communicated to all parent/child processes, 24 ! some formatting done 23 25 ! 24 26 ! Former revisions: … … 123 125 USE pegrid 124 126 127 USE pmc_interface, & 128 ONLY: nested_run 129 125 130 USE statistics, & 126 131 ONLY: flow_statistics_called, hom, u_max, u_max_ijk, v_max, v_max_ijk,& … … 132 137 INTEGER(iwp) :: j !< 133 138 INTEGER(iwp) :: k !< 139 140 LOGICAL :: stop_dt_local !< local switch for controlling the time stepping 134 141 135 142 REAL(wp) :: div !< … … 193 200 ENDDO 194 201 ENDDO 195 uv_gtrans_l(1) = u_gtrans_l / REAL( (nxr-nxl+1)*(nyn-nys+1)*(nzt-nzb), KIND=wp ) 196 uv_gtrans_l(2) = v_gtrans_l / REAL( (nxr-nxl+1)*(nyn-nys+1)*(nzt-nzb), KIND=wp ) 202 uv_gtrans_l(1) = u_gtrans_l / & 203 REAL( (nxr-nxl+1)*(nyn-nys+1)*(nzt-nzb), KIND=wp ) 204 uv_gtrans_l(2) = v_gtrans_l / & 205 REAL( (nxr-nxl+1)*(nyn-nys+1)*(nzt-nzb), KIND=wp ) 197 206 #if defined( __parallel ) 198 207 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) 199 CALL MPI_ALLREDUCE( uv_gtrans_l, uv_gtrans, 2, MPI_REAL, MPI_SUM, &208 CALL MPI_ALLREDUCE( uv_gtrans_l, uv_gtrans, 2, MPI_REAL, MPI_SUM, & 200 209 comm2d, ierr ) 201 210 u_gtrans = uv_gtrans(1) / REAL( numprocs, KIND=wp ) … … 229 238 DO j = nys, nyn 230 239 DO k = nzb+1, nzt 231 dt_u_l = MIN( dt_u_l, ( dx / ( ABS( u(k,j,i) - u_gtrans ) + 1.0E-10_wp ) ) ) 232 dt_v_l = MIN( dt_v_l, ( dy / ( ABS( v(k,j,i) - v_gtrans ) + 1.0E-10_wp ) ) ) 233 dt_w_l = MIN( dt_w_l, ( dzu(k) / ( ABS( w(k,j,i) ) + 1.0E-10_wp ) ) ) 240 dt_u_l = MIN( dt_u_l, ( dx / & 241 ( ABS( u(k,j,i) - u_gtrans ) + 1.0E-10_wp ) ) ) 242 dt_v_l = MIN( dt_v_l, ( dy / & 243 ( ABS( v(k,j,i) - v_gtrans ) + 1.0E-10_wp ) ) ) 244 dt_w_l = MIN( dt_w_l, ( dzu(k) / & 245 ( ABS( w(k,j,i) ) + 1.0E-10_wp ) ) ) 234 246 ENDDO 235 247 ENDDO … … 254 266 !-- Compute time step according to the diffusion criterion. 255 267 !-- First calculate minimum grid spacing which only depends on index k 256 !-- Note: also at k=nzb+1 a full grid length is being assumed, although257 !-- in the Prandtl-layer friction term only dz/2 is used.258 !-- Experience from the old model seems to justify this.259 268 dt_diff_l = 999999.0_wp 260 269 … … 268 277 DO j = nys, nyn 269 278 DO k = nzb+1, nzt 270 dt_diff_l = MIN( dt_diff_l, dxyz2_min(k) / &271 279 dt_diff_l = MIN( dt_diff_l, dxyz2_min(k) / & 280 ( MAX( kh(k,j,i), km(k,j,i) ) + 1E-20_wp ) ) 272 281 ENDDO 273 282 ENDDO … … 276 285 #if defined( __parallel ) 277 286 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) 278 CALL MPI_ALLREDUCE( dt_diff_l, dt_diff, 1, MPI_REAL, MPI_MIN, comm2d, &287 CALL MPI_ALLREDUCE( dt_diff_l, dt_diff, 1, MPI_REAL, MPI_MIN, comm2d, & 279 288 ierr ) 280 289 #else … … 286 295 !-- step minus a reduction (cfl_factor) to be on the safe side. 287 296 !-- The time step must not exceed the maximum allowed value. 288 dt_3d = cfl_factor * MIN( dt_diff, dt_u, dt_v, dt_w, & 289 dt_precipitation ) 297 dt_3d = cfl_factor * MIN( dt_diff, dt_u, dt_v, dt_w, dt_precipitation ) 290 298 dt_3d = MIN( dt_3d, dt_max ) 291 299 … … 303 311 stop_dt = .TRUE. 304 312 305 WRITE( message_string, * ) 'Time step has reached minimum limit.', &306 '&dt = ', dt_3d, ' s Simulation is terminated.', &307 '&old_dt = ', old_dt, ' s', &308 '&dt_u = ', dt_u, ' s', &309 '&dt_v = ', dt_v, ' s', &310 '&dt_w = ', dt_w, ' s', &311 '&dt_diff = ', dt_diff, ' s', &312 '&u_max = ', u_max, ' m/s k=', u_max_ijk(1), &313 ' j=', u_max_ijk(2), ' i=', u_max_ijk(3), &314 '&v_max = ', v_max, ' m/s k=', v_max_ijk(1), &315 ' j=', v_max_ijk(2), ' i=', v_max_ijk(3), &316 '&w_max = ', w_max, ' m/s k=', w_max_ijk(1), &313 WRITE( message_string, * ) 'Time step has reached minimum limit.', & 314 '&dt = ', dt_3d, ' s Simulation is terminated.', & 315 '&old_dt = ', old_dt, ' s', & 316 '&dt_u = ', dt_u, ' s', & 317 '&dt_v = ', dt_v, ' s', & 318 '&dt_w = ', dt_w, ' s', & 319 '&dt_diff = ', dt_diff, ' s', & 320 '&u_max = ', u_max, ' m/s k=', u_max_ijk(1), & 321 ' j=', u_max_ijk(2), ' i=', u_max_ijk(3), & 322 '&v_max = ', v_max, ' m/s k=', v_max_ijk(1), & 323 ' j=', v_max_ijk(2), ' i=', v_max_ijk(3), & 324 '&w_max = ', w_max, ' m/s k=', w_max_ijk(1), & 317 325 ' j=', w_max_ijk(2), ' i=', w_max_ijk(3) 318 326 CALL message( 'timestep', 'PA0312', 0, 1, 0, 6, 0 ) … … 324 332 IF ( coupling_mode /= 'uncoupled' .AND. terminate_coupled == 0 ) THEN 325 333 terminate_coupled = 2 326 IF ( myid == 0 ) THEN334 IF ( myid == 0 ) THEN 327 335 CALL MPI_SENDRECV( & 328 terminate_coupled, 1, MPI_INTEGER, target_id, 0, &329 terminate_coupled_remote, 1, MPI_INTEGER, target_id, 0, &336 terminate_coupled, 1, MPI_INTEGER, target_id, 0, & 337 terminate_coupled_remote, 1, MPI_INTEGER, target_id, 0, & 330 338 comm_inter, status, ierr ) 331 339 ENDIF 332 CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0, comm2d, ierr) 340 CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0, & 341 comm2d, ierr) 333 342 ENDIF 334 343 #endif 344 ENDIF 345 346 ! 347 !-- In case of nested runs all parent/child processes have to terminate if 348 !-- one process has set the stop flag, i.e. they need to set the stop flag 349 !-- too. 350 IF ( nested_run ) THEN 351 stop_dt_local = stop_dt 352 CALL MPI_ALLREDUCE( stop_dt_local, stop_dt, 1, MPI_LOGICAL, MPI_LOR, & 353 MPI_COMM_WORLD, ierr ) 335 354 ENDIF 336 355
Note: See TracChangeset
for help on using the changeset viewer.