Thank you so much for the reply! I see what you are suggesting, and I think I have an idea. I am not trying to create a plasma source however, I did do this part successful using the “openmc_plasma_source” package for my neutron depletion:
my_source = TokamakSource(
elongation=2.2,
ion_density_centre=1.6e20,
ion_density_peaking_factor=1.52,
ion_density_pedestal=1.0e20,
ion_density_separatrix=0.5e20,
ion_temperature_centre=22,
ion_temperature_peaking_factor=2.25,
ion_temperature_pedestal=4.0,
ion_temperature_separatrix=0.1,
major_radius=610,
minor_radius=120.0,
pedestal_radius=114.0,
mode="H",
shafranov_factor=14.4,
triangularity=0.625,
ion_temperature_beta=7.5,
).make_openmc_sources()
This was the first part of my R2S script, and now I am trying to create the photon sources in my materials after the neutron activation in order to carry out a shutdown dose rate calculation. So far I have this:
results = openmc.deplete.Results("depletion_results.h5")
mesh2 = openmc.RegularMesh()
mesh2.dimension = [71, 29, 59]
mesh2.lower_left = [0, -382, -410] # x,y,z coordinates start at 0 as this is a sector model
mesh2.upper_right = [1000, 0.0, 410]
my_gamma_settings = openmc.Settings()
my_gamma_settings.run_mode = "fixed source"
my_gamma_settings.batches = 10
my_gamma_settings.particles = 10000
my_gamma_settings.dagmc = True
energies, pSv_cm2 = openmc.data.dose_coefficients(particle="photon", geometry="AP")
dose_filter = openmc.EnergyFunctionFilter(
energies, pSv_cm2, interpolation="cubic"
)
mesh_p_particle_filter = openmc.ParticleFilter(["photon"])
mesh_p_filter = openmc.MeshFilter(mesh2)
mesh_p_tally = openmc.Tally(name="p_flux_on_mesh")
mesh_p_tally.filters = [mesh_p_filter, dose_filter, mesh_p_particle_filter]
mesh_p_tally.scores = ["flux"]
my_photon_tallies = openmc.Tallies([mesh_p_tally])
dagmc_bounds = dagmc_univ.bounding_box
min_x, min_y, min_z = dagmc_bounds.lower_left
max_x, max_y, max_z = dagmc_bounds.upper_right
source_space = openmc.stats.Box(
lower_left=[min_x, min_y, min_z],
upper_right=[max_x, max_y, max_z],
only_fissionable=False
)
statepoints_folder = Path('statepoints_folder')
for i_cool in range(1, len(timesteps)):
photon_sources_for_timestep = []
print(f"Making photon source for timestep {i_cool}")
for material in mats:
mat_id = material.id
activated_mat = results[i_cool].get_material(str(mat_id))
energy = activated_mat.get_decay_photon_energy(units='Bq')
strength = energy.integral()
if strength > 0.:
print(f"Material ID: {mat_id}, Energy: {energy}, Strength: {strength}")
source = openmc.IndependentSource(
space=source_space,
energy=energy,
particle="photon",
strength=strength,
#domains=[material]
)
photon_sources_for_timestep.append(source)
if not photon_sources_for_timestep:
print(f"No valid photon sources for timestep {i_cool}")
continue
my_gamma_settings.source = photon_sources_for_timestep
model_gamma = openmc.Model(geometry, mats, my_gamma_settings, my_photon_tallies)
model_gamma.run(cwd=statepoints_folder / "photons" / f"photon_at_time_{i_cool}")
Which is what resulted in an output close to what I was looking for in the image in my post, but there was something amiss with the photon source creation making sources in void and material regions instead of just the materials. This came from the example (Task 11) here: link. If I understand correctly, you think it would be better to use a mesh source rather than an independent source in this scenario while using DAGMC for my geometry?
Thank you immensely!!!