-
Notifications
You must be signed in to change notification settings - Fork 509
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
Generic filter for rejecting sources points when sampling #1829
Comments
I've issued a bounty reward for this issue https://www.bountysource.com/issues/98138076-generic-filter-for-rejecting-sources-points-when-sampling |
Could the spawn probability be inhomogeneous and a function of x, y, z? |
I have a branch with this implemented -- just need to clean it up, make it a little more generic, and open a pull request. I should have it out there in the next few weeks. |
@paulromano in some applications, the probability of birth is not homogeneous (see this example). Do you think this feature would allow users to specify a probability distribution or strengths distributions? |
Yes that would also work, the feature provides a cell used to exclude birth locations outside of the volume. You can throw any distribution of points and it will cut out the ones that are not within the cell. |
Oh so the usage would "just" be 1) give a bunch of sources 2) it exclude the sources outside of this cell I thought the usage would be 1) give a cell 2) openmc samples sources in random locations within that cell |
👍 user provides openmc.Source or list of openmc.Source as normal, openmc samples particle birth coordinates then birth coordinates outside of cell/material are excluded. So not quite excluding entire openmc.Sources but particles of sources which is slightly different
This approach is handy as it works for complex cell shapes. This issue also requests exclusion by material as well which will be handy for DAGMC use case where we don't always know the cell ID |
As originally discussed on Discourse https://openmc.discourse.group/t/source-uniform-sampling-in-cell-of-given-material/1062
It would be great to add generic filter to allow the rejection of source points when being sampled during the creation of particles.
Source sampling should allow for rejection of the proposed sampled coordinates if the coordinates are not in a user specified material or not in a user specified cell.
While the generic source sampling filter would be separate to the distributions themselves it could be passed to the distributions and the distributions should make use of the filter to ascertain if the sampling point results in a neutron or not.
Perhaps the best distribution to demonstrate this on is the
openmc.stats.Box
distribution as it already has a similar feature.This will allow us to make interesting shaped sources like the example picture below which shows source sampling randomly across a openmc.stats.Box rejecting sample points that don't appear within a certain material / cell
There are some related lines in OpenMC relating to a similar feature that allows sampling points to be rejected if they are not within a fissionable material with the
only_fissionable
keyword that might be useful for anyone considering this feature.openmc/src/distribution_spatial.cpp
Lines 187 to 204 in efcc0c1
openmc/src/source.cpp
Lines 171 to 173 in efcc0c1
openmc/openmc/stats/multivariate.py
Lines 617 to 716 in efcc0c1
The text was updated successfully, but these errors were encountered: