def initialize(self, settings): """ Initializes the geometry. After geometry, volume, and materials are set, this function completes the geometry. Parameters ---------- settings : openmc_wrapper.Settings Settings to initialize with. """ import copy # Clear out OpenMC openmc.reset_auto_material_id() openmc.reset_auto_surface_id() openmc.reset_auto_cell_id() openmc.reset_auto_universe_id() self.number_density = OrderedDict() self.mat_name = OrderedDict() self.burn_cell_to_ind = OrderedDict() self.burn_list = [] self.fet_order = settings.fet_order cell_ind = 0 # First, for each cell, create an entry in number_density cells = self.geometry.root_universe.get_all_cells() #print(cells) for cid in cells: cell = cells[cid] name = cell.name self.mat_name[cid] = name # Create entry in self.number_density using initial_density self.number_density[cid] = \ copy.deepcopy(self.materials.initial_density[name]) # print('testing...',cid) # Fill with a material (linked to cell id) cell.fill = self.density_dictionary_to_openmc_mat(cid) # If should burn, add to burn list: if self.materials.burn[name]: self.burn_list.append(cid) self.burn_cell_to_ind[str(cid)] = cell_ind cell_ind += 1 # Then, write geometry.xml self.geometry.export_to_xml() # Load participating nuclides self.load_participating(settings.cross_sections) # Create reaction rate tables self.reaction_rates = \ reaction_rates.ReactionRates(self.burn_cell_to_ind, self.burn_nuc_to_ind, self.chain.react_to_ind, self.fet_order) # Finally, calculate total number densities self.total_number = OrderedDict() self.calculate_total_number()
def reset_auto_ids(): openmc.reset_auto_material_id() openmc.reset_auto_surface_id() openmc.reset_auto_cell_id() openmc.reset_auto_universe_id()
def reset_auto_ids(): """Reset counters for all auto-generated IDs""" openmc.reset_auto_material_id() openmc.reset_auto_surface_id() openmc.reset_auto_cell_id() openmc.reset_auto_universe_id()