openmc-dev / openmc

OpenMC Monte Carlo Code
https://docs.openmc.org
Other
773 stars 503 forks source link

Add conditional probability distribution sampling for more complex spatial sources #1394

Closed eepeterson closed 4 years ago

eepeterson commented 5 years ago

Hi Everyone,

I was wondering if there was any interest in expanding the capabilities of spatial source specification, particularly for fixed source calculations. An example of this is in the context of fusion - a ring source of neutrons in a tokamak could be sampled from independent distributions in r, theta, phi, but not in x, y, z. This capability would then make it possible to easily specify more realistic source distributions that come from fusion plasmas with temperature and density gradients and would make interfacing with plasma equilibrium codes very straight-forward and would be helpful in the design and optimization process. I'm more than happy to try to tackle this with a little guidance from the core developers if this is something people would like to see.

pshriwise commented 5 years ago

Hi @eepeterson! I'd suggest taking a look at #1257.

Our plan there is to provide an option for custom sources that will accept a compiled library as a source and call a specific sample_source signature in that library to retrieve particles. We're hoping that this is more efficient than reading in a static set of source locations and more flexible than compiling a custom source routine into the OpenMC library itself.

eepeterson commented 5 years ago

Hi @pshriwise, thanks for the info! I hadn't come across that PR, but it looks great. The only thing that comes to mind is it seems the barrier to entry / learning curve is slightly steeper. From the standpoints of validation, transparency, publication, and benchmarking, I wonder if there is value in standardizing and distributing a larger array of sources in the OpenMC library itself rather than relying on users to build their own? I totally understand if that is not in line with the project's philosophy or scope, but it was just a thought.

paulromano commented 5 years ago

@eepeterson I'm definitely open to expanding the types of sources that are built in if they are general enough. I think a spatial distribution that allows independent specification in r, theta, and phi would be generally useful and would be happy to provide guidance if you intend to take a stab at it.

eepeterson commented 5 years ago

Thanks @paulromano, I'll take a crack at this over the next day or two and let you know if/when I get stuck.

paulromano commented 4 years ago

@eepeterson Should we close this issue with some of the recent additions now merged (custom source libraries, and your cylindrical/spherical sources)?

eepeterson commented 4 years ago

sounds good to me.