Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for region labels to egs_kerma #1235

Open
wants to merge 68 commits into
base: develop
Choose a base branch
from

Conversation

rtownson
Copy link
Collaborator

@rtownson rtownson commented Dec 13, 2024

Also improve the label replacement algorithm to allow for inputs that have a mix of parameters that are not regions. For example, "start stop delta", where the delta is the increment value.

Use git diff --ignore-space-space to best view the differences. You can do this on github using the gear symbol under Files changed.

ftessier and others added 30 commits August 2, 2023 17:32
Authors of the EGSnrc files are unequivocally identified in the git
commit log. However, we also want to preserve the names of authors and
contributors inside text files headers, as much as possible, in case the
files are extracted from the repository (or the repository eventually
moves to another version control system).

This script compares, for each modified file in a commit range (passed
as the first argument, master..HEAD by default), the commit authors of
the file against the authors and contributors listed in the file header.
It reports the missing names, and returns 1 (error) if some authors are
missing, or 0 (success) otherwise. Binary files are excluded from the
comparison, as well as files that do not contain authorship information.
The latter are reported at the end of the output, skipping over files
that do not contain author information (e.g., image files).

This script is intended to run automatically as a github action. It
implies that all commit authors should be listed under "Contributors",
regardless of the significance of the contribution, so that the script
runs cleanly. The output of the github action should always be inspected
before merging to check the files that don't contain authorship
information.
Clarify that multiple-scattering transport is triggered only if the
intended electron step is longer than a skin depth, even in bulk media
away from any region boundaries. This improves efficiency, because a
multiple-scattering step costs about the same as 3 single-scattering
steps (the default skin depth is 3 mean free paths). Below a skin depth,
it is more efficient (and more accurate) to use single-scattering.
Fix the output message in the egslst file for BEAMnrc simulations about
the number of brems events the took place. When DBS was turned on, it
would always read zero.
Fix a bug in egs_phsp_scoring where the electron energy for IAEA
phase-spaces was written as the total energy instead of the kinetic
energy. This was a critical bug.
Fix a bug where the source collection fluence was not calculated
properly when multiple transformations were performed on a single base
source.
The documentation in the source code for core EGSnrc parameters options
is updated match HEN_HOUSE/src/get_inputs.mortran
This fix divides phase space sources used in parallel runs into
npar*nchunk equal segments, where npar is the number of parallel runs
and nchunk is the number of chunks (defaults to 10). Each chunk of the
parallel run is then assigned its own segment of the phase space source
outside of which it will not sample. This scheme, identical to that used
in the EGSnrc mortran codes, should ensure relatively even sampling of
the phase space source over the entire parallel run.
Any remaining histories after completion of npar*nchunk simulations
chunks reuse particles from the last segment of the phase space file.
Fix typo in hownear when particle in bounding box determining which
of the repeated geometries to check:

Using nz rather than nxy when computing index of repeated geometry array
results in addressing array index out of bounds with subsequent
segfault error.

Showed when electron transport turned ON up during dose calculations
around a CivaDot source using egs_dose_scoring and egs_app and 2 microns
regions.

It did not affect photon-only nor egs_kerma calculations since there is
no call to hownear. ;-)
Fix a bug in egs_circle_perpendicular that made the geometry invalid for
any cases where the circle was expected to face away from the z-axis.
 Changes to be committed:
	modified:   egs++/ausgab_objects/egs_fluence_scoring/egs_fluence_scoring.h
- Added virtual methods setRussianRoulette and splitTopParticleIsotropically
  needed by the radiative splitting object.

 Changes to be committed:
	modified:   egs++/egs_application.h
- Added two new methods needed by the radiative splitting object and
  provided more information in comments.

- Turn ON/OFF EGSnrc internal radiative splitting (UBS)
  void setRadiativeSplitting( const EGS_Float &nsplit );

- Turn ON/OFF EGSnrc internal Russian Roultette + UBS
  void setRussianRoulette( const EGS_Float &iSwitchRR );

- Split particle uniformly in 4Pi
  void splitTopParticleIsotropically( const EGS_Float &fsplit );

 Changes to be committed:
	modified:   egs++/egs_advanced_application.h
- Added two new methods needed by the radiative splitting object and
  provided more information in comments.

- Turn ON/OFF EGSnrc internal radiative splitting (UBS)
  void setRadiativeSplitting( const EGS_Float &nsplit );

- Turn ON/OFF EGSnrc internal Russian Roultette + UBS
  void setRussianRoulette( const EGS_Float &iSwitchRR );

- Split particle uniformly in 4Pi
  void splitTopParticleIsotropically( const EGS_Float &fsplit );

 Changes to be committed:
	modified:   egs++/egs_advanced_application.cpp
