I have a series of materials to be simulated, based on previous depletion simulation:
depMaterials = [depResult.export_to_materials(m, path=join(loadDir, 'materials.xml'))
for m in range(0, timeslots+1, 2)]
I tried using this simple loop:
with change_directory(saveDir):
for i, materials in enumerate(depMaterials):
model = mc.Model(
materials=depMaterials[i], geometry=geometry, settings=settings, tallies=tallies
)
model.export_to_xml(remove_surfs=True)
with lib.run_in_memory():
lib.reset()
model.run()
lib.statepoint_write(f"depletion_tallies_n{i}.h5")
and it’s working, but with one side-effect: the program initialize, load all the cross-sections data, and finalize, for every iteration. So it’s not very efficient.
I then tried to replace the code above with this:
with change_directory(saveDir):
model.export_to_xml(remove_surfs=True)
with lib.run_in_memory():
for chainNuc in depChain.nuclides:
nuclide = chainNuc.name
if nuclide not in lib.nuclides and nuclide in xsNucs:
lib.load_nuclide(nuclide)
for i, materials in enumerate(depMaterials):
lib.reset()
model.run()
lib.statepoint_write(f"depletion_tallies_n{i}.h5")
print(lib.nuclides)
Now the data is load first based on the depletion chain used in all of those materials. However, it doesn’t correctly simulate other nuclides that didn’t present in the initial material. What did I do wrong in the code above?
Thanks in advance.
Cheers,
Chris.