Skip to content

Commit

Permalink
Fixed error for zero beam sizes (mostly with zero current slices) for…
Browse files Browse the repository at this point in the history
… the calculation of the space charge field.
  • Loading branch information
svenreiche committed Jun 6, 2024
1 parent 9e8fb80 commit d35b727
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### [4.6.6] - 2024/06/05
- fixed: Running non 1-4-1 simulations (aka quiet loading) with zero current (e.g. step profile) causes NaN events in the particle phase for the calculation of the shot noise. It ripples through the simulation producing more NaN in other parameters.
- fixed: Zero current slices caused a division by zero error in the calculation of the space charge field.

### [4.6.6] - 2024/04/18
- fixed: changing elements via the lattice-namelist methods works again after ignoring any sequence.
Expand Down
4 changes: 4 additions & 0 deletions src/Core/EFieldSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ void EFieldSolver::longRange(Beam *beam, double gamma0, double aw) {
for (int i=0; i<nsize;i++){
work1[i]=beam->current[i];
work2[i]=beam->getSize(i);
if (work2[i] <= 0) { // check for zero current slices which have also no beam size and therefore will cause a NaN
work1[i] = 0;
work2[i] = 1;
}
}

// gathering information on full current and beam size profile
Expand Down

0 comments on commit d35b727

Please sign in to comment.