Source uniform sampling in cell of given material

I am running some fixed-source simulations and am trying to find a method of creating a source uniformly within a cell.

This is a plasma within a Tokamak so the cell is not not a simple sphere or cylinder. Actually it is a DAGMC volume so not even a CSG cell.

Anyway I noticed that there is a feature that is nearly what I am after where an openmc.stats.Box can be made around the cell and the only_fissionable can be set to True and this select sites that are inside the fissionable material.

https://docs.openmc.org/en/stable/pythonapi/generated/openmc.stats.Box.html

I am after something similar but perhaps a more generic version of this only_fissionable argument where the user passes a material as the argument and the result is that the cell within the box that contains the material is then sampled uniformly.

Wondering if anyone has any hints, suggestions or ideas on this.

Thanks in advance

Jon

1 Like

Yeah, that’s a great idea Jon. I’ve had a similar thought that there should be some sort of general “filter” capability that allows source sites to be accepted or rejected based on a criterion. Right now, the only thing we have is, as you mentioned, the ability to reject particles in non-fissionable materials, but expanding this would be very useful. We could have reject by cell, rejection by material, etc. My thought is that this notion should be separate from the distribution itself, which could be uniform or otherwise. I’d have to think about what the API and user input would look like for this. If you have thoughts on that, please do share!

1 Like

Separate from the distribution sounds like a good option, it is sound a bit like a MaterialFilter CellFilter that can be applied to a source.

Perhaps something like this …

source = openmc.Source()
source.CellFilter([list_of_acceptable_cells])
source.MaterialFilter([list_of_acceptable_materials])

I’ve raised an issue for this feature and put a bounty reward on it

Just want to say that this feature would be highly useful for me as well!