# Distance-dependent dose rate

**URL:** <https://openmc.discourse.group/t/distance-dependent-dose-rate/2111>\
**Category:** User Support\
**Created:** [June 10, 2022, 1:31pm UTC](https://openmc.discourse.group/t/distance-dependent-dose-rate/2111 "2022-06-10T13:31:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![A66](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@A66](https://openmc.discourse.group/u/A66)\
**Post date:** [June 10, 2022, 1:31pm UTC](https://openmc.discourse.group/t/distance-dependent-dose-rate/2111/1 "2022-06-10T13:31:57Z")

</div>

Hi all,  
I wrote a code to calculate the dose rate. However, when I change the distance from the source to the detector, the dose rate does not change with the distance. I just tried to get the distance by changing the source space. Could you help me?  
Thank you

…

# Create the dectector

# --------------------

det\_rect\_prism = openmc.model.rectangular\_prism(5.0, 10.0, axis=‘z’, origin=(0.0, 0.0))  
det\_zmin = openmc.ZPlane(z0 = -10, boundary\_type = ‘transmission’)  
det\_zmax = openmc.ZPlane(z0 = +0, boundary\_type = ‘transmission’)

detector = det\_rect\_prism & +det\_zmin & -det\_zmax  
detector\_cell = openmc.Cell(fill= cesium\_iodide, region=detector)

# Create a source sphere

# ----------------------------------------------------------------------------

source = openmc.Sphere(x0=+30.0, y0=0.0, z0=0.0, r=2.0, name=‘Source Container’)  
source\_cell = openmc.Cell(fill=None, region=-source)

# Create the external environment

# --------------------------------

sphere = openmc.Sphere(x0=30.0, y0=0.0, z0=0.0, r = 80, boundary\_type = ‘vacuum’)  
environment = -sphere & ~detector & +source  
environment\_cell = openmc.Cell(fill=air, region=environment)

universe = openmc.Universe(cells=[environment\_cell, detector\_cell, source\_cell])

universe.plot(width = (20.0,20.0),basis = ‘xz’)  
geometry = openmc.Geometry(universe)  
geometry.export\_to\_xml()

# Specify the source

#-------------------  
source = openmc.Source()  
source.space = openmc.stats.Point(xyz=(60, 0, 0))\*\*\*  
source.angle = openmc.stats.Isotropic()

# This is a Co60 source, see the task on sources to understand it

source.energy = openmc.stats.Discrete([1.1732e6,1.3325e6], [0.5, 0.5])  
source.particle = ‘photon’  
source.strength = 1.0

settings = openmc.Settings()  
settings.run\_mode = ‘fixed source’  
settings.source = source  
settings.batches = 20  
settings.particles = 100000  
settings.export\_to\_xml()

number\_bins = 101  
bins\_both = np.linspace(0, 1e6, number\_bins)

energy\_function\_filter\_n = openmc.EnergyFunctionFilter(energy\_bins\_n, dose\_coeffs\_n)  
energy\_function\_filter\_p = openmc.EnergyFunctionFilter(energy\_bins\_p, dose\_coeffs\_p)

photon\_particle\_filter = openmc.ParticleFilter([“photon”])  
surface\_filter = openmc.SurfaceFilter(sphere)

tallies = openmc.Tallies()

dose\_tally = openmc.Tally(name=“dose\_tally\_on\_surface”)  
dose\_tally.scores = [“current”]  
dose\_tally.filters = [  
surface\_filter,  
photon\_particle\_filter,  
energy\_function\_filter\_p,  
]  
tallies.append(dose\_tally)  
model = openmc.model.Model(geometry, materials, settings, tallies)  
!rm \*.h5  
sp\_filename = model.run()  
import math

# open the results file

sp = openmc.StatePoint(sp\_filename)

# access the tally using pandas dataframes

tally = sp.get\_tally(name=‘dose\_tally\_on\_surface’)  
df = tally.get\_pandas\_dataframe()

tally\_result = df[‘mean’].sum()  
tally\_std\_dev = df[‘std. dev.’].sum()

# convert from the tally output units of pSv cm² to pSv by dividing by the surface area of the surface

dose\_in\_pSv = tally\_result / (4 \* math.pi \* math.pow(80, 2))

source\_activity = 114190 # in decays per second (Bq)  
emission\_rate = 2 # the number of gammas emitted per decay which is approximately 2 for Co60  
gamma\_per\_second = source\_activity \* emission\_rate  
dose\_rate\_in\_pSv = dose\_in\_pSv \* gamma\_per\_second

# print results

print('The surface dose = ', dose\_rate\_in\_pSv, ‘pico Sv per second’)

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [June 11, 2022, 3:35am UTC](https://openmc.discourse.group/t/distance-dependent-dose-rate/2111/2 "2022-06-11T03:35:28Z")

</div>

It looks like your tally is for the `sphere` surface – because you have an isotropic source inside that sphere and the material is just air, all the photons eventually reach the `sphere` surface, which is why you are not seeing any difference in the tally result as you move the source. You probably want to use a `CellFilter` that specifies the `detector_cell` instead.

---

<div class="post-metadata">

**Author:** ![A66](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@A66](https://openmc.discourse.group/u/A66)\
**Post date:** [June 11, 2022, 5:27pm UTC](https://openmc.discourse.group/t/distance-dependent-dose-rate/2111/4 "2022-06-11T17:27:45Z")

</div>

Should I add it like this?

 ![image](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/e/eb2377a3122d7832517592fa96fba3697848208c.png)

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [June 13, 2022, 2:57pm UTC](https://openmc.discourse.group/t/distance-dependent-dose-rate/2111/5 "2022-06-13T14:57:47Z")

</div>

Yes, that looks right to me.
