fusion-energy / openmc-dagmc-wrapper

A Python package that extends OpenMC base classes to provide convenience features and standardized tallies when simulating DAGMC geometry with OpenMC.
https://openmc-dagmc-wrapper.readthedocs.io/
MIT License
7 stars 2 forks source link

CellTally cannot have multiple targets #109

Open RemDelaporteMathurin opened 2 years ago

RemDelaporteMathurin commented 2 years ago

A user would want to have multiple targets on a CellTally. For instance, to compute the TBR on volumes 1, 2 and 3:

my_tally = odw.CellTally(tally_type='TBR', target=[1, 2, 3])

This is not possible currently. We would have to modify CellTally.set_filters...

Or it might be easier to just let the users do

my_tally = openmc.Tally()
my_tally.scores = ['(n,Xt)']  # yes it's not TBR
my_tally.filters = [openmc.MaterialFilter(i) for i in [1, 2, 3]]

Version 1: abstraction (loss of flexibility) + maintainance/development to make it better Version 2: 2 additional lines 😄

shimwell commented 2 years ago

We use to have odwCellTallies for such things which was perhaps also not a good solution.

Up to you, I am happy with both options

RemDelaporteMathurin commented 2 years ago

No CellTallies is not the same thing

CellTallies doesn't inherit from openmc.Tally but is a collection of several CellTally

my_tally = odw.CellTallies(tally_types=['TBR'], targets=[1, 2, 3])
my_tallies = my_tally.tallies

This will create a list of 3 CellTally objects

This is equivalent to

my_tallies = [ odw.CellTally(tally_type='TBR', target=i)  for i in [1, 2, 3] ]