Skip to content

Commit

Permalink
Add a little padding
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherMayes committed Apr 11, 2021
1 parent a012dde commit 76e6d7d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions code/open_spacecharge_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ subroutine deposit_particles(xa, ya, za, mesh3d, qa, total_charge, resize_mesh)
max = [maxval(xa), maxval(ya), maxval(za)]
delta =(max(:) - min(:) ) / (mesh3d%nhi(:) - mesh3d%nlo(:) )

! Small padding to protect against indexing errors
min = min - 1.0e-6_dp*delta
max = max + 1.0e-6_dp*delta
delta =(max(:) - min(:) ) / (mesh3d%nhi(:) - mesh3d%nlo(:) )

mesh3d%min = min
mesh3d%max = max
mesh3d%delta = delta
Expand Down Expand Up @@ -234,6 +239,8 @@ subroutine deposit_particles(xa, ya, za, mesh3d, qa, total_charge, resize_mesh)

n_particles = size(xa)



if (present(qa)) then
mesh3d%charge = sum(qa)
elseif (present(total_charge) .and. .not. present(qa)) then
Expand Down

0 comments on commit 76e6d7d

Please sign in to comment.