-
Notifications
You must be signed in to change notification settings - Fork 146
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 #1065: source collection fluence #1076
Merged
ftessier
merged 1 commit into
nrc-cnrc:develop
from
blakewalters:fix-source_collection_fluence
Sep 4, 2024
Merged
Fix #1065: source collection fluence #1076
ftessier
merged 1 commit into
nrc-cnrc:develop
from
blakewalters:fix-source_collection_fluence
Sep 4, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blakewalters
requested review from
ftessier,
mainegra and
rtownson
and removed request for
a team
November 13, 2023 18:44
rtownson
changed the title
Fix source collection fluence
Fix #1065: source collection fluence
Dec 4, 2023
Great work Blake! Just a note that this should be rebased to merge into |
rtownson
reviewed
Dec 4, 2023
4 tasks
rtownson
approved these changes
Jun 12, 2024
ftessier
assigned ftessier, mainegra and blakewalters and unassigned blakewalters, ftessier and mainegra
Aug 9, 2024
ftessier
approved these changes
Aug 9, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to adjust commit titles, could use some squashing before merge.
mainegra
approved these changes
Aug 13, 2024
rtownson
force-pushed
the
fix-source_collection_fluence
branch
from
September 4, 2024 16:16
cbbb645
to
a366402
Compare
Fix a bug where the source collection fluence was not calculated properly when multiple transformations were performed on a single base source.
ftessier
force-pushed
the
fix-source_collection_fluence
branch
from
September 4, 2024 18:05
a366402
to
6c738bf
Compare
Rebased on new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fluence for the source collection was not calculated properly in the case of a collection consisting of N transformations, i, of a single base source. EGS_SourceCollection::getFluence() sums the results of getFluence() for the i individual sources. If they are transformations of a single base source, then for each source i, getFluence returns the total fluence (of the base source), F_tot. Thus, EGS_SourceCollection::getFluence() erroneously returns N*F_tot.
The solution is to "detect" a group of sources sharing a common base source by looking for increases in the fluence of source i != j, where j is the source in the collection from which a given particle is being sampled. Before summing individual source fluences, EGS_SourceCollection::getFluence() then multiplies the result of getFluence() for source i by p[i]/p_tot, where p[i] is the user input probability for source i and p_tot is the sum of all probabilities of the N sources sharing the same base source. We are thus able to obtain an estimate of the fluence from each source i.
A further issue occurs when the results of parallel runs are combined. During a parallel run, we store the fluence for each source, i, in the source collection in the .egsdat file from each job. On recombining, results are first added up for each source. If these share a common base source, then these separate additions are actually cumulative with respect to the base source, with the result being that each source, i, will have (erroneous) fluence NF_tot. Then, to obtain the fluence of the source collection, we sum over the N sources, resulting in an additional multiplicative factor of N, so the total fluence is NN*F_tot. In this fix, we now detect when results are being combined and, prior to summing fluence from individual sources, divide by an additional factor N. Note that in order to determine N, we make use of new information written to the .egsdat file for each source i listing the other sources j != i sharing a common base source.
Fixes issue #1065