@@ -22,10 +22,11 @@ contains
2222 impure subroutine s_generate_particle_beds ()
2323
2424 integer :: b, ib_idx, geom
25- integer :: n_placed
25+ integer :: n_placed, n_total_placed
2626 integer (8 ) :: n_attempts, max_attempts
2727 real (wp) :: xmin, xmax, ymin, ymax, zmin, zmax, min_dist
2828 real (wp) :: rx, ry, rz, dist
29+ real (wp) :: t_start, t_end
2930 integer :: seed
3031 logical :: overlaps
3132 real (wp), allocatable :: placed(:,:)
@@ -38,6 +39,9 @@ contains
3839
3940 if (num_particle_beds == 0 ) return
4041
42+ call cpu_time(t_start)
43+ n_total_placed = 0
44+
4145 do b = 1 , num_particle_beds
4246 xmin = particle_bed(b)%x_centroid - 0.5_wp * particle_bed(b)%length_x
4347 xmax = particle_bed(b)%x_centroid + 0.5_wp * particle_bed(b)%length_x
@@ -58,7 +62,7 @@ contains
5862 dz_hi = 1
5963 end if
6064
61- max_attempts = int (particle_bed(b)%num_particles, 8 )* 10000_8
65+ max_attempts = int (particle_bed(b)%num_particles, 8 )* 1000_8
6266 n_placed = 0
6367 n_attempts = 0
6468 seed = particle_bed(b)%seed
@@ -135,20 +139,33 @@ contains
135139 patch_ib(ib_idx)%x_centroid = rx
136140 patch_ib(ib_idx)%y_centroid = ry
137141 patch_ib(ib_idx)%z_centroid = rz
142+ patch_ib(ib_idx)%angles(1 ) = 0._wp
143+ patch_ib(ib_idx)%angles(2 ) = 0._wp
144+ patch_ib(ib_idx)%angles(3 ) = 0._wp
145+ patch_ib(ib_idx)%vel(1 ) = 0._wp
146+ patch_ib(ib_idx)%vel(2 ) = 0._wp
147+ patch_ib(ib_idx)%vel(3 ) = 0._wp
148+ patch_ib(ib_idx)%angular_vel(1 ) = 0._wp
149+ patch_ib(ib_idx)%angular_vel(2 ) = 0._wp
150+ patch_ib(ib_idx)%angular_vel(3 ) = 0._wp
138151 patch_ib(ib_idx)%radius = particle_bed(b)%radius
139152 patch_ib(ib_idx)%mass = particle_bed(b)%mass
140153 patch_ib(ib_idx)%moving_ibm = particle_bed(b)%moving_ibm
141154 end if
142155 end do
143156
144157 if (n_placed < particle_bed(b)%num_particles) then
145- print ' ("WARNING: particle_bed(",I0,"): placed ",I0," of ",I0," particles after ",I0," attempts") ' , &
146- b, n_placed, particle_bed(b)%num_particles, n_attempts
158+ print * , " Error :: Failed to place all IBs ib particle bed "
159+ stop
147160 end if
148161
162+ n_total_placed = n_total_placed + n_placed
149163 deallocate (placed, hash_head, chain_next)
150164 end do
151165
166+ call cpu_time(t_end)
167+ if (proc_rank == 0 ) print ' (a,i0,a,f0.3,a)' , ' Particle beds placed ' , n_total_placed, ' particles in ' , t_end - t_start, ' seconds.'
168+
152169 end subroutine s_generate_particle_beds
153170
154171 !> Xorshift PRNG. Advances seed in - place and returns a value in [0 , 1 ).
0 commit comments