Skip to content

Commit

Permalink
Fix #425: irold not updated in electron step loop
Browse files Browse the repository at this point in the history
Assign the current particle region, ir(np), to the old region index,
irold, within the ustep loop in electron transport. Previously, irold
was not updated, so the irnew ~= irold condition added to fix magnetic
field transport in vacuum caused zero-size steps to skip the region
change macro. Remove the now redundant irold = ir(np) assignment in the
non-zero step size block.
  • Loading branch information
ftessier committed Apr 18, 2018
1 parent 1aba1b2 commit 571baca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions HEN_HOUSE/src/egsnrc.mortran
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,8 @@ $start_new_particle;

$SET-USTEP-EM-FIELD; "additional ustep restriction in em field
"default for $SET-USTEP-EM-FIELD; is ;(null)
irnew = ir(np); "default new region is old region
irold = ir(np); "save current region
irnew = ir(np); "default new region is current region
idisc = 0; "default is no discard (this flag is initialized here)
ustep0 = ustep; "Save the intended ustep."

Expand Down Expand Up @@ -1381,7 +1382,6 @@ $start_new_particle;
"(dnear is distance to the nearest boundary
" that goes along with particle stack and
" which the user's howfar can supply (option)
irold = ir(np); "save previous region
$SET-ANGLES-EM-FIELD;
"default for $SET-ANGLES-EM-FIELD; is ; (null)
"(allows for EM field deflection
Expand Down

1 comment on commit 571baca

@ThiloICNS
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this bug!! I struggled several days with this issue. 👌

Please sign in to comment.