Skip to content

Commit dc433b6

Browse files
Updated to long precicion to not overflow particle placement
1 parent a70fe62 commit dc433b6

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/simulation/m_particle_bed.fpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ contains
2222
impure subroutine s_generate_particle_beds()
2323

2424
integer :: b, ib_idx, geom
25-
integer :: n_placed, n_attempts, max_attempts
25+
integer :: n_placed
26+
integer(8) :: n_attempts, max_attempts
2627
real(wp) :: xmin, xmax, ymin, ymax, zmin, zmax, min_dist
2728
real(wp) :: rx, ry, rz, dist
2829
integer :: seed
@@ -57,7 +58,7 @@ contains
5758
dz_hi = 1
5859
end if
5960

60-
max_attempts = particle_bed(b)%num_particles*10000
61+
max_attempts = int(particle_bed(b)%num_particles, 8)*10000_8
6162
n_placed = 0
6263
n_attempts = 0
6364
seed = particle_bed(b)%seed
@@ -141,8 +142,8 @@ contains
141142
end do
142143

143144
if (n_placed < particle_bed(b)%num_particles) then
144-
print '("WARNING: particle_bed(",I0,"): placed ",I0," of ",I0," particles after ",I0," attempts")', b, n_placed, &
145-
& particle_bed(b)%num_particles, n_attempts
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
146147
end if
147148

148149
deallocate (placed, hash_head, chain_next)

0 commit comments

Comments
 (0)