44import openmc
55
66
7- def inf_medium_model (cutoff_energy , source_energy ):
7+ def inf_medium_model (cutoff_energy , source_energy , * ,
8+ nuclide = 'Zr90' , density = 1.0 ):
89 """Infinite medium problem with a monoenergetic photon source"""
910 model = openmc .Model ()
1011
1112 m = openmc .Material ()
12- m .add_nuclide ('Zr90' , 1.0 )
13- m .set_density ('g/cm3' , 1.0 )
13+ m .add_nuclide (nuclide , 1.0 )
14+ m .set_density ('g/cm3' , density )
1415
1516 sph = openmc .Sphere (r = 100.0 , boundary_type = 'reflective' )
1617 cell = openmc .Cell (fill = m , region = - sph )
@@ -19,7 +20,7 @@ def inf_medium_model(cutoff_energy, source_energy):
1920 model .settings .run_mode = 'fixed source'
2021 model .settings .source = openmc .IndependentSource (
2122 particle = 'photon' ,
22- energy = openmc .stats .Discrete ([ source_energy ], [ 1.0 ] ),
23+ energy = openmc .stats .delta_function ( source_energy ),
2324 )
2425 model .settings .particles = 100
2526 model .settings .batches = 10
@@ -61,3 +62,34 @@ def test_energy_cutoff(run_in_tmpdir):
6162 # Despite killing particles below the cutoff, the total heating should be
6263 # equal to the source energy
6364 assert heating [0 ] == pytest .approx (source_energy )
65+
66+
67+ def test_positron_cutoff_annihilation (run_in_tmpdir ):
68+ """Positrons below the energy cutoff must still annihilate"""
69+
70+ def run (positron_cutoff ):
71+ model = inf_medium_model (
72+ 1.0e3 , 10.0e6 , nuclide = 'Pb208' , density = 11.35 )
73+ model .settings .batches = 2
74+ # With local energy deposition, charged particles produce no
75+ # bremsstrahlung, so the positron cutoff should have no effect
76+ model .settings .electron_treatment = 'led'
77+ if positron_cutoff is not None :
78+ model .settings .cutoff ['energy_positron' ] = positron_cutoff
79+
80+ tally , heating = model .tallies
81+ tally .filters [0 ] = openmc .EnergyFilter (
82+ [0.0 , 0.5e6 , 0.52e6 , 10.0e6 ])
83+ model .run (apply_tally_results = True )
84+ # The reflective medium absorbs all source energy, including the
85+ # annihilation rest energy, for either positron cutoff.
86+ assert heating .mean .item () == pytest .approx (10.0e6 )
87+ return tally .mean .ravel ()
88+
89+ # Every positron is below a cutoff above the source energy
90+ flux_ref = run (None )
91+ flux_cutoff = run (20.0e6 )
92+
93+ # Annihilation photons contribute to the bin containing 511 keV
94+ assert flux_ref [1 ] > 0.0
95+ assert flux_cutoff == pytest .approx (flux_ref )
0 commit comments