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

A generic fluence scoring ausgab object (AO) #836

Merged
merged 18 commits into from Jan 23, 2023

Conversation

mainegra
Copy link
Contributor

Scores fluence in user-defined regions (volumetric) or at a circular or rectangular field (planar) located in an arbitrary position in space. Scoring can be done for either photons, electrons or positrons. Scoring for multiple particle types, can be accomplished by defining as many fluence scoring AOs as required.

@rtownson
Copy link
Contributor

This should be rebased for merging onto develop.

@ftessier ftessier added this to the Release 2022 milestone Jul 20, 2022
@ftessier ftessier marked this pull request as ready for review July 20, 2022 16:47
@ftessier ftessier requested a review from a team as a code owner July 20, 2022 16:47
@ftessier
Copy link
Member

@mainegra can you change the target branch to develop; and perhaps rebase on develop? 🙏🏻

@mainegra
Copy link
Contributor Author

Will do when I get to a PC. Probably this afternoon .... 😉

@mainegra
Copy link
Contributor Author

@ftessier I am working on the documentation for this AO frantically. Needs a bit of work. Once I have a basic, decent, draft I will change the target to develop and rebase. Cheers!

@ftessier
Copy link
Member

No worries, no rush! 😃

@ftessier
Copy link
Member

Rebased on develop.

@ftessier ftessier changed the base branch from master to develop July 28, 2022 03:05
@mainegra
Copy link
Contributor Author

@ftessier I managed to push the latest commits. PR should be ready for merge. There is some decent (hopefully) documentation for this AO. I also added the link Ausgab objects to the main page of PIRS-898.

@ftessier
Copy link
Member

Squash commits and adjust commit messages. No code change, with original branch (rebased on develop), as confirmed by git diff.

@ftessier
Copy link
Member

Large formatting commit after running astyle on modified files. This is a format-only commit, no functional change.

@ftessier
Copy link
Member

Same as before, simply removed a spurious EOL space.

Copy link
Contributor

@blakewalters blakewalters left a comment

Choose a reason for hiding this comment

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

Nice job, @mainegra! I didn't subject this to exhaustive testing, but I did try out planar and volumetric fluence output (along with spectra) for one simulation and the output was clear and straightforward (once I figured out that the Volume= input is not optional in volumetric scoring), and I can already see using this AO quite a bit. On my machine (Mac running clang c++), though, compilation failed with:

egs_fluence_scoring.cpp:1399:22: error: invalid suffix 'D' on floating constant
    if (norm_u != 1.0D+0) {

Once I removed the D+0 it compiled fine. I suspect this error wouldn't show up with g++, but maybe should be addressed for generality.

@ftessier
Copy link
Member

ftessier commented Oct 31, 2022

@mainegra, what was the intent of the D suffix, double (which is the default) or long double (which is L)? I presume this is meant to be a double literal, so we can just remove the D. right?

mainegra and others added 18 commits January 23, 2023 10:12
- EGS_Interpolator: increase array size when creating an interpolator
  based on an array of value pairs to have an extra bin to prevent
  round-off errors. This is also done by PEGS4 when determining fit
  parameters for each interval. The extra bin uses the same parameters
  as the previous one, i.e., it extrapolates.

- Add auxiliary methods to application classes to get electron step size,
  energy deposited and app source type.

- Fluence scoring: at a plane, in regions for all particles.
Get proper stopping power interpolator depending on charge.
- Add "clean" target for dose and fluence scoring objects (instead of
  manually deleting files when building the ausgab object). Need to add
  to the rest of the ausgab objects!

- One can now define DEBUG=-DDEBUG to turn on some debugging messages that
  I found useful.

- Add MYDEF for user defines: use MYDEF=-DDEBUG to activate debugging
  messages and variables.
Reworked the classes for planar and volumetric fluence scoring to
descend from a common base class which contains many commonalities, to
avoid code duplication. Should have started that way!
Add auxiliary functions to application classes, required by the fluence
scoring ausgab object.
- Add a method to get the charge of a base source, which returns -99 by
  default, matching the unknown type of the fluence scoring ausgab
  object. A base source does not know the charge of its particles unless
  it is later derived from a simple source. For instance a collection of
  sources, a beam source, or a phase space source will contain multiple
  type of particles.

- Sources derived from the class EGS_SimpleSource return the source
  particle's charge.

- Add a method to get source charge from the application.
Add an application-level method to obtain the maximum energy of the
source. This proves useful for ausgab objects that need this
information.
- Add option to define regions from where to score planar fluence to
  improve efficiency of charged particle calculations.

- Move many common tasks to the base class EGS_FluenceScoring.

- Fix group scoring region definitions.

- Improve logic for defining scoring regions in planar scoring class.

- Document classes with Doxygen comments.
- Add the ability to divide fluence in total and primary fluence.

- Add the ability to calculate integral and differential fluence.

- Improve output format.

- Investigate the effect of scoring integral charged particle fluence
  using either EDEP (within differential scoring block) or directly
  TVSTEP:

  a) Identical for FLURZ-like calculation
  b) Small, negligible differences using stprO3 and stpwrO5

  This allows extraction of the integral fluence scoring from the blocks
  for differential fluence. When one is only interested in the integral
  fluence, the calculation is up to 10% faster using a TVSTEP-based
  approach.

  Current implementation allows switching between EDEP-based and
  TVSTEP-based integral fluence calculation via the pre-processor define
  USETVSTEP. To use TVSTEP-based integral dose calculation use:

  make MYDEFS=-DUSETVSTEP

  Next iteration will only use the TVSTEP-based approach for integral
  fluence as both approaches result in negligible differences.

- Add mechanism to track the distribution of number of energy bins
  covered when spreading EDEP. This is activated via the define variable
  DEBUG: to use it, build the fluence scoring ausgab object using:

  make MYDEFS=-DDEBUG

  One can also trace the difference between the step derived from
  spreading EDEP over the energy grid and TVSTEP via DEBUG.
- Add input blocks to define the energy grid and the scoring options
  based on the scoring type.

- Improve output format.
Remove example for base class and add specific blocks for planar an
volumetric scoring inputs.
- Remove initial approach to score charged particle integral fluence
  from each contribution to the differential fluence. Now is uses TVSTEP
  and computes integral fluence in one go.

- Remove checks for pre-processor directive USETVSTEP as it not needed
  anymore.

- Polish documentation.
@ftessier
Copy link
Member

Rebased on develop.

@ftessier ftessier merged commit 1dc907a into nrc-cnrc:develop Jan 23, 2023
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.

None yet

4 participants