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

Fix g calc type 1 #1228

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

Fix g calc type 1 #1228

wants to merge 4 commits into from

Conversation

mainegra
Copy link
Contributor

@mainegra mainegra commented Nov 28, 2024

First change

Calculation type 1 did not incorporate the changes implemented in 2017 to remove kerma calculation dependency to transport and production thresholds ECUT and AE, as well as the inclusion of electron impact ionization in the $\mu_\mathrm{tr}$ calculation step.

As a result, the $\mu_\mathrm{en}$ and $\mu_\mathrm{tr}$ values calculated using either calculation type do not agree. The mismatch arises from the lack of distinction of the energy deposited by subthreshold events between Auger electrons, which contribute to kerma, and fluorescent photons, which do not.

This issue is addressed by introducing additional AUSGAB calls before and after the routines handling photoelectric effect, Compton scattering, and pair production for type 1 calculations. For type 0 calculations a check is performed in ausgab to apply or not the classification schema, based on the value of the logical variable classify_sub_threshold_relaxations.

Note: Reproducing current NIST $\mu_\mathrm{en}$ values is only possible when this fix is excluded, indicating that the NIST database may need an update to reflect these corrections.

Second change:

Add option to reproduce NIST values by setting input key below to no

    CLASSIFY SUB-THRESHOLD RELAXATIONS = NO

Default set to yes. Input key is NOT case-sensitive!

Documentation

IRS report pirs-3100 (The EGSnrc g application ) has been correspondingly updated. Although not online!

First change:
------------

Calculation type 1 did not incorporate the changes implemented in 2017
to remove kerma calculation dependency to transport and production
thresholds ECUT and AE, as well as the inclusion of electron impact
ionization in the mutr calculation step.

As a consequence, muen and mutr values calculated with either
calculation type do not match. The reason for the mismatch being that
there is no distinction of the energy deposited by sub-threshold events
between Auger electrons and fluorescent photons, with the first being
part of kerma while the second not.

This fix corrects this by mainly adding AUSGAB calls before and after
the routines for photo-effect, Compton scattering and pair production.

Notably, current NIST muen values are only matched without this fix,
suggesting that there might be a need to update those values.

Second change:
-------------

Add option to reproduce NIST values by setting input key below to 'no'

CLASSIFY SUB-THRESHOLD RELAXATIONS = NO

in which case no calls to AUSGAB are made during photon interactions in
the mutr-calculating step of a type 1 calculation. MOreover, for type 0
calculations a check is performed in ausgab to apply or not the
classification schema or not, based on the value of the logical variable
classify_sub_threshold_relaxations. Default set to `yes`.
The option to select whether to process the Latex document into a pdf
was mistakenly searching for `eq=` rather than `latex=`
Reflect latest changes:

- Bug fix: harmonizing calculation types 0 and 1 by incorporating 2017
  refinements to type 1.

- Describe option to reproduce NIST values
Since available for calculation types 0 and 1.
@mainegra mainegra requested a review from a team as a code owner November 28, 2024 21:51
@mainegra mainegra requested review from ftessier, rtownson and blakewalters and removed request for a team November 28, 2024 21:51
@mainegra mainegra changed the base branch from master to develop November 28, 2024 21:52
@mainegra mainegra self-assigned this Nov 28, 2024
IF (classify_sub_threshold_relaxations)[
$AUSCALL($PAIRAUSB);
]
call pair;
Copy link
Member

Choose a reason for hiding this comment

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

Reduce indentation for call pair;

@@ -887,7 +911,7 @@ DO icase=1,ncase [
erad_tmp = 0.0; "loses just to annihilation"
"initialize etot_tmp differently for photons and electrons"
IF( iqin .ne. 0 ) [ etot_tmp = (ein - rm); ]
ELSE [ etot_tmp = 0; ]
ELSE [ etot_tmp = 0; ]
Copy link
Member

Choose a reason for hiding this comment

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

It is best to avoid if-else one-liner statements.

allowed_inputs(ival,0) = 'NO';
allowed_inputs(ival,1) = 'YES';
$GET_INPUT(IVAL);
IF( error_flag = 0 ) [
Copy link
Member

Choose a reason for hiding this comment

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

Ideally, we would harmonize the IF bracketing style. My perspective is that we ought to settle on conditional branch style with spaces around (...) (no spaces inside the brackets, and one space before the opening [

IF (...) [
  ...
]
ELSE (...) [
  ...
]

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.

2 participants