Distance-dependent dose rate

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’)

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.

Should I add it like this?

Yes, that looks right to me.