openmc.model.Model

class openmc.model.Model(geometry=None, materials=None, settings=None, tallies=None, plots=None)[source]

Model container.

This class can be used to store instances of openmc.Geometry, openmc.Materials, openmc.Settings, openmc.Tallies, openmc.Plots, and openmc.CMFD, thus making a complete model. The Model.export_to_xml() method will export XML files for all attributes that have been set. If the Model.materials() attribute is not set, it will attempt to create a materials.xml file based on all materials appearing in the geometry.

Parameters:
Variables:
deplete(timesteps, chain_file=None, method='cecm', fission_q=None, **kwargs)[source]

Deplete model using specified timesteps/power

Parameters:
  • timesteps (iterable of float) – Array of timesteps in units of [s]. Note that values are not cumulative.
  • chain_file (str, optional) – Path to the depletion chain XML file. Defaults to the chain found under the depletion_chain in the OPENMC_CROSS_SECTIONS environment variable if it exists.
  • method (str) – Integration method used for depletion (e.g., ‘cecm’, ‘predictor’)
  • fission_q (dict, optional) – Dictionary of nuclides and their fission Q values [eV]. If not given, values will be pulled from the chain_file.
  • **kwargs – Keyword arguments passed to integration function (e.g., openmc.deplete.integrator.cecm())
export_to_xml(directory='.')[source]

Export model to XML files.

Parameters:directory (str) – Directory to write XML files to. If it doesn’t exist already, it will be created.
run(**kwargs)[source]

Creates the XML files, runs OpenMC, and returns the path to the last statepoint file generated.

Changed in version 0.12: Instead of returning the final k-effective value, this function now returns the path to the final statepoint written.

Parameters:**kwargs – Keyword arguments passed to openmc.run()
Returns:Path to the last statepoint written by this run (None if no statepoint was written)
Return type:Path