# Discussion on surfaceFilter tally output

**URL:** <https://openmc.discourse.group/t/discussion-on-surfacefilter-tally-output/5400>\
**Category:** User Support\
**Created:** [April 1, 2025, 6:22pm UTC](https://openmc.discourse.group/t/discussion-on-surfacefilter-tally-output/5400 "2025-04-01T18:22:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sayed\_Ahmed](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@Sayed\_Ahmed](https://openmc.discourse.group/u/Sayed_Ahmed)\
**Post date:** [April 1, 2025, 6:22pm UTC](https://openmc.discourse.group/t/discussion-on-surfacefilter-tally-output/5400/1 "2025-04-01T18:22:26Z")

</div>

Hi all:  
I am having a difficulty measuring ‘current’ through a spherical geometry while using 2 different materials at 2 different regions. I have declared the geometry and defined the materials as following: (I am adding the code as text here)

import openmc  
import numpy as np  
import pandas as pd  
import openmc.geometry  
import openmc.stats  
openmc.config[‘cross\_sections’]=‘/Users/sayedahmed/Downloads/Cross\_section/endfb-viii.0-hdf5/cross\_sections.xml’

z=10 #first material distance so that removal CS times z is less than 5 and approximately 2  
x=120 #detector distance

#Spheres  
outer\_sphere= openmc.Sphere(r=200, boundary\_type=‘vacuum’)  
detector\_sphere= openmc.Sphere(r=z+x)  
first\_sphere= openmc.Sphere(r=z)

#regions  
inside\_outer= -outer\_sphere & +detector\_sphere #everything between outer\_sphere and detector sphere  
detector\_region= -detector\_sphere & +first\_sphere #everything between detector sphere and first sphere  
additional\_material\_region= -first\_sphere #everything inside first sphere

#Cells  
water\_cell= openmc.Cell(name=‘Water’, fill=water, region=inside\_outer)  
detector\_cell= openmc.Cell(name=‘Detector’, fill=water, region=detector\_region)  
first\_cell= openmc.Cell(name=‘Shield’, fill=additional\_material, region=additional\_material\_region)

#universe  
universe= openmc.Universe(cells=[water\_cell,detector\_cell,first\_cell])  
geometry= openmc.Geometry(universe)  
geometry.export\_to\_xml()  
a=1.18e6

b=1.03419e-6

energy\_dist= openmc.stats.Watt(a,b)

#Neutron source

source = openmc.IndependentSource()

source.space = openmc.stats.Point((0.0,0.0,0.0))

source.angle = openmc.stats.Isotropic()

source.energy = energy\_dist

#Settings

settings= openmc.Settings()

settings.source= source

settings.batches=100

settings.inactive=10

settings.particles= 100000

settings.run\_mode= ‘fixed source’

settings.export\_to\_xml()  
#Tallies

tallies=openmc.Tallies()

surface\_filter= openmc.SurfaceFilter(detector\_sphere)

energy\_filter= openmc.EnergyFilter([0.0, 0.625])

tally= openmc.Tally(name=‘Thermal fluence’)

tally.filters.append(surface\_filter)

tally.filters.append(energy\_filter)

tally.scores= [‘current’]

tallies.append(tally)

tallies.export\_to\_xml()

using this material, neutron source, geometry and tallies the output current I am getting is 0. However, if I change the material from Pt to Pb and double the radius of the first sphere then I get a value of output current. What must I do to be able to measure current for any material??

Any reply from anyone is highly appreciated!!  
Regards  
Sayed

---

<div class="post-metadata">

**Author:** ![pferney](https://avatars.discourse-cdn.com/v4/letter/p/838e76/32.png) [@pferney](https://openmc.discourse.group/u/pferney)\
**Post date:** [April 3, 2025, 5:36pm UTC](https://openmc.discourse.group/t/discussion-on-surfacefilter-tally-output/5400/2 "2025-04-03T17:36:53Z")

</div>

What is your material definition ? It seems you filter only thermal and epithermal neutrons while you have a case with no moderation. So the statistics you will build will be poor.

Check your source (energy spectrum) definition and materials, make sure they make sense in the case you want to study.

Otherwise, you can try using weightwindows to improve statistics.

---

<div class="post-metadata">

**Author:** ![Sayed\_Ahmed](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@Sayed\_Ahmed](https://openmc.discourse.group/u/Sayed_Ahmed)\
**Post date:** [April 3, 2025, 6:05pm UTC](https://openmc.discourse.group/t/discussion-on-surfacefilter-tally-output/5400/3 "2025-04-03T18:05:09Z")

</div>

Thanks for your reply!  
I want to see the moderation effect of water. So I have described the neutron source to emit fast neutrons(built in watt distribution function) and want to measure the current or flux at a distance of 120 cm to see the moderation effect of water and the effect of any other material between the source and the water.  
And I am getting a tally output 0 for current.  
What must I do to get a value of tally output using this model?

Also if I have to use weightwindow near the detector surface which requires creating a mesh.. Can you guide me how to do that properly while defining a mesh near a spherical surface?

---

<div class="post-metadata">

**Author:** ![pferney](https://avatars.discourse-cdn.com/v4/letter/p/838e76/32.png) [@pferney](https://openmc.discourse.group/u/pferney)\
**Post date:** [April 3, 2025, 6:28pm UTC](https://openmc.discourse.group/t/discussion-on-surfacefilter-tally-output/5400/4 "2025-04-03T18:28:24Z")

</div>

What is your definition of water ? It is also slightly absorbant so your neutron might disappear before reaching your surface. Try lowering x to 5. or 10. to check if you have a current. if you do have current, it means your detector is too far and you will need to use WW

Here is helpful ressources to help you with WW [openmc\_weight\_window\_generator/examples/generate\_iterative\_weight\_windows.ipynb at master · fusion-energy/openmc\_weight\_window\_generator · GitHub](https://github.com/fusion-energy/openmc_weight_window_generator/blob/master/examples/generate_iterative_weight_windows.ipynb)

---

<div class="post-metadata">

**Author:** ![Sayed\_Ahmed](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@Sayed\_Ahmed](https://openmc.discourse.group/u/Sayed_Ahmed)\
**Post date:** [April 3, 2025, 6:58pm UTC](https://openmc.discourse.group/t/discussion-on-surfacefilter-tally-output/5400/5 "2025-04-03T18:58:02Z")

</div>

Thank you so much for your time!
