# Tally give no result , error sources

**URL:** <https://openmc.discourse.group/t/tally-give-no-result-error-sources/3990>\
**Category:** User Support\
**Created:** [March 1, 2024, 1:22pm UTC](https://openmc.discourse.group/t/tally-give-no-result-error-sources/3990 "2024-03-01T13:22:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Al-Ghamdi](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@Al-Ghamdi](https://openmc.discourse.group/u/Al-Ghamdi)\
**Post date:** [March 1, 2024, 1:22pm UTC](https://openmc.discourse.group/t/tally-give-no-result-error-sources/3990/1 "2024-03-01T13:22:05Z")

</div>

Hi  
It was very useful to read through the posts here to build my first file, which helped me improve the file to run. However, the tally doesn’t provide results. The idea of this simulation is to construct an exercise to measure the flux absorption fraction at the detector (sphere z=100) due to a sample at z=50 cm and the source near z=0. I used a sphere for now for the sake of simplicity in their description further the sample will be change to a disc. I looked carefully into geometry and cells definition but still no result in scoring flux at detector assumed cell.  
here is the file  
%matplotlib inline  
import openmc  
import matplotlib.pyplot as plt

sample= openmc.Material(material\_id=1, name=‘SAMPLE’)  
sample.add\_nuclide(‘Al27’,1)  
sample.set\_density(‘g/cm3’, 2.7)

air = openmc.Material(material\_id=2, name=‘air’)  
air.add\_element(‘N’, .788903, ‘ao’)  
air.add\_nuclide(‘O16’, .211097, ‘ao’)  
air.set\_density(‘atom/b-cm’, 4.614e-5)

materials = openmc.Materials([sample , air])

# 

materials.cross\_sections =‘/…/endfb71/endfb-vii.1-hdf5/cross\_sections.xml’  
materials.export\_to\_xml()

s101= openmc.Sphere(x0=0, y0=0,z0=50, r=10,boundary\_type=‘transmission’)  
s202= openmc.Sphere(x0=0, y0=0,z0=100, r=10,boundary\_type=‘transmission’)  
s303= openmc.Sphere(x0=0, y0=0,z0=80, r=70,boundary\_type=‘transmission’)  
s404= openmc.Sphere(x0=0, y0=0,z0=80, r=75,boundary\_type=‘vacuum’)

# cells

cell1 = openmc.Cell(name=‘Sample\_50cm’)  
cell1.fill = sample  
cell1.region = -s101 # & +s202

cell2 = openmc.Cell(name=‘Detector’)  
cell2.fill = air  
cell2.region = -s202 # & +s101

cell3 = openmc.Cell(name=‘air’)  
cell3.fill = air  
cell3.region = -s303 & +s101 & +s202

cell4 = openmc.Cell(name=‘viod’)  
cell4.region = -s404 & +s303 # & +s101 & +s202

# universes

univ = openmc.Universe(cells=[cell1, cell2, cell3, cell4]) #  
geom = openmc.Geometry(root=univ)

# 

geom.export\_to\_xml(‘geometry.xml’)

geom.plot(width=(200, 300), basis=‘xz’, label=‘cell’)

# Settings

settings = openmc.Settings()  
settings.batches = 100  
settings.inactive = 10  
settings.particles = 10000  
settings.run\_mode = ‘fixed source’

# source

source = openmc.Source()  
source.space = openmc.stats.Point((0, 0, 10))  
source.angle = openmc.stats.Isotropic()  
source.energy = openmc.stats.Discrete([01.2e6], [1.0])  
settings.source = source

# 

# flux tally

# 

tallies = openmc.Tallies()  
tally = openmc.Tally(name=‘flux’)  
tally.filters = [openmc.CellFilter(cell2)]  
tally.scores = [‘flux’]

settings.tallies = [tally]

settings.export\_to\_xml()

# Run OpenMC!

!openmc

Any help will be appreciated  
Thank you

---

<div class="post-metadata">

**Author:** ![wxinyan](https://avatars.discourse-cdn.com/v4/letter/w/e19adc/32.png) [@wxinyan](https://openmc.discourse.group/u/wxinyan)\
**Post date:** [March 6, 2024, 4:14pm UTC](https://openmc.discourse.group/t/tally-give-no-result-error-sources/3990/2 "2024-03-06T16:14:32Z")

</div>

Hi Al-Ghamdi,

Tally is not a part of settings. The last two lines of your flux tally block should be:

tallies = [tally] # not settings.tallies = [tally]  
tallies.export\_to\_xml() # not settings.export\_to\_xml()

Hope this helps!

Xinyan

---

<div class="post-metadata">

**Author:** ![Al-Ghamdi](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@Al-Ghamdi](https://openmc.discourse.group/u/Al-Ghamdi)\
**Post date:** [March 6, 2024, 5:01pm UTC](https://openmc.discourse.group/t/tally-give-no-result-error-sources/3990/3 "2024-03-06T17:01:03Z")

</div>

Hi waxinyan  
Yes that was one part of the problem the other i solved regarding the definitions of cell 1 and 2.

Thank you
