Hey guys,
I am having a really strange issue of the generated model.xml file not having the correct amount of batches? I am wanting to run a depletion with 30 batches per timestep.
model = openmc.model.Model(geometry,materials_collection, settings,tallies_file)
model.export_to_xml()
print(f"Model batches: {model.settings.batches}")
>>> Model batches: 30
As you can see above model.settings.batches is supposedly set to 30, but when i check this manually in the terminal like below it is obvious that this is not what is set in the model.xml file?
grep -w "batches" model.xml settings.xml
model.xml: <batches>500</batches>
settings.xml: <batches>30</batches>
I have looked through my code to see where i could have set it to 500 but i really don’t see it. my setup-code doesn’t even contain the number 500.
This is happening before I run the depletion btw. 500 batches takes too long for the purposes of my project. This is really frustrating haha. Would be great if anyone had insight here
If anyone is wondering, the following is all the code where settings is mentioned:
settings = openmc.Settings()
settings.batches = N_batches #How many iterations of neutron generations
settings.inactive = 10 #How many generations used to determine sample spots
settings.particles = 10000 #Number of neutrons in each generation
settings.temperature = {'method': 'interpolation'}
#The following section tells OpenMC where to sample particle sites.
total_width = 300
bounds = [ ]
if point_distribution:
point_dist = openmc.stats.Point((0.0, 0.0, 203.83)) # spatial distribution of initial neutron source # point in center of active region
settings.source = openmc.IndependentSource(space=point_dist) # initial neutron source to start chain reaction # for example some type of neutron generator
else:
uniform_dist = openmc.stats.Box(lower_left=(-total_width/2, -total_width/2, 150), upper_right=(total_width/2 ,total_width/2 ,300)) # type: ignore
if constraints_fissionable:
settings.source = openmc.IndependentSource(space=uniform_dist, constraints={'fissionable': True}) # initial neutron source to start chain reaction # for example some type of neutron generator
else:
settings.source = openmc.IndependentSource(space=uniform_dist)
########## Making mesh ################
mesh = openmc.RegularMesh() #Making a mesh instance
mesh.dimension = [100,100] #Setting the bins of the mesh to 100 x 100 bins
mesh.lower_left= (-total_width/2, -total_width/2) #Setting lower left coordinates
mesh.upper_right = (total_width/2 ,total_width/2) #Setting upper right coordinates
####################################################################
################# Shannon entropy ##################################
#Part 1 C
if shannon_entropy:
settings.entropy_mesh = mesh
# ---------- Exporting settings ----------
settings.export_to_xml()
I am running OpenMC version 0.15.3
*Edit
I manually changed the batches in model.xml to 30, and literally without changing anything else, it is staying that way. There seems to be an issue with setting the batches in the model.xml file?
* Edit 2
Whether or not it is purposeful or not, 30 batches per timestep is certaintly not enough, as i get inf deviation on k_eff oops. Will have to put it higher, and probably search around for more appropriate settings anyway
* Edit 3
I think i found the issue? model.export._to_xml() does not actually generate an xml file? I get no error to indicate that this is the case though. I’m not sure if this is a local issue for me or what it is, but i HAD a model.xml file before i deleted it just now. But it is not being generated anymore? I’m not even sure how it was generated to begin with if model.export_to_xml() doesn’t do it. Also pls excuse my offbrand naming.
model = openmc.model.Model(geometry,materials_collection, settings,tallies_file)
model.export_to_xml()
* Edit 4
Oh my god. The method is not named the same. It is model.export_model_to_xml(). Wow. Thats it. Now everything works as it should. Why is it not named the same and why don’t I get an error aughhh. Well… Problem solved though!
Last thing to add is that it seems operator = openmc.deplete.CoupledOperator(model, "chain_endfb81_fast.xml")is not actually using the model from when made in the code. It seems it is actually reading the model.xml file regardless if it’s given a model to use in the CoupledOperator. I’m guessing that is not quite intended?