Changeset 1822 for palm/trunk/SOURCE/lpm_init.f90
- Timestamp:
- Apr 7, 2016 7:49:42 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/lpm_init.f90
r1818 r1822 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! Unused variables removed. 22 22 ! 23 23 ! Former revisions: … … 113 113 dz, initializing_actions, message_string, ocean, simulated_time 114 114 115 USE dvrp_variables, &116 ONLY: particle_color, particle_dvrpsize117 118 115 USE grid_variables, & 119 116 ONLY: ddx, dx, ddy, dy … … 134 131 ONLY: alloc_factor, bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, & 135 132 block_offset, block_offset_def, collision_kernel, & 136 density_ratio, dvrp_psize, grid_particles,&133 density_ratio, grid_particles, & 137 134 initial_weighting_factor, ibc_par_b, ibc_par_lr, ibc_par_ns, & 138 135 ibc_par_t, iran_part, log_z_z0, & 139 136 max_number_of_particle_groups, maximum_number_of_particles, & 140 maximum_number_of_tailpoints, maximum_number_of_tails, & 141 minimum_tailpoint_distance, min_nr_particle, & 142 mpi_particle_type, new_tail_id, & 143 number_of_initial_tails, number_of_particles, & 137 min_nr_particle, mpi_particle_type, & 138 number_of_particles, & 144 139 number_of_particle_groups, number_of_sublayers, & 145 number_of_tails, offset_ocean_nzt, offset_ocean_nzt_m1,&140 offset_ocean_nzt, offset_ocean_nzt_m1, & 146 141 particles, particle_advection_start, particle_groups, & 147 142 particle_groups_type, particles_per_point, & 148 particle_t ail_coordinates, particle_type, pdx, pdy, pdz,&143 particle_type, pdx, pdy, pdz, & 149 144 prt_count, psb, psl, psn, psr, pss, pst, & 150 145 radius, random_start_position, read_particles_from_restartfile,& 151 seed_follows_topography, s kip_particles_for_tail, sort_count,&152 t ail_mask, total_number_of_particles, total_number_of_tails,&153 use_ particle_tails, use_sgs_for_particles,&146 seed_follows_topography, sort_count, & 147 total_number_of_particles, & 148 use_sgs_for_particles, & 154 149 write_particle_statistics, uniform_particles, zero_particle, & 155 150 z0_av_global … … 192 187 193 188 INTEGER(iwp) :: i !< 194 INTEGER(iwp) :: ip !<195 189 INTEGER(iwp) :: j !< 196 INTEGER(iwp) :: jp !<197 190 INTEGER(iwp) :: k !< 198 INTEGER(iwp) :: kp !<199 INTEGER(iwp) :: n !<200 INTEGER(iwp) :: nn !<201 191 202 192 #if defined( __parallel ) … … 205 195 INTEGER(iwp), DIMENSION(3) :: types !< 206 196 #endif 207 LOGICAL :: uniform_particles_l !<208 197 209 198 REAL(wp) :: height_int !< … … 216 205 !-- Define MPI derived datatype for FORTRAN datatype particle_type (see module 217 206 !-- particle_attributes). Integer length is 4 byte, Real is 8 byte 218 #if defined( __twocachelines )219 blocklengths(1) = 7; blocklengths(2) = 18; blocklengths(3) = 1220 displacements(1) = 0; displacements(2) = 64; displacements(3) = 128221 222 types(1) = MPI_REAL ! 64 bit words223 types(2) = MPI_INTEGER ! 32 Bit words224 types(3) = MPI_UB225 #else226 207 blocklengths(1) = 19; blocklengths(2) = 6; blocklengths(3) = 1 227 208 displacements(1) = 0; displacements(2) = 152; displacements(3) = 176 … … 230 211 types(2) = MPI_INTEGER 231 212 types(3) = MPI_UB 232 #endif233 213 CALL MPI_TYPE_STRUCT( 3, blocklengths, displacements, types, & 234 214 mpi_particle_type, ierr ) … … 293 273 ! 294 274 !-- Allocate arrays required for calculating particle SGS velocities 295 IF ( use_sgs_for_particles ) THEN275 IF ( use_sgs_for_particles .AND. .NOT. cloud_droplets ) THEN 296 276 ALLOCATE( de_dx(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & 297 277 de_dy(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & … … 429 409 !-- Allocate particle arrays and set attributes of the initial set of 430 410 !-- particles, which can be also periodically released at later times. 431 !-- Also allocate array for particle tail coordinates, if needed.432 411 ALLOCATE( prt_count(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & 433 412 grid_particles(nzb+1:nzt,nys:nyn,nxl:nxr) ) … … 443 422 !-- occur within restart runs). The reason for this is still not clear 444 423 !-- and may be presumably caused by errors in the respective user-interface. 445 #if defined( __twocachelines )446 zero_particle = particle_type( 0.0_wp, 0.0_sp, 0.0_sp, 0.0_sp, 0.0_sp, &447 0.0_sp, 0.0_sp, 0.0_wp, 0.0_wp, 0.0_wp, &448 0, .FALSE., 0.0_wp, 0.0_wp, 0.0_wp, &449 0.0_sp, 0.0_sp, 0.0_sp, 0.0_sp, 0.0_sp, &450 0.0_sp, 0, 0, 0, -1)451 #else452 424 zero_particle = particle_type( 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, & 453 425 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, & … … 455 427 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0, 0, 0, & 456 428 0, .FALSE., -1) 457 #endif 429 458 430 particle_groups = particle_groups_type( 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp ) 459 460 !461 !-- Set the default particle size used for dvrp plots462 IF ( dvrp_psize == 9999999.9_wp ) dvrp_psize = 0.2_wp * dx463 431 464 432 ! … … 506 474 ENDIF 507 475 508 !509 !-- Check if particles are really uniform in color and radius (dvrp_size)510 !-- (uniform_particles is preset TRUE)511 IF ( uniform_particles ) THEN512 DO ip = nxl, nxr513 DO jp = nys, nyn514 DO kp = nzb+1, nzt515 516 n = prt_count(kp,jp,ip)517 IF ( MINVAL( grid_particles(kp,jp,ip)%particles(1:n)%dvrp_psize ) == &518 MAXVAL( grid_particles(kp,jp,ip)%particles(1:n)%dvrp_psize ) .AND. &519 MINVAL( grid_particles(kp,jp,ip)%particles(1:n)%class ) == &520 MAXVAL( grid_particles(kp,jp,ip)%particles(1:n)%class ) ) THEN521 uniform_particles_l = .TRUE.522 ELSE523 uniform_particles_l = .FALSE.524 ENDIF525 526 ENDDO527 ENDDO528 ENDDO529 530 #if defined( __parallel )531 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr )532 CALL MPI_ALLREDUCE( uniform_particles_l, uniform_particles, 1, &533 MPI_LOGICAL, MPI_LAND, comm2d, ierr )534 #else535 uniform_particles = uniform_particles_l536 #endif537 538 ENDIF539 540 !541 !-- Particles will probably become none-uniform, if their size and color542 !-- will be determined by flow variables543 IF ( particle_color /= 'none' .OR. particle_dvrpsize /= 'none' ) THEN544 uniform_particles = .FALSE.545 ENDIF546 547 ! !kk Not implemented aft individual particle array fort every gridcell548 ! !549 ! !-- Set the beginning of the particle tails and their age550 ! IF ( use_particle_tails ) THEN551 ! !552 ! !-- Choose the maximum number of tails with respect to the maximum number553 ! !-- of particles and skip_particles_for_tail554 ! maximum_number_of_tails = maximum_number_of_particles / &555 ! skip_particles_for_tail556 !557 ! !558 ! !-- Create a minimum number of tails in case that there is no tail559 ! !-- initially (otherwise, index errors will occur when adressing the560 ! !-- arrays below)561 ! IF ( maximum_number_of_tails == 0 ) maximum_number_of_tails = 10562 !563 ! ALLOCATE( particle_tail_coordinates(maximum_number_of_tailpoints,5, &564 ! maximum_number_of_tails), &565 ! new_tail_id(maximum_number_of_tails), &566 ! tail_mask(maximum_number_of_tails) )567 !568 ! particle_tail_coordinates = 0.0_wp569 ! minimum_tailpoint_distance = minimum_tailpoint_distance**2570 ! number_of_initial_tails = number_of_tails571 !572 ! nn = 0573 ! DO n = 1, number_of_particles574 ! !575 ! !-- Only for those particles marked above with a provisional tail_id576 ! !-- tails will be created. Particles now get their final tail_id.577 ! IF ( particles(n)%tail_id /= 0 ) THEN578 !579 ! nn = nn + 1580 ! particles(n)%tail_id = nn581 !582 ! particle_tail_coordinates(1,1,nn) = particles(n)%x583 ! particle_tail_coordinates(1,2,nn) = particles(n)%y584 ! particle_tail_coordinates(1,3,nn) = particles(n)%z585 ! particle_tail_coordinates(1,4,nn) = particles(n)%class586 ! particles(n)%tailpoints = 1587 ! IF ( minimum_tailpoint_distance /= 0.0_wp ) THEN588 ! particle_tail_coordinates(2,1,nn) = particles(n)%x589 ! particle_tail_coordinates(2,2,nn) = particles(n)%y590 ! particle_tail_coordinates(2,3,nn) = particles(n)%z591 ! particle_tail_coordinates(2,4,nn) = particles(n)%class592 ! particle_tail_coordinates(1:2,5,nn) = 0.0_wp593 ! particles(n)%tailpoints = 2594 ! ENDIF595 !596 ! ENDIF597 ! ENDDO598 ! ENDIF599 !600 ! !601 ! !-- Plot initial positions of particles (only if particle advection is602 ! !-- switched on from the beginning of the simulation (t=0))603 ! IF ( particle_advection_start == 0.0_wp ) CALL data_output_dvrp604 605 476 ENDIF 606 477 … … 641 512 INTEGER(iwp) :: n !< 642 513 INTEGER(iwp) :: new_size !< 643 INTEGER(iwp) :: nn !<644 514 645 515 INTEGER(iwp), INTENT(IN) :: phase !< … … 691 561 692 562 n = n + 1 693 #if defined( __twocachelines )694 tmp_particle%x = pos_x695 tmp_particle%y = pos_y696 tmp_particle%z = pos_z697 tmp_particle%age = 0.0_sp698 tmp_particle%age_m = 0.0_sp699 tmp_particle%dt_sum = 0.0_wp700 tmp_particle%dvrp_psize = dvrp_psize701 tmp_particle%e_m = 0.0_sp702 IF ( curvature_solution_effects ) THEN703 !704 !-- Initial values (internal timesteps, derivative)705 !-- for Rosenbrock method706 tmp_particle%rvar1 = 1.0E-12_wp707 tmp_particle%rvar2 = 1.0E-3_wp708 tmp_particle%rvar3 = -9999999.9_wp709 ELSE710 !711 !-- Initial values for SGS velocities712 tmp_particle%rvar1 = 0.0_wp713 tmp_particle%rvar2 = 0.0_wp714 tmp_particle%rvar3 = 0.0_wp715 ENDIF716 tmp_particle%speed_x = 0.0_sp717 tmp_particle%speed_y = 0.0_sp718 tmp_particle%speed_z = 0.0_sp719 tmp_particle%origin_x = pos_x720 tmp_particle%origin_y = pos_y721 tmp_particle%origin_z = pos_z722 tmp_particle%radius = particle_groups(i)%radius723 tmp_particle%weight_factor = initial_weighting_factor724 tmp_particle%class = 1725 tmp_particle%group = i726 tmp_particle%tailpoints = 0727 tmp_particle%particle_mask = .TRUE.728 #else729 563 tmp_particle%x = pos_x 730 564 tmp_particle%y = pos_y … … 733 567 tmp_particle%age_m = 0.0_wp 734 568 tmp_particle%dt_sum = 0.0_wp 735 tmp_particle%dvrp_psize = dvrp_psize569 tmp_particle%dvrp_psize = 0.0_wp !unused 736 570 tmp_particle%e_m = 0.0_wp 737 571 IF ( curvature_solution_effects ) THEN … … 759 593 tmp_particle%class = 1 760 594 tmp_particle%group = i 761 tmp_particle%tailpoints = 0 595 tmp_particle%tailpoints = 0 !unused 762 596 tmp_particle%particle_mask = .TRUE. 763 #endif 764 IF ( use_particle_tails .AND. & 765 MOD( n, skip_particles_for_tail ) == 0 ) THEN 766 number_of_tails = number_of_tails + 1 767 ! 768 !-- This is a temporary provisional setting (see 769 !-- further below!) 770 tmp_particle%tail_id = number_of_tails 771 ELSE 772 tmp_particle%tail_id = 0 773 ENDIF 597 tmp_particle%tail_id = 0 !unused 598 774 599 ! 775 600 !-- Determine the grid indices of the particle position … … 913 738 ENDDO 914 739 ! 915 !-- Calculate the number of particles and tailsof the total domain740 !-- Calculate the number of particles of the total domain 916 741 #if defined( __parallel ) 917 742 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) 918 743 CALL MPI_ALLREDUCE( number_of_particles, total_number_of_particles, 1, & 919 744 MPI_INTEGER, MPI_SUM, comm2d, ierr ) 920 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr )921 CALL MPI_ALLREDUCE( number_of_tails, total_number_of_tails, 1, &922 MPI_INTEGER, MPI_SUM, comm2d, ierr )923 745 #else 924 746 total_number_of_particles = number_of_particles 925 total_number_of_tails = number_of_tails926 747 #endif 927 748
Note: See TracChangeset
for help on using the changeset viewer.