From 57cb1a37defdb35710bca583ba1354fe50fb9ef9 Mon Sep 17 00:00:00 2001 From: rockfool Date: Tue, 5 Nov 2019 11:57:28 -0500 Subject: [PATCH 1/5] create deepcopy in triso model and remove the unnecessary sorted fucntion --- openmc/model/triso.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/openmc/model/triso.py b/openmc/model/triso.py index 2afc88d642..aa561226a3 100644 --- a/openmc/model/triso.py +++ b/openmc/model/triso.py @@ -41,6 +41,8 @@ class TRISO(openmc.Cell): Name of the TRISO cell center : numpy.ndarray Cartesian coordinates of the center of the TRISO particle in cm + outer_radius : float + Outer radius of TRISO particle fill : openmc.Universe Universe that contains the TRISO layers region : openmc.Region @@ -52,6 +54,10 @@ class TRISO(openmc.Cell): self._surface = openmc.Sphere(r=outer_radius) super().__init__(fill=fill, region=-self._surface) self.center = np.asarray(center) + self.outer_radius = outer_radius + + def __deepcopy__(self): + return TRISO(outer_radius=self.outer_radius, fill=self.fill, center=self.center) @property def center(self): @@ -827,10 +833,10 @@ def create_triso_lattice(trisos, lower_left, pitch, shape, background): triso_locations = {idx: [] for idx in indices} for t in trisos: for idx in t.classify(lattice): - if idx in sorted(triso_locations): + if idx in triso_locations: # Create copy of TRISO particle with materials preserved and # different cell/surface IDs - t_copy = copy.deepcopy(t) + t_copy = t.__deepcopy__() t_copy.id = None t_copy.fill = t.fill t_copy._surface.id = None From ae5d8cf33b9ca3dd150db1dfbe881ea7d2cc90d4 Mon Sep 17 00:00:00 2001 From: rockfool Date: Tue, 5 Nov 2019 20:19:36 -0500 Subject: [PATCH 2/5] change names for function and variables --- openmc/model/triso.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openmc/model/triso.py b/openmc/model/triso.py index aa561226a3..bc34eed935 100644 --- a/openmc/model/triso.py +++ b/openmc/model/triso.py @@ -54,10 +54,10 @@ class TRISO(openmc.Cell): self._surface = openmc.Sphere(r=outer_radius) super().__init__(fill=fill, region=-self._surface) self.center = np.asarray(center) - self.outer_radius = outer_radius + self._outer_radius = outer_radius - def __deepcopy__(self): - return TRISO(outer_radius=self.outer_radius, fill=self.fill, center=self.center) + def deepcopy(self): + return TRISO(outer_radius=self._outer_radius, fill=self.fill, center=self.center) @property def center(self): @@ -836,7 +836,7 @@ def create_triso_lattice(trisos, lower_left, pitch, shape, background): if idx in triso_locations: # Create copy of TRISO particle with materials preserved and # different cell/surface IDs - t_copy = t.__deepcopy__() + t_copy = t.deepcopy() t_copy.id = None t_copy.fill = t.fill t_copy._surface.id = None From bd6a479370236e9b60f87cae9ba183958c81b923 Mon Sep 17 00:00:00 2001 From: rockfool Date: Wed, 6 Nov 2019 09:49:29 -0500 Subject: [PATCH 3/5] update the input files generated by openmc.model.triso --- tests/regression_tests/triso/inputs_true.dat | 776 +++++++++---------- 1 file changed, 388 insertions(+), 388 deletions(-) diff --git a/tests/regression_tests/triso/inputs_true.dat b/tests/regression_tests/triso/inputs_true.dat index 2ea049465c..5c03ad86bb 100644 --- a/tests/regression_tests/triso/inputs_true.dat +++ b/tests/regression_tests/triso/inputs_true.dat @@ -1,428 +1,428 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.3333333333333333 0.3333333333333333 0.3333333333333333 - 38 + 30 3 3 3 -0.5 -0.5 -0.5 -17 18 19 -14 15 16 -11 12 13 +9 10 11 +6 7 8 +3 4 5 -26 27 28 -23 24 25 -20 21 22 +18 19 20 +15 16 17 +12 13 14 -35 36 37 -32 33 34 -29 30 31 +27 28 29 +24 25 26 +21 22 23 - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + From f75db76c709f8598bfd395712002f8aabf746573 Mon Sep 17 00:00:00 2001 From: rockfool Date: Thu, 7 Nov 2019 10:31:57 -0500 Subject: [PATCH 4/5] address reviewers' comment on deepcopy and tests input --- openmc/model/triso.py | 12 +- tests/regression_tests/triso/inputs_true.dat | 776 +++++++++---------- 2 files changed, 394 insertions(+), 394 deletions(-) diff --git a/openmc/model/triso.py b/openmc/model/triso.py index bc34eed935..1e27e126aa 100644 --- a/openmc/model/triso.py +++ b/openmc/model/triso.py @@ -54,10 +54,6 @@ class TRISO(openmc.Cell): self._surface = openmc.Sphere(r=outer_radius) super().__init__(fill=fill, region=-self._surface) self.center = np.asarray(center) - self._outer_radius = outer_radius - - def deepcopy(self): - return TRISO(outer_radius=self._outer_radius, fill=self.fill, center=self.center) @property def center(self): @@ -836,10 +832,14 @@ def create_triso_lattice(trisos, lower_left, pitch, shape, background): if idx in triso_locations: # Create copy of TRISO particle with materials preserved and # different cell/surface IDs - t_copy = t.deepcopy() + t_copy = copy.copy(t) t_copy.id = None t_copy.fill = t.fill - t_copy._surface.id = None + t_copy._surface = openmc.Sphere(r=t._surface.r, + x0=t._surface.x0, + y0=t._surface.y0, + z0=t._surface.z0) + t_copy.region = -t_copy._surface triso_locations[idx].append(t_copy) else: warnings.warn('TRISO particle is partially or completely ' diff --git a/tests/regression_tests/triso/inputs_true.dat b/tests/regression_tests/triso/inputs_true.dat index 5c03ad86bb..2ea049465c 100644 --- a/tests/regression_tests/triso/inputs_true.dat +++ b/tests/regression_tests/triso/inputs_true.dat @@ -1,428 +1,428 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.3333333333333333 0.3333333333333333 0.3333333333333333 - 30 + 38 3 3 3 -0.5 -0.5 -0.5 -9 10 11 -6 7 8 -3 4 5 +17 18 19 +14 15 16 +11 12 13 -18 19 20 -15 16 17 -12 13 14 +26 27 28 +23 24 25 +20 21 22 -27 28 29 -24 25 26 -21 22 23 +35 36 37 +32 33 34 +29 30 31 - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + From 540a3ba66abb9740680ebc515e540fc41a340b43 Mon Sep 17 00:00:00 2001 From: rockfool Date: Thu, 7 Nov 2019 11:30:49 -0500 Subject: [PATCH 5/5] clean comment for outer_radius --- openmc/model/triso.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/openmc/model/triso.py b/openmc/model/triso.py index 1e27e126aa..2552623a0c 100644 --- a/openmc/model/triso.py +++ b/openmc/model/triso.py @@ -41,8 +41,6 @@ class TRISO(openmc.Cell): Name of the TRISO cell center : numpy.ndarray Cartesian coordinates of the center of the TRISO particle in cm - outer_radius : float - Outer radius of TRISO particle fill : openmc.Universe Universe that contains the TRISO layers region : openmc.Region