rtownson and others added 21 commits October 11, 2024 12:43
Change the output spectra from egs_gammaspec to report the energy at the
middle of each energy bin, instead of the lower edge of the bin.
Fix a bug where some ensdf files from the nndc caused a segmentation
fault for egs_radionuclide source. This was due to comment lines
following gamma records in the file. The code did not check to see if a
normalization record existed before trying to use it, and this has been
fixed.
Fix a bug in egs_ensdf that resulted in the x-rays and auger electrons
in the ensdf file for Zn-65 not being used. This has no impact if the
relaxations are set to the default of using EADL data.
- Total fluence normalization bug during output:

  expression norm /= volume[k];

  reduces normalization for F[k] by V[k-1]*V[k-2]*...*V[1]

  changed to norm = norma/volume[k];

- Eliminate misleading message in fluence scoring When scoring photon
  fluence, no message related to electron fluence calculation method
  should be issued. Thanks to Alexandra Bourgouin for drawing my
  attention to this issue! Fixes issue #1002

- Read user-requested normalization not only when differential fluence
  requested as it is also needed for integral fluence
Same bug affecting total fluence whereby in the case of differential
fluence scoring in multiple regions the normalization for region i was
divided by the volume of the precedent regions.
If estimating differential fluence for several regions, one might want
to turn off diff fluence output to terminal. This can be achieved by
setting

verbose = no

In the AO input block. Added a clarifying message stating that diff
fluence is output as a Grace plot file.
It was being read outside that block which didn't make sense and was
error prone as one would have expected to find it inside that block.
Forgot to use proper spacing in IF block for diff fluence scaling
inputs.
BUG: Commit 8023cd0 labels fluorescent photons from EII as secondaries.
     The pertinent block for UBS and BCSE requires knowledge of the
     local region number IRL, which is only set later in AUSGAB.

FIX: Set IRL above the UBS/BCSE block in the AUSGAB routine.

Funnily enough this bug only showed when using BEAMnrc as library, not
during BEAM simulations. Perhaps IRL was taking values below smaller
than the dimension of the IREGION_TO_BIT array, set to 3000.
Follow-up on previous commit: Why did the bug not appear during
standalone BEAMnrc runs?

During direct BEAMnrc simulations, when IRL isn't set in the block to
split EII-generated secondary photons, it takes value 2, the first
region of the geometry, set during previous calls to AUSGAB.

When using BEAMnrc as a library with other applications, the memory
location IRL is pointing to can change, taking an arbitrary number. In
my case it was a very large integer.
Add libclean target to standard beam_makefile which removes BEAMnrc
library related files. Until now one had to do this manually!
Fixes
=====

- Average source energy calculation was assuming a statistical weight of
  1 and lumping all particles together. Now weight is accounted for, and
  average energy for photons and charge particles scored separately.
  Moreover, average energy of scoring photons is also estimated.

- Typos in differential fluence xmgrace file output

Additions
=========

- Flexible scoring region input spares user from having to enter huge
  number of regions one at the time. Here are the different input
  schemes:

  a) Individual entries using 'scoring regions' input key Simply enter
     scoring regions individually

  b) Initial and final region pairs using `scoring region ranges`
     Expects pairs of initial and final scoring regions

  c) Groups of regions using 'scoring start region' and 'scoring stop
     region' input keys. Requires using two input keys on two lines,
     similar to what is done for the dose scoring ausgab object.

  d) Equally spaced scoring regions using key 'Incremental scoring
     regions' The most general scheme, expects triplets of initial,
     final and increment regions allowing the definition of ranges where
     scoring is performed at specified intervals (increments) between
     regions. Note that using an increment of 1 is equivalent to schemes
     b) and c).

  If an error in these inputs is detected, code aborts with a warning
  message, rather than simply ignoring the error.

- Scoring regions mass input schemes:

  Using `scoring region masses` input key

  a) One value per region, regardless of scoring region input scheme

  b) One value per group (pair or triplet) when using scoring input
     options b, c, or d above.

  c) One value for all regions (positive)

  d) One value for whole scoring volume (negative)

  Using `scoring volume mass` input key assumes mass for whole scoring
  volume as in d).

- Fluence calculation expanded to estimating integral fluence on all
  scoring regions ir for each calculation geometry ig, Ftot(ig,ir), and
  differential fluence (spectrum) Fdiff(ig,E), for each calculation
  geometry ig in the total scoring volume.

  TODO: Add option to specify spectral scoring regions rather than using
        all scoring regions.

- Estimate average mass-energy absorption coefficient in each scoring
  region when integral fluence is calculated.

- Fix small typo in output
The new, more natural way of projection input, had a typo in the projection
variable iproj
Apply astyle 3.1 to a recent rebase on the develop branch.
Add the feature to select regions for source emission for the isotropic
source depending on the medium. The medium selection can include media,
or exclude them. Region selections are combined with the media
selections using an AND operation, so that a valid region must meet both
criteria.
Fix track sorting used for dynamic .ptracks files containing time
indices. Usually the original .ptracks file is overwritten by the sorted
one, but on Windows file deletion may be blocked. As a workaround for
this situation, the sorted .ptracks file is left as a separate file.
Also improve the label replacement algorithm to allow for inputs that
have a mix of parameters that are not regions. For example, "start stop
delta", where the delta is the increment value.
@rtownson rtownson self-assigned this Dec 13, 2024
@rtownson rtownson requested a review from a team as a code owner December 13, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants