From 4af7da2ea7297843477fa00c57586755c64a85ef Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 2 May 2018 22:03:40 -0500 Subject: [PATCH] Use shallow copy of material for differentiation --- smr/build-core-fresh.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/smr/build-core-fresh.py b/smr/build-core-fresh.py index 0a48194..b53fd4f 100644 --- a/smr/build-core-fresh.py +++ b/smr/build-core-fresh.py @@ -15,6 +15,13 @@ from smr.surfaces import lattice_pitch, bottom_fuel_stack, top_active_core from smr.core import core_geometry +def clone(mat): + """Make a shallow copy of a material (sharing compositions).""" + mat_copy = copy.copy(mat) + mat_copy.id = None + return mat_copy + + # Define command-line options parser = argparse.ArgumentParser() parser.add_argument('-m', '--multipole', action='store_true', @@ -53,7 +60,7 @@ if args.tallies == 'mat': for cell in geometry.get_all_cells().values(): if cell.fill in fuel_mats: # Fill cell with list of "differentiated" materials - cell.fill = [cell.fill.clone() for i in range(cell.num_instances)] + cell.fill = [clone(cell.fill) for i in range(cell.num_instances)] #### Create OpenMC "materials.xml" file all_materials = geometry.get_all_materials()