-
Notifications
You must be signed in to change notification settings - Fork 570
[Point Detector] Add distribution get_pdf functionality #3550
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
base: develop
Are you sure you want to change the base?
Conversation
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.
Nice work @itay-space!
My review focus more on the code structure side of things.
I did not check the maths.
Co-authored-by: GuySten <62616591+GuySten@users.noreply.github.com>
Co-authored-by: GuySten <62616591+GuySten@users.noreply.github.com>
Co-authored-by: GuySten <62616591+GuySten@users.noreply.github.com>
Co-authored-by: GuySten <62616591+GuySten@users.noreply.github.com>
Co-authored-by: GuySten <62616591+GuySten@users.noreply.github.com>
Co-authored-by: GuySten <62616591+GuySten@users.noreply.github.com>
Co-authored-by: GuySten <62616591+GuySten@users.noreply.github.com>
Co-authored-by: GuySten <62616591+GuySten@users.noreply.github.com>
@GuySten I saw the changes you made, and I have a few conclusions. You’re right that the PDF functions themselves don’t need a seed. But there’s an important caveat: we do need the outgoing energy that was sampled in the original transport step, because the PDF of mu depends on it (see, for example, the Kalbach–Mann distribution). The distributions where you implemented angular_pdf and conditional_sample_energy are only the special cases where they are independent. |
@itay-space, I am still working on the implementation for more distributions. Some of them are harder than others. |
@itay-space, after looking at your comment and further thinking I have reached the following conclusions: Theoretically the angular_pdf for every distribution is defined and computable but it may be hard to calculate it. Theoretically I could try to derive the exact mathematical expressions for the angular_pdf but it is a headache. |
@GuySten Right, that’s exactly why the seed was used - to sample the outgoing energy. If we can somehow share the outgoing energy that was sampled in the sample function with the get_pdf function, that would be great. But if not, then I suggest we go back to the original implementation with the seed. |
The fact that we need the seed to sample the outgoing energy is not that surprising. Because in theory the exact angular pdf does not depend on the outgoing energy at all! |
If all the tests will pass and nobody will object I am planning to merge this PR at the start of next week. Now the names we use should not clash with the source biasing PR. @eepeterson, @itay-space, @j-fletcher, if you have further comments you have until start of next week. |
I do have additional comments, thanks for your patience.
|
|
@GuySten @eepeterson |
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.
Putting a placeholder review as I'd like to take a look at this before we merge.
Hello all, apologies for the delay here.
|
@itay-space, I noticed that the calculation of the uncollided contribution to the point detector tally is using the probability density function of emitting a particle in a specific direction. I think that we should extend this PR (or maybe add another PR) that will add evaluate function for the classes that inherit from UnitSphereDistribution. I propose the signature: double evaluate(Direction u) to match the signature of the rest of the 1d distribution functions. |
@GuySten , Thanks for the suggestion! These classes already rely on two independent 1D distributions (polar and azimuthal), and the evaluate methods are implemented at that level. The sphere distributions just combine those underlying 1D PDFs, so the functionality is already covered. |
@itay-space, the conversion is not trivial because of the reference direction, so I think that adding this functionality is worth while. |
@GuySten I’m not sure why this would be different from the other cases (I can’t see it right now), but sure, go ahead and add the functionality. I have no objections. Thanks! |
I am waiting for #3582 to be merged to add the functionality I talked about. |
@paulromano, I am reminding you to look at this PR when you have some time. |
Description
This PR is the first step in breaking down the point detector tally project into smaller, reviewable pieces, following the large PR #3109
and the paper Development and benchmarking of a point detector in OpenMC.
As suggested during the earlier discussion (thanks @GuySten, @gridley, @shimwell !), the natural starting point is to add the ability to correctly calculate PDFs on the C++ side.
Accordingly, this PR introduces the get_pdf implementations for the distribution classes. This is essentially a clean cut from the original large PR, with the goal of keeping the scope focused and review manageable.
We plan to follow up with tests and additional pieces of the point detector work in subsequent PRs.
Checklist