From e37ff271c6326fde875619d8ff7cc3bc01c67995 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 20 Aug 2019 16:56:15 -0500 Subject: [PATCH 01/16] Generalize Chain.set_capture_branches -> set_branch_ratios Generalized method that allows the modification of branching ratios for an arbitrary reaction. A similar replacement has been made with the companion get_capture_branches -> get_branch_ratios. Both of the new methods accept an additional reaction argument, which defaults to "(n,gamma)", indicating what reaction to modify/retrieve. Also added a tolerance argument, defaults to 1e-5, for checking the sum of user-supplied branching ratios. This tolerance is used as 1 - tolerance < sum_br < 1 + tolerance. Additional logic is included if the user has not specified the ground state, which can be inferred. For this case, the lower end is allowed to be less than 1 - tolerance, as the ground state will have a branch ratio such the sum of ratios is unity. Products are not checked for consistency, that is left up to the user. tests/unit_test/test_deplete_chain.py has been modified with the new notation, and also with a variety of calls with and without the optional reaction argument. A minor test is added that modifies (n,alpha) and (n,2n) reactions just to ensure that arbitrary reactions can be used. Minor changes: * Internal variables changed to reflect the generality of the method * Added documentation on what exceptions are raised in set_branch_ratios Related: openmc issue #1237 --- openmc/deplete/chain.py | 138 +++++++++++++++++-------- tests/unit_tests/test_deplete_chain.py | 70 ++++++++++--- 2 files changed, 146 insertions(+), 62 deletions(-) diff --git a/openmc/deplete/chain.py b/openmc/deplete/chain.py index 1f16d9caf..3b1870b97 100644 --- a/openmc/deplete/chain.py +++ b/openmc/deplete/chain.py @@ -454,70 +454,96 @@ class Chain(object): dict.update(matrix_dok, matrix) return matrix_dok.tocsr() - def get_capture_branches(self): - """Return a dictionary with capture branching ratios + def get_branch_ratios(self, reaction="(n,gamma)"): + """Return a dictionary with reaction branching ratios + + Parameters + ---------- + reaction : str, optional + Reaction name like ``"(n,gamma)"`` [default], or + ``"(n,alpha)"``. Returns ------- - capt : - nested dict of parent nuclide keys with capture targets and - branching ratios:: + branches : dict + nested dict of parent nuclide keys with reaction targets and + branching ratios. Consider the capture, ``"(n,gamma)"``, + reaction for Am241:: {"Am241": {"Am242": 0.91, "Am242_m1": 0.09}} See Also -------- - :meth:`set_capture_branches` - + :meth:`set_branch_ratios` """ capt = {} for nuclide in self.nuclides: nuc_capt = {} for rx in nuclide.reactions: - if rx.type == "(n,gamma)" and rx.branching_ratio != 1.0: + if rx.type == reaction and rx.branching_ratio != 1.0: nuc_capt[rx.target] = rx.branching_ratio if len(nuc_capt) > 0: capt[nuclide.name] = nuc_capt return capt - def set_capture_branches(self, branch_ratios, strict=True): - """Set the capture branching ratios - - To provide a buffer around floating point precisions, - the sum of all branching ratios from a single parent - cannot be greater than 1.00001. + def set_branch_ratios(self, branch_ratios, reaction="(n,gamma)", + strict=True, tolerance=1e-5): + """Set the branching ratios for a given reactions Parameters ---------- branch_ratios : dict of {str: {str: float}} Capture branching ratios to be inserted. First layer keys are names of parent nuclides, e.g. - ``"Am241"``. The capture branching ratios for these + ``"Am241"``. The branching ratios for these parents will be modified. Corresponding values are dictionaries of ``{target: branching_ratio}`` - strict : bool - If this evalutes to ``True``, then all parents and - products must exist in the :class:`Chain`. A - :class:`KeyError` will be raised at the first - nuclide that does not exist. Otherwise, print - a warning message for missing parents and/or - products. + reaction : str, optional + Reaction name like ``"(n,gamma)"`` [default], or + ``"(n, alpha)"``. + strict : bool, optional + Error control. If this evalutes to ``True``, then errors will + be raised if inconsistencies are found. Otherwise, warnings + will be raised for most issues. + tolerance : float, optional + Tolerance on the sum of all branching ratios for a + single parent. Will be checked with:: + + 1 - tol < sum_br < 1 + tol + + Raises + ------ + IndexError + If no isotopes were found on the chain that have the requested + reaction + KeyError + If ``strict`` evaluates to ``False`` and a parent isotope in + ``branch_ratios`` does not exist on the chain + AttributeError + If ``strict`` evaluates to ``False`` and a parent isotope in + ``branch_ratios`` does not have the requested reaction + ValueError + If ``strict`` evalutes to ``False`` and the sum of one parents + branch ratios is outside 1 +/- ``tolerance`` See Also -------- - :meth:`get_capture_branches` + :meth:`get_branch_ratios` """ # Store some useful information through the validation stage sums = {} - capt_ix_map = {} + rxn_ix_map = {} grounds = {} + tolerance = abs(tolerance) + missing_parents = set() missing_products = {} - no_capture = set() + missing_reaction = set() + bad_sums = {} # Check for validity before manipulation @@ -543,11 +569,11 @@ class Chain(object): if prod_flag: continue - # Make sure this nuclide has capture reactions + # Make sure this nuclide has the reaction indexes = [] for ix, rx in enumerate(self[parent].reactions): - if rx.type == "(n,gamma)": + if rx.type == reaction: indexes.append(ix) if "_m" not in rx.target: grounds[parent] = rx.target @@ -555,24 +581,39 @@ class Chain(object): if len(indexes) == 0: if strict: raise AttributeError( - "Nuclide {} does not have capture reactions in " - "this {}".format(parent, self.__class__.__name__)) - no_capture.add(parent) + "Nuclide {} does not have {} reactions".format( + parent, reaction)) + missing_reaction.add(parent) continue - capt_ix_map[parent] = indexes - this_sum = sum(sub.values()) - check_less_than(parent + " ratios", this_sum, 1.00001) - sums[parent] = this_sum + # sum of branching ratios can be lower than 1 if no ground + # target is given, but never greater + if (this_sum >= 1 + tolerance or (grounds[parent] in sub + and this_sum <= 1 - tolerance)): + if strict: + msg = ("Sum of {} branching ratios for {} " + "({:7.3f}) outside tolerance of 1 +/- " + "{:5.3e}".format( + reaction, parent, this_sum, tolerance)) + raise ValueError(msg) + bad_sums[parent] = this_sum + else: + rxn_ix_map[parent] = indexes + sums[parent] = this_sum + + if len(rxn_ix_map) == 0: + raise IndexError( + "No {} reactions found in this {}".format( + reaction, self.__class__.__name__)) if len(missing_parents) > 0: warn("The following nuclides were not found in {}: {}".format( self.__class__.__name__, ", ".join(sorted(missing_parents)))) - if len(no_capture) > 0: - warn("The following nuclides did not have capture reactions: " - "{}".format(", ".join(sorted(no_capture)))) + if len(missing_reaction) > 0: + warn("The following nuclides did not have {} reactions: " + "{}".format(reaction, ", ".join(sorted(missing_reaction)))) if len(missing_products) > 0: tail = ("{} -> {}".format(k, v) @@ -581,28 +622,35 @@ class Chain(object): "parents were unmodified: \n{}".format( self.__class__.__name__, ", ".join(tail))) + if len(bad_sums) > 0: + tail = ("{}: {:5.3f}".format(k, s) + for k, s in sorted(bad_sums.items())) + warn("The following parent nuclides were given {} branch ratios " + "with a sum outside tolerance of 1 +/- {:5.3e}:\n{}".format( + reaction, tolerance, "\n".join(tail))) + # Insert new ReactionTuples with updated branch ratios - for parent_name, capt_index in capt_ix_map.items(): + for parent_name, rxn_index in rxn_ix_map.items(): parent = self[parent_name] new_ratios = branch_ratios[parent_name] - capt_index = capt_ix_map[parent_name] + rxn_index = rxn_ix_map[parent_name] # Assume Q value is independent of target state - capt_Q = parent.reactions[capt_index[0]].Q + rxn_Q = parent.reactions[rxn_index[0]].Q - # Remove existing capture reactions + # Remove existing reactions - for ix in reversed(capt_index): + for ix in reversed(rxn_index): parent.reactions.pop(ix) all_meta = True for tgt, br in new_ratios.items(): - all_meta = all_meta and ("_m" in tgt) + all_meta = all_meta and ("_m" in tgt) parent.reactions.append(ReactionTuple( - "(n,gamma)", tgt, capt_Q, br)) + reaction, tgt, rxn_Q, br)) if all_meta and sums[parent_name] != 1.0: ground_br = 1.0 - sums[parent_name] @@ -612,4 +660,4 @@ class Chain(object): ground_tgt = gnd_name(pz, pa + 1, 0) new_ratios[ground_tgt] = ground_br parent.reactions.append(ReactionTuple( - "(n,gamma)", ground_tgt, capt_Q, ground_br)) + reaction, ground_tgt, rxn_Q, ground_br)) diff --git a/tests/unit_tests/test_deplete_chain.py b/tests/unit_tests/test_deplete_chain.py index 33b13b596..686c6d508 100644 --- a/tests/unit_tests/test_deplete_chain.py +++ b/tests/unit_tests/test_deplete_chain.py @@ -248,29 +248,29 @@ def test_set_fiss_q(): def test_get_set_chain_br(simple_chain): """Test minor modifications to capture branch ratios""" expected = {"C": {"A": 0.7, "B": 0.3}} - assert simple_chain.get_capture_branches() == expected + assert simple_chain.get_branch_ratios() == expected # safely modify new_chain = Chain.from_xml("chain_test.xml") new_br = {"C": {"A": 0.5, "B": 0.5}, "A": {"C": 0.99, "B": 0.01}} - new_chain.set_capture_branches(new_br) - assert new_chain.get_capture_branches() == new_br + new_chain.set_branch_ratios(new_br) + assert new_chain.get_branch_ratios() == new_br # write, re-read new_chain.export_to_xml("chain_mod.xml") - assert Chain.from_xml("chain_mod.xml").get_capture_branches() == new_br + assert Chain.from_xml("chain_mod.xml").get_branch_ratios() == new_br # Test non-strict [warn, not error] setting bad_br = {"B": {"X": 0.6, "A": 0.4}, "X": {"A": 0.5, "C": 0.5}} bad_br.update(new_br) - new_chain.set_capture_branches(bad_br, strict=False) - assert new_chain.get_capture_branches() == new_br + new_chain.set_branch_ratios(bad_br, strict=False) + assert new_chain.get_branch_ratios() == new_br # Ensure capture reactions are removed rem_br = {"A": {"C": 1.0}} - new_chain.set_capture_branches(rem_br) + new_chain.set_branch_ratios(rem_br) # A is not in returned dict because there is no branch - assert "A" not in new_chain.get_capture_branches() + assert "A" not in new_chain.get_branch_ratios() def test_capture_branch_infer_ground(): @@ -289,9 +289,9 @@ def test_capture_branch_infer_ground(): chain.nuclides.append(xe136m) chain.nuclide_dict[xe136m.name] = len(chain.nuclides) - 1 - chain.set_capture_branches(infer_br) + chain.set_branch_ratios(infer_br, "(n,gamma)") - assert chain.get_capture_branches() == set_br + assert chain.get_branch_ratios("(n,gamma)") == set_br def test_capture_branch_no_rxn(): @@ -307,9 +307,8 @@ def test_capture_branch_no_rxn(): chain.nuclides.append(u5m) chain.nuclide_dict[u5m.name] = len(chain.nuclides) - 1 - phrase = "U234 does not have capture reactions" - with pytest.raises(AttributeError, match=phrase): - chain.set_capture_branches(u4br) + with pytest.raises(AttributeError, match="U234"): + chain.set_branch_ratios(u4br) def test_capture_branch_failures(simple_chain): @@ -318,14 +317,51 @@ def test_capture_branch_failures(simple_chain): # Parent isotope not present br = {"X": {"A": 0.6, "B": 0.7}} with pytest.raises(KeyError, match="X"): - simple_chain.set_capture_branches(br) + simple_chain.set_branch_ratios(br) # Product isotope not present br = {"C": {"X": 0.4, "A": 0.2, "B": 0.4}} with pytest.raises(KeyError, match="X"): - simple_chain.set_capture_branches(br) + simple_chain.set_branch_ratios(br) # Sum of ratios > 1.0 br = {"C": {"A": 1.0, "B": 1.0}} - with pytest.raises(ValueError, match="C ratios"): - simple_chain.set_capture_branches(br) + with pytest.raises(ValueError, match=r"Sum of \(n,gamma\).*for C"): + simple_chain.set_branch_ratios(br, "(n,gamma)") + + +@pytest.mark.parametrize("reaction", ("(n,alpha)", "(n,2n)")) +def test_set_general_branches(reaction): + """Test setting of non-capture branching ratios""" + # Build a mock chain + chain = Chain() + + parent = nuclide.Nuclide() + parent.name = "A" + + ground_tgt = nuclide.Nuclide() + ground_tgt.name = "B" + + meta_tgt = nuclide.Nuclide() + meta_tgt.name = "B_m1" + + for ix, nuc in enumerate((parent, ground_tgt, meta_tgt)): + chain.nuclides.append(nuc) + chain.nuclide_dict[nuc.name] = ix + + # add reactions to parent + parent.reactions.append(nuclide.ReactionTuple( + reaction, ground_tgt.name, 1.0, 0.6)) + parent.reactions.append(nuclide.ReactionTuple( + reaction, meta_tgt.name, 1.0, 0.4)) + + expected_ref = {"A": {"B": 0.6, "B_m1": 0.4}} + + assert chain.get_branch_ratios(reaction) == expected_ref + + # alter and check again + + altered = {"A": {"B": 0.5, "B_m1": 0.5}} + + chain.set_branch_ratios(altered, reaction) + assert chain.get_branch_ratios(reaction) == altered From 34add135be85bba0e4a3c1659f235198875ee18c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 20 Aug 2019 17:19:53 -0500 Subject: [PATCH 02/16] Leave He4 alone in Chain.set_branch_ratios In an (n, alpha) reaction, the branching ratio for helium should always be one, as it is produced for every reaction. It is the branching ratio of the other targets that must be modified. He4 is treated as a secondary particle for this case, and its reaction is not modified nor removed from the parent. --- openmc/deplete/chain.py | 5 ++++- tests/unit_tests/test_deplete_chain.py | 30 ++++++++++++++++++-------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/openmc/deplete/chain.py b/openmc/deplete/chain.py index 3b1870b97..b557a6111 100644 --- a/openmc/deplete/chain.py +++ b/openmc/deplete/chain.py @@ -545,6 +545,9 @@ class Chain(object): missing_reaction = set() bad_sums = {} + # Secondary products, like alpha particles, should not be modified + secondary = "He4" if reaction == "(n,a)" else None + # Check for validity before manipulation for parent, sub in branch_ratios.items(): @@ -573,7 +576,7 @@ class Chain(object): indexes = [] for ix, rx in enumerate(self[parent].reactions): - if rx.type == reaction: + if rx.type == reaction and rx.target != secondary: indexes.append(ix) if "_m" not in rx.target: grounds[parent] = rx.target diff --git a/tests/unit_tests/test_deplete_chain.py b/tests/unit_tests/test_deplete_chain.py index 686c6d508..3cf726ed1 100644 --- a/tests/unit_tests/test_deplete_chain.py +++ b/tests/unit_tests/test_deplete_chain.py @@ -330,38 +330,50 @@ def test_capture_branch_failures(simple_chain): simple_chain.set_branch_ratios(br, "(n,gamma)") -@pytest.mark.parametrize("reaction", ("(n,alpha)", "(n,2n)")) -def test_set_general_branches(reaction): - """Test setting of non-capture branching ratios""" + +def test_set_alpha_branches(): + """Test setting of alpha reaction branching ratios""" # Build a mock chain chain = Chain() parent = nuclide.Nuclide() parent.name = "A" + he4 = nuclide.Nuclide() + he4.name = "He4" + ground_tgt = nuclide.Nuclide() ground_tgt.name = "B" meta_tgt = nuclide.Nuclide() meta_tgt.name = "B_m1" - for ix, nuc in enumerate((parent, ground_tgt, meta_tgt)): + for ix, nuc in enumerate((parent, ground_tgt, meta_tgt, he4)): chain.nuclides.append(nuc) chain.nuclide_dict[nuc.name] = ix # add reactions to parent parent.reactions.append(nuclide.ReactionTuple( - reaction, ground_tgt.name, 1.0, 0.6)) + "(n,a)", ground_tgt.name, 1.0, 0.6)) parent.reactions.append(nuclide.ReactionTuple( - reaction, meta_tgt.name, 1.0, 0.4)) + "(n,a)", meta_tgt.name, 1.0, 0.4)) + parent.reactions.append(nuclide.ReactionTuple( + "(n,a)", he4.name, 1.0, 1.0)) expected_ref = {"A": {"B": 0.6, "B_m1": 0.4}} - assert chain.get_branch_ratios(reaction) == expected_ref + assert chain.get_branch_ratios("(n,a)") == expected_ref # alter and check again altered = {"A": {"B": 0.5, "B_m1": 0.5}} - chain.set_branch_ratios(altered, reaction) - assert chain.get_branch_ratios(reaction) == altered + chain.set_branch_ratios(altered, "(n,a)") + assert chain.get_branch_ratios("(n,a)") == altered + + # make sure that alpha particle still produced + for r in parent.reactions: + if r.target == he4.name: + break + else: + raise ValueError("Helium has been removed and should not have been") From 4fd59d1f8d57e3d23c511ae0b5123aeec1e017be Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 15 Aug 2019 09:28:55 -0500 Subject: [PATCH 03/16] Update score_current test --- .../score_current/geometry.xml | 181 -- .../score_current/inputs_true.dat | 55 + .../score_current/materials.xml | 270 --- .../score_current/results_true.dat | 1949 ++++++++++++++++- .../score_current/settings.xml | 18 - .../score_current/tallies.xml | 31 - tests/regression_tests/score_current/test.py | 53 +- 7 files changed, 2053 insertions(+), 504 deletions(-) delete mode 100644 tests/regression_tests/score_current/geometry.xml create mode 100644 tests/regression_tests/score_current/inputs_true.dat delete mode 100644 tests/regression_tests/score_current/materials.xml delete mode 100644 tests/regression_tests/score_current/settings.xml delete mode 100644 tests/regression_tests/score_current/tallies.xml diff --git a/tests/regression_tests/score_current/geometry.xml b/tests/regression_tests/score_current/geometry.xml deleted file mode 100644 index f6f067aad..000000000 --- a/tests/regression_tests/score_current/geometry.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 17 - -10.71 -10.71 - 1.26 1.26 - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 - 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 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 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 - 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 - 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 - 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 - 7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - - - - diff --git a/tests/regression_tests/score_current/inputs_true.dat b/tests/regression_tests/score_current/inputs_true.dat new file mode 100644 index 000000000..2b81f508f --- /dev/null +++ b/tests/regression_tests/score_current/inputs_true.dat @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + + 3 3 3 + -10.0 -10.0 -10.0 + 10.0 10.0 10.0 + + + 1 + + + 0.0 0.253 20000000.0 + + + 1 + current + + + 1 2 + current + + diff --git a/tests/regression_tests/score_current/materials.xml b/tests/regression_tests/score_current/materials.xml deleted file mode 100644 index 8021f5f99..000000000 --- a/tests/regression_tests/score_current/materials.xml +++ /dev/null @@ -1,270 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/regression_tests/score_current/results_true.dat b/tests/regression_tests/score_current/results_true.dat index dedc473de..ddd73d6cc 100644 --- a/tests/regression_tests/score_current/results_true.dat +++ b/tests/regression_tests/score_current/results_true.dat @@ -1 +1,1948 @@ -138b312cdaa822c9b62f757b3259522004b679c4ed289a92798b29a6442c26d12c53256635be273f13e3703816ff50a1b9f52d79770eade01e482384ac0d389f \ No newline at end of file +k-combined: +7.656044E-01 5.168921E-02 +tally 1: +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.080000E-01 +2.386000E-03 +1.410000E-01 +4.007000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.160000E-01 +2.830000E-03 +1.530000E-01 +4.895000E-03 +1.450000E-01 +4.395000E-03 +0.000000E+00 +0.000000E+00 +6.500000E-02 +9.150000E-04 +1.340000E-01 +3.660000E-03 +1.410000E-01 +4.007000E-03 +1.080000E-01 +2.386000E-03 +1.640000E-01 +5.438000E-03 +1.230000E-01 +3.203000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.640000E-01 +5.776000E-03 +2.610000E-01 +1.373100E-02 +1.910000E-01 +7.339000E-03 +0.000000E+00 +0.000000E+00 +1.000000E-01 +2.116000E-03 +1.990000E-01 +8.309000E-03 +1.230000E-01 +3.203000E-03 +1.640000E-01 +5.438000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.100000E-01 +2.476000E-03 +1.540000E-01 +5.106000E-03 +1.660000E-01 +5.664000E-03 +0.000000E+00 +0.000000E+00 +7.000000E-02 +1.080000E-03 +1.370000E-01 +3.867000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.620000E-01 +5.422000E-03 +2.650000E-01 +1.456300E-02 +1.530000E-01 +4.895000E-03 +1.160000E-01 +2.830000E-03 +1.600000E-01 +5.184000E-03 +1.060000E-01 +2.286000E-03 +1.870000E-01 +7.195000E-03 +0.000000E+00 +0.000000E+00 +1.090000E-01 +2.653000E-03 +2.320000E-01 +1.087200E-02 +2.650000E-01 +1.456300E-02 +1.620000E-01 +5.422000E-03 +2.500000E-01 +1.285000E-02 +1.530000E-01 +4.823000E-03 +2.610000E-01 +1.373100E-02 +1.640000E-01 +5.776000E-03 +2.530000E-01 +1.347100E-02 +1.700000E-01 +5.906000E-03 +2.300000E-01 +1.089400E-02 +0.000000E+00 +0.000000E+00 +2.380000E-01 +1.226000E-02 +5.120000E-01 +5.796600E-02 +1.530000E-01 +4.823000E-03 +2.500000E-01 +1.285000E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.540000E-01 +5.106000E-03 +1.100000E-01 +2.476000E-03 +1.600000E-01 +5.166000E-03 +1.350000E-01 +3.771000E-03 +1.830000E-01 +6.757000E-03 +0.000000E+00 +0.000000E+00 +9.100000E-02 +1.903000E-03 +1.940000E-01 +7.626000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.360000E-01 +3.862000E-03 +1.560000E-01 +4.970000E-03 +1.060000E-01 +2.286000E-03 +1.600000E-01 +5.184000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.560000E-01 +4.922000E-03 +0.000000E+00 +0.000000E+00 +5.900000E-02 +7.270000E-04 +1.310000E-01 +3.483000E-03 +1.560000E-01 +4.970000E-03 +1.360000E-01 +3.862000E-03 +1.940000E-01 +8.162000E-03 +1.390000E-01 +3.905000E-03 +1.700000E-01 +5.906000E-03 +2.530000E-01 +1.347100E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.020000E-01 +8.326000E-03 +0.000000E+00 +0.000000E+00 +1.100000E-01 +2.510000E-03 +2.230000E-01 +1.009700E-02 +1.390000E-01 +3.905000E-03 +1.940000E-01 +8.162000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.350000E-01 +3.771000E-03 +1.600000E-01 +5.166000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.630000E-01 +5.451000E-03 +0.000000E+00 +0.000000E+00 +8.100000E-02 +1.385000E-03 +1.530000E-01 +4.723000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.380000E-01 +3.886000E-03 +2.270000E-01 +1.064700E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.670000E-01 +5.625000E-03 +2.150000E-01 +9.531000E-03 +1.340000E-01 +3.660000E-03 +6.500000E-02 +9.150000E-04 +1.510000E-01 +4.573000E-03 +6.900000E-02 +9.890000E-04 +2.270000E-01 +1.064700E-02 +1.380000E-01 +3.886000E-03 +2.040000E-01 +8.552000E-03 +1.310000E-01 +3.655000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.390000E-01 +1.148900E-02 +5.090000E-01 +6.440300E-02 +1.990000E-01 +8.309000E-03 +1.000000E-01 +2.116000E-03 +2.040000E-01 +8.722000E-03 +8.700000E-02 +1.655000E-03 +1.310000E-01 +3.655000E-03 +2.040000E-01 +8.552000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.520000E-01 +4.840000E-03 +2.210000E-01 +1.015500E-02 +1.370000E-01 +3.867000E-03 +7.000000E-02 +1.080000E-03 +1.510000E-01 +4.589000E-03 +5.600000E-02 +7.760000E-04 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.440000E-01 +1.198000E-02 +5.330000E-01 +6.307900E-02 +2.150000E-01 +9.531000E-03 +1.670000E-01 +5.625000E-03 +2.090000E-01 +8.891000E-03 +1.580000E-01 +5.042000E-03 +2.320000E-01 +1.087200E-02 +1.090000E-01 +2.653000E-03 +2.150000E-01 +9.421000E-03 +7.800000E-02 +1.474000E-03 +5.330000E-01 +6.307900E-02 +2.440000E-01 +1.198000E-02 +5.000000E-01 +5.426200E-02 +2.160000E-01 +9.816000E-03 +5.090000E-01 +6.440300E-02 +2.390000E-01 +1.148900E-02 +4.860000E-01 +5.139400E-02 +2.330000E-01 +1.110300E-02 +5.120000E-01 +5.796600E-02 +2.380000E-01 +1.226000E-02 +5.280000E-01 +6.237800E-02 +2.150000E-01 +1.004500E-02 +2.160000E-01 +9.816000E-03 +5.000000E-01 +5.426200E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.210000E-01 +1.015500E-02 +1.520000E-01 +4.840000E-03 +2.300000E-01 +1.067400E-02 +1.610000E-01 +5.391000E-03 +1.940000E-01 +7.626000E-03 +9.100000E-02 +1.903000E-03 +2.160000E-01 +9.358000E-03 +8.000000E-02 +1.440000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.420000E-01 +4.126000E-03 +2.210000E-01 +9.953000E-03 +1.580000E-01 +5.042000E-03 +2.090000E-01 +8.891000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.310000E-01 +3.483000E-03 +5.900000E-02 +7.270000E-04 +1.310000E-01 +3.567000E-03 +6.000000E-02 +7.940000E-04 +2.210000E-01 +9.953000E-03 +1.420000E-01 +4.126000E-03 +2.360000E-01 +1.141600E-02 +1.770000E-01 +6.341000E-03 +2.330000E-01 +1.110300E-02 +4.860000E-01 +5.139400E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.230000E-01 +1.009700E-02 +1.100000E-01 +2.510000E-03 +2.040000E-01 +8.736000E-03 +1.100000E-01 +2.790000E-03 +1.770000E-01 +6.341000E-03 +2.360000E-01 +1.141600E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.610000E-01 +5.391000E-03 +2.300000E-01 +1.067400E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.530000E-01 +4.723000E-03 +8.100000E-02 +1.385000E-03 +1.460000E-01 +4.382000E-03 +6.100000E-02 +8.190000E-04 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.140000E-01 +2.660000E-03 +1.620000E-01 +5.420000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.300000E-01 +3.474000E-03 +1.440000E-01 +4.322000E-03 +6.900000E-02 +9.890000E-04 +1.510000E-01 +4.573000E-03 +1.560000E-01 +4.912000E-03 +0.000000E+00 +0.000000E+00 +1.620000E-01 +5.420000E-03 +1.140000E-01 +2.660000E-03 +1.580000E-01 +5.102000E-03 +1.550000E-01 +4.831000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.340000E-01 +3.708000E-03 +2.300000E-01 +1.092600E-02 +8.700000E-02 +1.655000E-03 +2.040000E-01 +8.722000E-03 +2.060000E-01 +8.520000E-03 +0.000000E+00 +0.000000E+00 +1.550000E-01 +4.831000E-03 +1.580000E-01 +5.102000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.230000E-01 +3.223000E-03 +1.680000E-01 +5.674000E-03 +5.600000E-02 +7.760000E-04 +1.510000E-01 +4.589000E-03 +1.660000E-01 +6.068000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.450000E-01 +4.371000E-03 +2.450000E-01 +1.248900E-02 +1.440000E-01 +4.322000E-03 +1.300000E-01 +3.474000E-03 +1.680000E-01 +5.918000E-03 +1.120000E-01 +2.590000E-03 +7.800000E-02 +1.474000E-03 +2.150000E-01 +9.421000E-03 +2.110000E-01 +9.163000E-03 +0.000000E+00 +0.000000E+00 +2.450000E-01 +1.248900E-02 +1.450000E-01 +4.371000E-03 +2.490000E-01 +1.251100E-02 +1.460000E-01 +4.574000E-03 +2.300000E-01 +1.092600E-02 +1.340000E-01 +3.708000E-03 +2.680000E-01 +1.517800E-02 +1.560000E-01 +5.476000E-03 +2.150000E-01 +1.004500E-02 +5.280000E-01 +6.237800E-02 +2.380000E-01 +1.203000E-02 +0.000000E+00 +0.000000E+00 +1.460000E-01 +4.574000E-03 +2.490000E-01 +1.251100E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.680000E-01 +5.674000E-03 +1.230000E-01 +3.223000E-03 +1.460000E-01 +4.356000E-03 +1.260000E-01 +3.252000E-03 +8.000000E-02 +1.440000E-03 +2.160000E-01 +9.358000E-03 +2.100000E-01 +9.014000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.190000E-01 +2.863000E-03 +1.520000E-01 +4.782000E-03 +1.120000E-01 +2.590000E-03 +1.680000E-01 +5.918000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +6.000000E-02 +7.940000E-04 +1.310000E-01 +3.567000E-03 +1.730000E-01 +6.389000E-03 +0.000000E+00 +0.000000E+00 +1.520000E-01 +4.782000E-03 +1.190000E-01 +2.863000E-03 +1.640000E-01 +5.422000E-03 +1.290000E-01 +3.499000E-03 +1.560000E-01 +5.476000E-03 +2.680000E-01 +1.517800E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.100000E-01 +2.790000E-03 +2.040000E-01 +8.736000E-03 +1.930000E-01 +7.503000E-03 +0.000000E+00 +0.000000E+00 +1.290000E-01 +3.499000E-03 +1.640000E-01 +5.422000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.260000E-01 +3.252000E-03 +1.460000E-01 +4.356000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +6.100000E-02 +8.190000E-04 +1.460000E-01 +4.382000E-03 +1.560000E-01 +4.892000E-03 +0.000000E+00 +0.000000E+00 +tally 2: +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.080000E-01 +2.386000E-03 +0.000000E+00 +0.000000E+00 +1.410000E-01 +4.007000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.160000E-01 +2.830000E-03 +0.000000E+00 +0.000000E+00 +1.530000E-01 +4.895000E-03 +0.000000E+00 +0.000000E+00 +1.450000E-01 +4.395000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +6.500000E-02 +9.150000E-04 +0.000000E+00 +0.000000E+00 +1.340000E-01 +3.660000E-03 +0.000000E+00 +0.000000E+00 +1.410000E-01 +4.007000E-03 +0.000000E+00 +0.000000E+00 +1.080000E-01 +2.386000E-03 +0.000000E+00 +0.000000E+00 +1.640000E-01 +5.438000E-03 +0.000000E+00 +0.000000E+00 +1.230000E-01 +3.203000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.640000E-01 +5.776000E-03 +0.000000E+00 +0.000000E+00 +2.610000E-01 +1.373100E-02 +0.000000E+00 +0.000000E+00 +1.910000E-01 +7.339000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.000000E-01 +2.116000E-03 +0.000000E+00 +0.000000E+00 +1.990000E-01 +8.309000E-03 +0.000000E+00 +0.000000E+00 +1.230000E-01 +3.203000E-03 +0.000000E+00 +0.000000E+00 +1.640000E-01 +5.438000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.100000E-01 +2.476000E-03 +0.000000E+00 +0.000000E+00 +1.540000E-01 +5.106000E-03 +0.000000E+00 +0.000000E+00 +1.660000E-01 +5.664000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +7.000000E-02 +1.080000E-03 +0.000000E+00 +0.000000E+00 +1.370000E-01 +3.867000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.620000E-01 +5.422000E-03 +0.000000E+00 +0.000000E+00 +2.650000E-01 +1.456300E-02 +0.000000E+00 +0.000000E+00 +1.530000E-01 +4.895000E-03 +0.000000E+00 +0.000000E+00 +1.160000E-01 +2.830000E-03 +0.000000E+00 +0.000000E+00 +1.600000E-01 +5.184000E-03 +0.000000E+00 +0.000000E+00 +1.060000E-01 +2.286000E-03 +0.000000E+00 +0.000000E+00 +1.870000E-01 +7.195000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.090000E-01 +2.653000E-03 +0.000000E+00 +0.000000E+00 +2.320000E-01 +1.087200E-02 +0.000000E+00 +0.000000E+00 +2.650000E-01 +1.456300E-02 +0.000000E+00 +0.000000E+00 +1.620000E-01 +5.422000E-03 +0.000000E+00 +0.000000E+00 +2.500000E-01 +1.285000E-02 +0.000000E+00 +0.000000E+00 +1.530000E-01 +4.823000E-03 +0.000000E+00 +0.000000E+00 +2.610000E-01 +1.373100E-02 +0.000000E+00 +0.000000E+00 +1.640000E-01 +5.776000E-03 +0.000000E+00 +0.000000E+00 +2.530000E-01 +1.347100E-02 +0.000000E+00 +0.000000E+00 +1.700000E-01 +5.906000E-03 +0.000000E+00 +0.000000E+00 +2.300000E-01 +1.089400E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.380000E-01 +1.226000E-02 +0.000000E+00 +0.000000E+00 +5.120000E-01 +5.796600E-02 +0.000000E+00 +0.000000E+00 +1.530000E-01 +4.823000E-03 +0.000000E+00 +0.000000E+00 +2.500000E-01 +1.285000E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.540000E-01 +5.106000E-03 +0.000000E+00 +0.000000E+00 +1.100000E-01 +2.476000E-03 +0.000000E+00 +0.000000E+00 +1.600000E-01 +5.166000E-03 +0.000000E+00 +0.000000E+00 +1.350000E-01 +3.771000E-03 +0.000000E+00 +0.000000E+00 +1.830000E-01 +6.757000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.100000E-02 +1.903000E-03 +0.000000E+00 +0.000000E+00 +1.940000E-01 +7.626000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.360000E-01 +3.862000E-03 +0.000000E+00 +0.000000E+00 +1.560000E-01 +4.970000E-03 +0.000000E+00 +0.000000E+00 +1.060000E-01 +2.286000E-03 +0.000000E+00 +0.000000E+00 +1.600000E-01 +5.184000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.560000E-01 +4.922000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.900000E-02 +7.270000E-04 +0.000000E+00 +0.000000E+00 +1.310000E-01 +3.483000E-03 +0.000000E+00 +0.000000E+00 +1.560000E-01 +4.970000E-03 +0.000000E+00 +0.000000E+00 +1.360000E-01 +3.862000E-03 +0.000000E+00 +0.000000E+00 +1.940000E-01 +8.162000E-03 +0.000000E+00 +0.000000E+00 +1.390000E-01 +3.905000E-03 +0.000000E+00 +0.000000E+00 +1.700000E-01 +5.906000E-03 +0.000000E+00 +0.000000E+00 +2.530000E-01 +1.347100E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.020000E-01 +8.326000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.100000E-01 +2.510000E-03 +0.000000E+00 +0.000000E+00 +2.230000E-01 +1.009700E-02 +0.000000E+00 +0.000000E+00 +1.390000E-01 +3.905000E-03 +0.000000E+00 +0.000000E+00 +1.940000E-01 +8.162000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.350000E-01 +3.771000E-03 +0.000000E+00 +0.000000E+00 +1.600000E-01 +5.166000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.630000E-01 +5.451000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.100000E-02 +1.385000E-03 +0.000000E+00 +0.000000E+00 +1.530000E-01 +4.723000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.380000E-01 +3.886000E-03 +0.000000E+00 +0.000000E+00 +2.270000E-01 +1.064700E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.670000E-01 +5.625000E-03 +0.000000E+00 +0.000000E+00 +2.150000E-01 +9.531000E-03 +0.000000E+00 +0.000000E+00 +1.340000E-01 +3.660000E-03 +0.000000E+00 +0.000000E+00 +6.500000E-02 +9.150000E-04 +0.000000E+00 +0.000000E+00 +1.510000E-01 +4.573000E-03 +0.000000E+00 +0.000000E+00 +6.900000E-02 +9.890000E-04 +0.000000E+00 +0.000000E+00 +2.270000E-01 +1.064700E-02 +0.000000E+00 +0.000000E+00 +1.380000E-01 +3.886000E-03 +0.000000E+00 +0.000000E+00 +2.040000E-01 +8.552000E-03 +0.000000E+00 +0.000000E+00 +1.310000E-01 +3.655000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.390000E-01 +1.148900E-02 +0.000000E+00 +0.000000E+00 +5.090000E-01 +6.440300E-02 +0.000000E+00 +0.000000E+00 +1.990000E-01 +8.309000E-03 +0.000000E+00 +0.000000E+00 +1.000000E-01 +2.116000E-03 +0.000000E+00 +0.000000E+00 +2.040000E-01 +8.722000E-03 +0.000000E+00 +0.000000E+00 +8.700000E-02 +1.655000E-03 +0.000000E+00 +0.000000E+00 +1.310000E-01 +3.655000E-03 +0.000000E+00 +0.000000E+00 +2.040000E-01 +8.552000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.520000E-01 +4.840000E-03 +0.000000E+00 +0.000000E+00 +2.210000E-01 +1.015500E-02 +0.000000E+00 +0.000000E+00 +1.370000E-01 +3.867000E-03 +0.000000E+00 +0.000000E+00 +7.000000E-02 +1.080000E-03 +0.000000E+00 +0.000000E+00 +1.510000E-01 +4.589000E-03 +0.000000E+00 +0.000000E+00 +5.600000E-02 +7.760000E-04 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.440000E-01 +1.198000E-02 +0.000000E+00 +0.000000E+00 +5.330000E-01 +6.307900E-02 +0.000000E+00 +0.000000E+00 +2.150000E-01 +9.531000E-03 +0.000000E+00 +0.000000E+00 +1.670000E-01 +5.625000E-03 +0.000000E+00 +0.000000E+00 +2.090000E-01 +8.891000E-03 +0.000000E+00 +0.000000E+00 +1.580000E-01 +5.042000E-03 +0.000000E+00 +0.000000E+00 +2.320000E-01 +1.087200E-02 +0.000000E+00 +0.000000E+00 +1.090000E-01 +2.653000E-03 +0.000000E+00 +0.000000E+00 +2.150000E-01 +9.421000E-03 +0.000000E+00 +0.000000E+00 +7.800000E-02 +1.474000E-03 +0.000000E+00 +0.000000E+00 +5.330000E-01 +6.307900E-02 +0.000000E+00 +0.000000E+00 +2.440000E-01 +1.198000E-02 +0.000000E+00 +0.000000E+00 +5.000000E-01 +5.426200E-02 +0.000000E+00 +0.000000E+00 +2.160000E-01 +9.816000E-03 +0.000000E+00 +0.000000E+00 +5.090000E-01 +6.440300E-02 +0.000000E+00 +0.000000E+00 +2.390000E-01 +1.148900E-02 +0.000000E+00 +0.000000E+00 +4.860000E-01 +5.139400E-02 +0.000000E+00 +0.000000E+00 +2.330000E-01 +1.110300E-02 +0.000000E+00 +0.000000E+00 +5.120000E-01 +5.796600E-02 +0.000000E+00 +0.000000E+00 +2.380000E-01 +1.226000E-02 +0.000000E+00 +0.000000E+00 +5.280000E-01 +6.237800E-02 +0.000000E+00 +0.000000E+00 +2.150000E-01 +1.004500E-02 +0.000000E+00 +0.000000E+00 +2.160000E-01 +9.816000E-03 +0.000000E+00 +0.000000E+00 +5.000000E-01 +5.426200E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.210000E-01 +1.015500E-02 +0.000000E+00 +0.000000E+00 +1.520000E-01 +4.840000E-03 +0.000000E+00 +0.000000E+00 +2.300000E-01 +1.067400E-02 +0.000000E+00 +0.000000E+00 +1.610000E-01 +5.391000E-03 +0.000000E+00 +0.000000E+00 +1.940000E-01 +7.626000E-03 +0.000000E+00 +0.000000E+00 +9.100000E-02 +1.903000E-03 +0.000000E+00 +0.000000E+00 +2.160000E-01 +9.358000E-03 +0.000000E+00 +0.000000E+00 +8.000000E-02 +1.440000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.420000E-01 +4.126000E-03 +0.000000E+00 +0.000000E+00 +2.210000E-01 +9.953000E-03 +0.000000E+00 +0.000000E+00 +1.580000E-01 +5.042000E-03 +0.000000E+00 +0.000000E+00 +2.090000E-01 +8.891000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.310000E-01 +3.483000E-03 +0.000000E+00 +0.000000E+00 +5.900000E-02 +7.270000E-04 +0.000000E+00 +0.000000E+00 +1.310000E-01 +3.567000E-03 +0.000000E+00 +0.000000E+00 +6.000000E-02 +7.940000E-04 +0.000000E+00 +0.000000E+00 +2.210000E-01 +9.953000E-03 +0.000000E+00 +0.000000E+00 +1.420000E-01 +4.126000E-03 +0.000000E+00 +0.000000E+00 +2.360000E-01 +1.141600E-02 +0.000000E+00 +0.000000E+00 +1.770000E-01 +6.341000E-03 +0.000000E+00 +0.000000E+00 +2.330000E-01 +1.110300E-02 +0.000000E+00 +0.000000E+00 +4.860000E-01 +5.139400E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.230000E-01 +1.009700E-02 +0.000000E+00 +0.000000E+00 +1.100000E-01 +2.510000E-03 +0.000000E+00 +0.000000E+00 +2.040000E-01 +8.736000E-03 +0.000000E+00 +0.000000E+00 +1.100000E-01 +2.790000E-03 +0.000000E+00 +0.000000E+00 +1.770000E-01 +6.341000E-03 +0.000000E+00 +0.000000E+00 +2.360000E-01 +1.141600E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.610000E-01 +5.391000E-03 +0.000000E+00 +0.000000E+00 +2.300000E-01 +1.067400E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.530000E-01 +4.723000E-03 +0.000000E+00 +0.000000E+00 +8.100000E-02 +1.385000E-03 +0.000000E+00 +0.000000E+00 +1.460000E-01 +4.382000E-03 +0.000000E+00 +0.000000E+00 +6.100000E-02 +8.190000E-04 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.140000E-01 +2.660000E-03 +0.000000E+00 +0.000000E+00 +1.620000E-01 +5.420000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.300000E-01 +3.474000E-03 +0.000000E+00 +0.000000E+00 +1.440000E-01 +4.322000E-03 +0.000000E+00 +0.000000E+00 +6.900000E-02 +9.890000E-04 +0.000000E+00 +0.000000E+00 +1.510000E-01 +4.573000E-03 +0.000000E+00 +0.000000E+00 +1.560000E-01 +4.912000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.620000E-01 +5.420000E-03 +0.000000E+00 +0.000000E+00 +1.140000E-01 +2.660000E-03 +0.000000E+00 +0.000000E+00 +1.580000E-01 +5.102000E-03 +0.000000E+00 +0.000000E+00 +1.550000E-01 +4.831000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.340000E-01 +3.708000E-03 +0.000000E+00 +0.000000E+00 +2.300000E-01 +1.092600E-02 +0.000000E+00 +0.000000E+00 +8.700000E-02 +1.655000E-03 +0.000000E+00 +0.000000E+00 +2.040000E-01 +8.722000E-03 +0.000000E+00 +0.000000E+00 +2.060000E-01 +8.520000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.550000E-01 +4.831000E-03 +0.000000E+00 +0.000000E+00 +1.580000E-01 +5.102000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.230000E-01 +3.223000E-03 +0.000000E+00 +0.000000E+00 +1.680000E-01 +5.674000E-03 +0.000000E+00 +0.000000E+00 +5.600000E-02 +7.760000E-04 +0.000000E+00 +0.000000E+00 +1.510000E-01 +4.589000E-03 +0.000000E+00 +0.000000E+00 +1.660000E-01 +6.068000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.450000E-01 +4.371000E-03 +0.000000E+00 +0.000000E+00 +2.450000E-01 +1.248900E-02 +0.000000E+00 +0.000000E+00 +1.440000E-01 +4.322000E-03 +0.000000E+00 +0.000000E+00 +1.300000E-01 +3.474000E-03 +0.000000E+00 +0.000000E+00 +1.680000E-01 +5.918000E-03 +0.000000E+00 +0.000000E+00 +1.120000E-01 +2.590000E-03 +0.000000E+00 +0.000000E+00 +7.800000E-02 +1.474000E-03 +0.000000E+00 +0.000000E+00 +2.150000E-01 +9.421000E-03 +0.000000E+00 +0.000000E+00 +2.110000E-01 +9.163000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.450000E-01 +1.248900E-02 +0.000000E+00 +0.000000E+00 +1.450000E-01 +4.371000E-03 +0.000000E+00 +0.000000E+00 +2.490000E-01 +1.251100E-02 +0.000000E+00 +0.000000E+00 +1.460000E-01 +4.574000E-03 +0.000000E+00 +0.000000E+00 +2.300000E-01 +1.092600E-02 +0.000000E+00 +0.000000E+00 +1.340000E-01 +3.708000E-03 +0.000000E+00 +0.000000E+00 +2.680000E-01 +1.517800E-02 +0.000000E+00 +0.000000E+00 +1.560000E-01 +5.476000E-03 +0.000000E+00 +0.000000E+00 +2.150000E-01 +1.004500E-02 +0.000000E+00 +0.000000E+00 +5.280000E-01 +6.237800E-02 +0.000000E+00 +0.000000E+00 +2.380000E-01 +1.203000E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.460000E-01 +4.574000E-03 +0.000000E+00 +0.000000E+00 +2.490000E-01 +1.251100E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.680000E-01 +5.674000E-03 +0.000000E+00 +0.000000E+00 +1.230000E-01 +3.223000E-03 +0.000000E+00 +0.000000E+00 +1.460000E-01 +4.356000E-03 +0.000000E+00 +0.000000E+00 +1.260000E-01 +3.252000E-03 +0.000000E+00 +0.000000E+00 +8.000000E-02 +1.440000E-03 +0.000000E+00 +0.000000E+00 +2.160000E-01 +9.358000E-03 +0.000000E+00 +0.000000E+00 +2.100000E-01 +9.014000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.190000E-01 +2.863000E-03 +0.000000E+00 +0.000000E+00 +1.520000E-01 +4.782000E-03 +0.000000E+00 +0.000000E+00 +1.120000E-01 +2.590000E-03 +0.000000E+00 +0.000000E+00 +1.680000E-01 +5.918000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +6.000000E-02 +7.940000E-04 +0.000000E+00 +0.000000E+00 +1.310000E-01 +3.567000E-03 +0.000000E+00 +0.000000E+00 +1.730000E-01 +6.389000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.520000E-01 +4.782000E-03 +0.000000E+00 +0.000000E+00 +1.190000E-01 +2.863000E-03 +0.000000E+00 +0.000000E+00 +1.640000E-01 +5.422000E-03 +0.000000E+00 +0.000000E+00 +1.290000E-01 +3.499000E-03 +0.000000E+00 +0.000000E+00 +1.560000E-01 +5.476000E-03 +0.000000E+00 +0.000000E+00 +2.680000E-01 +1.517800E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.100000E-01 +2.790000E-03 +0.000000E+00 +0.000000E+00 +2.040000E-01 +8.736000E-03 +0.000000E+00 +0.000000E+00 +1.930000E-01 +7.503000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.290000E-01 +3.499000E-03 +0.000000E+00 +0.000000E+00 +1.640000E-01 +5.422000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.260000E-01 +3.252000E-03 +0.000000E+00 +0.000000E+00 +1.460000E-01 +4.356000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +6.100000E-02 +8.190000E-04 +0.000000E+00 +0.000000E+00 +1.460000E-01 +4.382000E-03 +0.000000E+00 +0.000000E+00 +1.560000E-01 +4.892000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 diff --git a/tests/regression_tests/score_current/settings.xml b/tests/regression_tests/score_current/settings.xml deleted file mode 100644 index 569c80982..000000000 --- a/tests/regression_tests/score_current/settings.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - eigenvalue - 10 - 5 - 100 - - - - - -160 -160 -183 - 160 160 183 - - - - - diff --git a/tests/regression_tests/score_current/tallies.xml b/tests/regression_tests/score_current/tallies.xml deleted file mode 100644 index a381e4c2e..000000000 --- a/tests/regression_tests/score_current/tallies.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - regular - -182.07 -182.07 -183.00 - 182.07 182.07 183.00 - 17 17 17 - - - - meshsurface - 1 - - - - energy - 0. 0.253 20.0e6 - - - - 1 - current - - - - 1 2 - current - - - diff --git a/tests/regression_tests/score_current/test.py b/tests/regression_tests/score_current/test.py index 21c5d0881..1309584d2 100644 --- a/tests/regression_tests/score_current/test.py +++ b/tests/regression_tests/score_current/test.py @@ -1,6 +1,53 @@ -from tests.testing_harness import HashedTestHarness +import openmc +import pytest + +from tests.testing_harness import PyAPITestHarness -def test_score_current(): - harness = HashedTestHarness('statepoint.10.h5') +@pytest.fixture +def model(): + model = openmc.model.Model() + + fuel = openmc.Material() + fuel.set_density('g/cm3', 10.0) + fuel.add_nuclide('U235', 1.0) + zr = openmc.Material() + zr.set_density('g/cm3', 1.0) + zr.add_nuclide('Zr90', 1.0) + model.materials.extend([fuel, zr]) + + box1 = openmc.model.rectangular_prism(10.0, 10.0) + box2 = openmc.model.rectangular_prism(20.0, 20.0, boundary_type='reflective') + top = openmc.ZPlane(z0=10.0, boundary_type='vacuum') + bottom = openmc.ZPlane(z0=-10.0, boundary_type='vacuum') + cell1 = openmc.Cell(fill=fuel, region=box1 & +bottom & -top) + cell2 = openmc.Cell(fill=zr, region=~box1 & box2 & +bottom & -top) + model.geometry = openmc.Geometry([cell1, cell2]) + + model.settings.batches = 5 + model.settings.inactive = 0 + model.settings.particles = 1000 + + + mesh = openmc.Mesh() + mesh.lower_left = (-10.0, -10.0, -10.0) + mesh.upper_right = (10.0, 10.0, 10.0) + mesh.dimension = (3, 3, 3) + + mesh_surface_filter = openmc.MeshSurfaceFilter(mesh) + energy_filter = openmc.EnergyFilter([0.0, 0.253, 20.0e6]) + + tally1 = openmc.Tally() + tally1.filters = [mesh_surface_filter] + tally1.scores = ['current'] + tally2 = openmc.Tally() + tally2.filters = [mesh_surface_filter, energy_filter] + tally2.scores = ['current'] + model.tallies.extend([tally1, tally2]) + + return model + + +def test_score_current(model): + harness = PyAPITestHarness('statepoint.5.h5', model) harness.main() From f3ace1a5e2105910113e635f9b61c639da7f0fb6 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 15 Aug 2019 11:50:37 -0500 Subject: [PATCH 04/16] Update tally_assumpsep test --- .../tally_assumesep/geometry.xml | 184 +----------- .../tally_assumesep/materials.xml | 267 +----------------- .../tally_assumesep/results_true.dat | 14 +- .../tally_assumesep/settings.xml | 10 +- .../tally_assumesep/tallies.xml | 8 +- 5 files changed, 25 insertions(+), 458 deletions(-) diff --git a/tests/regression_tests/tally_assumesep/geometry.xml b/tests/regression_tests/tally_assumesep/geometry.xml index f6f067aad..a028ad05d 100644 --- a/tests/regression_tests/tally_assumesep/geometry.xml +++ b/tests/regression_tests/tally_assumesep/geometry.xml @@ -1,181 +1,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 17 - -10.71 -10.71 - 1.26 1.26 - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 - 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1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7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 - 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 - 7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - - - + + + + + + diff --git a/tests/regression_tests/tally_assumesep/materials.xml b/tests/regression_tests/tally_assumesep/materials.xml index 8021f5f99..b27086e61 100644 --- a/tests/regression_tests/tally_assumesep/materials.xml +++ b/tests/regression_tests/tally_assumesep/materials.xml @@ -1,270 +1,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/regression_tests/tally_assumesep/results_true.dat b/tests/regression_tests/tally_assumesep/results_true.dat index 5f4692ad1..d9dc53f0a 100644 --- a/tests/regression_tests/tally_assumesep/results_true.dat +++ b/tests/regression_tests/tally_assumesep/results_true.dat @@ -1,11 +1,11 @@ k-combined: -9.581522E-01 4.261828E-02 +6.161485E-01 2.229530E-02 tally 1: -1.529084E+01 -4.769011E+01 +7.433231E+00 +1.122269E+01 tally 2: -3.198905E+00 -2.114128E+00 +2.545046E-01 +1.340485E-02 tally 3: -4.510603E+01 -4.183089E+02 +1.136947E+01 +2.646408E+01 diff --git a/tests/regression_tests/tally_assumesep/settings.xml b/tests/regression_tests/tally_assumesep/settings.xml index 569c80982..64b69f394 100644 --- a/tests/regression_tests/tally_assumesep/settings.xml +++ b/tests/regression_tests/tally_assumesep/settings.xml @@ -1,18 +1,12 @@ - eigenvalue 10 5 100 - - - - -160 -160 -183 - 160 160 183 - + + 0.0 0.0 0.0 - diff --git a/tests/regression_tests/tally_assumesep/tallies.xml b/tests/regression_tests/tally_assumesep/tallies.xml index c588eb9e4..1e1c5492a 100644 --- a/tests/regression_tests/tally_assumesep/tallies.xml +++ b/tests/regression_tests/tally_assumesep/tallies.xml @@ -1,21 +1,21 @@ - true + false cell - 21 + 1 cell - 22 + 2 cell - 23 + 3 From 961c5a025bd92204118bdc6c4b359dddc69df9fd Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 15 Aug 2019 12:18:01 -0500 Subject: [PATCH 05/16] Update lattice_multiple test --- .../lattice_multiple/geometry.xml | 181 ------------ .../lattice_multiple/inputs_true.dat | 53 ++++ .../lattice_multiple/materials.xml | 270 ------------------ .../lattice_multiple/results_true.dat | 2 +- .../lattice_multiple/settings.xml | 18 -- .../regression_tests/lattice_multiple/test.py | 62 +++- 6 files changed, 113 insertions(+), 473 deletions(-) delete mode 100644 tests/regression_tests/lattice_multiple/geometry.xml create mode 100644 tests/regression_tests/lattice_multiple/inputs_true.dat delete mode 100644 tests/regression_tests/lattice_multiple/materials.xml delete mode 100644 tests/regression_tests/lattice_multiple/settings.xml diff --git a/tests/regression_tests/lattice_multiple/geometry.xml b/tests/regression_tests/lattice_multiple/geometry.xml deleted file mode 100644 index f6f067aad..000000000 --- a/tests/regression_tests/lattice_multiple/geometry.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 17 - -10.71 -10.71 - 1.26 1.26 - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 - 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 - 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - - - - - - 17 17 - -10.71 -10.71 - 1.26 1.26 - - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 3 3 3 3 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8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 - 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 - 7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - - - - diff --git a/tests/regression_tests/lattice_multiple/inputs_true.dat b/tests/regression_tests/lattice_multiple/inputs_true.dat new file mode 100644 index 000000000..c92e841bc --- /dev/null +++ b/tests/regression_tests/lattice_multiple/inputs_true.dat @@ -0,0 +1,53 @@ + + + + + + + + + + 1.2 1.2 + 1 + 2 2 + -1.2 -1.2 + +2 1 +1 1 + + + 2.4 2.4 + 2 2 + -2.4 -2.4 + +4 4 +4 4 + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 10 + 5 + diff --git a/tests/regression_tests/lattice_multiple/materials.xml b/tests/regression_tests/lattice_multiple/materials.xml deleted file mode 100644 index 8021f5f99..000000000 --- a/tests/regression_tests/lattice_multiple/materials.xml +++ /dev/null @@ -1,270 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/regression_tests/lattice_multiple/results_true.dat b/tests/regression_tests/lattice_multiple/results_true.dat index d5d4bd4cc..c1fa5321b 100644 --- a/tests/regression_tests/lattice_multiple/results_true.dat +++ b/tests/regression_tests/lattice_multiple/results_true.dat @@ -1,2 +1,2 @@ k-combined: -9.581522E-01 4.261828E-02 +1.831313E+00 6.958576E-04 diff --git a/tests/regression_tests/lattice_multiple/settings.xml b/tests/regression_tests/lattice_multiple/settings.xml deleted file mode 100644 index 569c80982..000000000 --- a/tests/regression_tests/lattice_multiple/settings.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - eigenvalue - 10 - 5 - 100 - - - - - -160 -160 -183 - 160 160 183 - - - - - diff --git a/tests/regression_tests/lattice_multiple/test.py b/tests/regression_tests/lattice_multiple/test.py index f0672d9a4..a9b15c9c8 100644 --- a/tests/regression_tests/lattice_multiple/test.py +++ b/tests/regression_tests/lattice_multiple/test.py @@ -1,6 +1,62 @@ -from tests.testing_harness import TestHarness +import numpy as np +import openmc +import pytest + +from tests.testing_harness import PyAPITestHarness -def test_lattice_multiple(): - harness = TestHarness('statepoint.10.h5') +@pytest.fixture +def model(): + model = openmc.model.Model() + + uo2 = openmc.Material(name='UO2') + uo2.set_density('g/cm3', 10.0) + uo2.add_nuclide('U235', 1.0) + uo2.add_nuclide('O16', 2.0) + water = openmc.Material(name='light water') + water.add_nuclide('H1', 2.0) + water.add_nuclide('O16', 1.0) + water.set_density('g/cm3', 1.0) + water.add_s_alpha_beta('c_H_in_H2O') + model.materials.extend([uo2, water]) + + cyl = openmc.ZCylinder(r=0.4) + big_cyl = openmc.ZCylinder(r=0.5) + c1 = openmc.Cell(fill=uo2, region=-cyl) + c2 = openmc.Cell(fill=water, region=+cyl) + pin = openmc.Universe(cells=[c1, c2]) + c3 = openmc.Cell(fill=uo2, region=-big_cyl) + c4 = openmc.Cell(fill=water, region=+big_cyl) + big_pin = openmc.Universe(cells=[c3, c4]) + + d = 1.2 + inner_lattice = openmc.RectLattice() + inner_lattice.lower_left = (-d, -d) + inner_lattice.pitch = (d, d) + inner_lattice.outer = pin + inner_lattice.universes = [ + [big_pin, pin], + [pin, pin], + ] + inner_cell = openmc.Cell(fill=inner_lattice) + inner_univ = openmc.Universe(cells=[inner_cell]) + + lattice = openmc.RectLattice() + lattice.lower_left = (-2*d, -2*d) + lattice.pitch = (2*d, 2*d) + lattice.universes = np.full((2, 2), inner_univ) + + box = openmc.model.rectangular_prism(4*d, 4*d, boundary_type='reflective') + main_cell = openmc.Cell(fill=lattice, region=box) + model.geometry = openmc.Geometry([main_cell]) + + model.settings.batches = 10 + model.settings.inactive = 5 + model.settings.particles = 1000 + + return model + + +def test_lattice_multiple(model): + harness = PyAPITestHarness('statepoint.10.h5', model) harness.main() From fa11bacde75a8a93d63b4e53109d306cf1c59d56 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 15 Aug 2019 12:43:10 -0500 Subject: [PATCH 06/16] Update void test (allowing fixed source tests to work with PyAPITestHarness too) --- tests/regression_tests/void/geometry.xml | 40 ------ tests/regression_tests/void/inputs_true.dat | 132 +++++++++++++++++++ tests/regression_tests/void/materials.xml | 61 --------- tests/regression_tests/void/results_true.dat | 105 ++++++++++++++- tests/regression_tests/void/settings.xml | 16 --- tests/regression_tests/void/test.py | 39 +++++- tests/testing_harness.py | 10 +- 7 files changed, 277 insertions(+), 126 deletions(-) delete mode 100644 tests/regression_tests/void/geometry.xml create mode 100644 tests/regression_tests/void/inputs_true.dat delete mode 100644 tests/regression_tests/void/materials.xml delete mode 100644 tests/regression_tests/void/settings.xml diff --git a/tests/regression_tests/void/geometry.xml b/tests/regression_tests/void/geometry.xml deleted file mode 100644 index 48a72c7c3..000000000 --- a/tests/regression_tests/void/geometry.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/regression_tests/void/inputs_true.dat b/tests/regression_tests/void/inputs_true.dat new file mode 100644 index 000000000..644952097 --- /dev/null +++ b/tests/regression_tests/void/inputs_true.dat @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fixed source + 1000 + 3 + + + 0.0 0.0 0.0 + + + + + + + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 + + + 1 + total + + diff --git a/tests/regression_tests/void/materials.xml b/tests/regression_tests/void/materials.xml deleted file mode 100644 index f70c3a40f..000000000 --- a/tests/regression_tests/void/materials.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/regression_tests/void/results_true.dat b/tests/regression_tests/void/results_true.dat index c0e8184b6..ec87df3ba 100644 --- a/tests/regression_tests/void/results_true.dat +++ b/tests/regression_tests/void/results_true.dat @@ -1,2 +1,103 @@ -k-combined: -9.612556E-01 1.990135E-02 +tally 1: +8.636087E-01 +2.486134E-01 +0.000000E+00 +0.000000E+00 +2.848447E+00 +2.704761E+00 +0.000000E+00 +0.000000E+00 +3.944691E+00 +5.195294E+00 +0.000000E+00 +0.000000E+00 +4.822264E+00 +7.764351E+00 +0.000000E+00 +0.000000E+00 +5.295627E+00 +9.359046E+00 +0.000000E+00 +0.000000E+00 +5.331702E+00 +9.480054E+00 +0.000000E+00 +0.000000E+00 +5.598029E+00 +1.044833E+01 +0.000000E+00 +0.000000E+00 +5.803138E+00 +1.124136E+01 +0.000000E+00 +0.000000E+00 +5.768440E+00 +1.110547E+01 +0.000000E+00 +0.000000E+00 +5.554687E+00 +1.029492E+01 +0.000000E+00 +0.000000E+00 +5.503880E+00 +1.011832E+01 +0.000000E+00 +0.000000E+00 +5.059080E+00 +8.564408E+00 +0.000000E+00 +0.000000E+00 +4.718153E+00 +7.431929E+00 +0.000000E+00 +0.000000E+00 +4.575826E+00 +6.980348E+00 +0.000000E+00 +0.000000E+00 +4.283929E+00 +6.120164E+00 +0.000000E+00 +0.000000E+00 +3.997971E+00 +5.330979E+00 +0.000000E+00 +0.000000E+00 +3.735927E+00 +4.653022E+00 +0.000000E+00 +0.000000E+00 +3.302545E+00 +3.645387E+00 +0.000000E+00 +0.000000E+00 +3.082630E+00 +3.203343E+00 +0.000000E+00 +0.000000E+00 +2.775434E+00 +2.569844E+00 +0.000000E+00 +0.000000E+00 +2.518170E+00 +2.134420E+00 +0.000000E+00 +0.000000E+00 +2.233921E+00 +1.666795E+00 +0.000000E+00 +0.000000E+00 +1.829991E+00 +1.118883E+00 +0.000000E+00 +0.000000E+00 +1.420528E+00 +6.755061E-01 +0.000000E+00 +0.000000E+00 +9.856494E-01 +3.253539E-01 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 diff --git a/tests/regression_tests/void/settings.xml b/tests/regression_tests/void/settings.xml deleted file mode 100644 index 32afc717a..000000000 --- a/tests/regression_tests/void/settings.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - eigenvalue - 10 - 5 - 100 - - - - point - 0.0 0.0 0.0 - - - - diff --git a/tests/regression_tests/void/test.py b/tests/regression_tests/void/test.py index af16f2ac8..af1e3887b 100644 --- a/tests/regression_tests/void/test.py +++ b/tests/regression_tests/void/test.py @@ -1,6 +1,39 @@ -from tests.testing_harness import TestHarness +import numpy as np +import openmc +import pytest + +from tests.testing_harness import PyAPITestHarness + +@pytest.fixture +def model(): + model = openmc.model.Model() + + zn = openmc.Material() + zn.set_density('g/cm3', 7.14) + zn.add_nuclide('Zn64', 1.0) + model.materials.append(zn) + + radii = np.linspace(1.0, 100.0) + surfs = [openmc.Sphere(r=r) for r in radii] + surfs[-1].boundary_type = 'vacuum' + cells = [openmc.Cell(fill=(zn if i % 2 == 0 else None), region=region) + for i, region in enumerate(openmc.model.subdivide(surfs))] + model.geometry = openmc.Geometry(cells) + + model.settings.run_mode = 'fixed source' + model.settings.batches = 3 + model.settings.particles = 1000 + model.settings.source = openmc.Source(space=openmc.stats.Point()) + + cell_filter = openmc.CellFilter(cells) + tally = openmc.Tally() + tally.filters = [cell_filter] + tally.scores = ['total'] + model.tallies.append(tally) + + return model -def test_void(): - harness = TestHarness('statepoint.10.h5') +def test_void(model): + harness = PyAPITestHarness('statepoint.3.h5', model) harness.main() diff --git a/tests/testing_harness.py b/tests/testing_harness.py index e341a3cf1..0d3c4bec0 100644 --- a/tests/testing_harness.py +++ b/tests/testing_harness.py @@ -72,10 +72,12 @@ class TestHarness(object): # Read the statepoint file. statepoint = glob.glob(self._sp_name)[0] with openmc.StatePoint(statepoint) as sp: - # Write out k-combined. - outstr = 'k-combined:\n' - form = '{0:12.6E} {1:12.6E}\n' - outstr += form.format(sp.k_combined.n, sp.k_combined.s) + outstr = '' + if sp.run_mode == 'eigenvalue': + # Write out k-combined. + outstr += 'k-combined:\n' + form = '{0:12.6E} {1:12.6E}\n' + outstr += form.format(sp.k_combined.n, sp.k_combined.s) # Write out tally data. for i, tally_ind in enumerate(sp.tallies): From 7bc96c822c14d36a233ca375817e5e6f86eaabce Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 15 Aug 2019 15:45:35 -0500 Subject: [PATCH 07/16] Update tally_aggregation test --- .../tally_aggregation/inputs_true.dat | 316 ++---------------- .../tally_aggregation/results_true.dat | 98 +++++- .../tally_aggregation/test.py | 77 +++-- 3 files changed, 176 insertions(+), 315 deletions(-) diff --git a/tests/regression_tests/tally_aggregation/inputs_true.dat b/tests/regression_tests/tally_aggregation/inputs_true.dat index 86806572a..80356f711 100644 --- a/tests/regression_tests/tally_aggregation/inputs_true.dat +++ b/tests/regression_tests/tally_aggregation/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 7 7 7 7 -7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 -7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 -7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - + + + + + + - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - eigenvalue - 100 + 1000 10 5 - - - -160 -160 -183 160 160 183 - - @@ -313,7 +47,7 @@ 0.0 0.253 1000.0 1000000.0 20000000.0 - 60 + 1 1 2 diff --git a/tests/regression_tests/tally_aggregation/results_true.dat b/tests/regression_tests/tally_aggregation/results_true.dat index f1738ddfd..e48f93370 100644 --- a/tests/regression_tests/tally_aggregation/results_true.dat +++ b/tests/regression_tests/tally_aggregation/results_true.dat @@ -1 +1,97 @@ -eac8fb56a8146b9e186ac9fb003753f4a0a18d4159d10e6fa51da4856baef66a10a0f5fb10c5727b51c6e44d81c147a8a7348ad9c9f7119a6ec33e0361082376 \ No newline at end of file +[[1.63731762e-05 5.08325999e-04] + [3.27547470e-01 1.77506218e-01] + [1.89164083e-02 7.22719366e-01]], [[1.64200315e-05 5.45231503e-04] + [3.24031537e-01 1.75537230e-01] + [1.87708717e-02 7.26768216e-01]], [[1.67487818e-05 5.03394672e-04] + [3.07780931e-01 1.67166322e-01] + [1.97449893e-02 7.06598738e-01]], [[1.63603106e-05 6.10423337e-04] + [3.32313666e-01 1.79982864e-01] + [1.90686364e-02 7.22662206e-01]][[4.65536263e-07 4.34762669e-05] + [9.14451087e-03 4.56766386e-03] + [7.87091351e-04 1.04610084e-02]], [[1.70217471e-07 3.74604055e-05] + [9.18903111e-03 4.56228307e-03] + [1.74179620e-04 9.17281345e-03]], [[2.49291594e-07 1.81470751e-05] + [8.34746285e-03 4.15219947e-03] + [3.57935129e-04 1.00438242e-02]], [[4.12850822e-07 3.98122204e-05] + [1.38191650e-02 6.82224745e-03] + [6.79096490e-04 9.85922061e-03]][[1.03849782e-06 8.14983256e-04] + [1.13114721e+00 5.60394847e-01] + [1.40550899e-06 5.11848857e-01]], [[1.99773314e-06 1.03955500e-03] + [1.42269343e-01 9.92372469e-02] + [3.30482612e-05 8.08235307e-01]], [[1.45630159e-05 2.22446467e-04] + [1.30357824e-02 2.93669452e-02] + [3.05346682e-04 1.10154874e+00]], [[4.83030533e-05 9.03907895e-05] + [5.22127114e-03 1.11935954e-02] + [7.61611053e-02 4.57115627e-01]][[1.87165262e-08 1.43906416e-05] + [2.05916324e-02 1.01675733e-02] + [2.50902573e-08 8.54377830e-03]], [[1.12098060e-07 7.06870145e-05] + [2.16279434e-03 1.42142705e-03] + [1.22851164e-05 1.41445724e-02]], [[2.08629342e-07 1.63602148e-06] + [1.08988258e-04 2.01647731e-04] + [7.14052741e-06 9.13467415e-03]], [[6.49497971e-07 1.17295883e-06] + [7.03193479e-05 1.45388818e-04] + [1.11307638e-03 5.92861613e-03]][[0.28708077 0.27231775]], [[0.283269 0.26846215]], [[0.26933717 0.25561967]], [[0.29146272 0.27665912]], [[0.03591854 0.2267151 ]], [[0.03618374 0.23663228]], [[0.03393119 0.22268261]], [[0.03627092 0.22248212]], [[0.00333501 0.28502144]], [[0.00339378 0.2823686 ]], [[0.0032646 0.27622413]], [[0.0033623 0.28752397]], [[0.02014593 0.11667962]], [[0.01997231 0.11538764]], [[0.02100971 0.11974205]], [[0.02030272 0.11659029]][[0.00908247 0.00614665]], [[0.00911888 0.00556208]], [[0.00831969 0.00596124]], [[0.01375328 0.00849244]], [[0.00106067 0.00719168]], [[0.00113262 0.00790992]], [[0.00067545 0.00732313]], [[0.00134675 0.00584628]], [[5.86657354e-05 4.85962742e-03]], [[3.78231391e-05 3.26052035e-03]], [[7.89746053e-05 5.03120906e-03]], [[2.86395600e-05 4.89110417e-03]], [[0.00078861 0.00414495]], [[0.00017413 0.00090648]], [[0.00035855 0.00190835]], [[0.00068051 0.0036777 ]][[2.07154706e-04] + [4.29264961e-01] + [1.29926403e-01]], [[2.04124023e-04] + [4.23635331e-01] + [1.27891698e-01]], [[1.94482255e-04] + [4.02735295e-01] + [1.22027057e-01]], [[2.10260769e-04] + [4.35906468e-01] + [1.32005105e-01]], [[0.00022426] + [0.06105851] + [0.20135086]], [[0.00026389] + [0.0612101 ] + [0.21134203]], [[0.00023084] + [0.05761498] + [0.19876799]], [[0.00032256] + [0.061623 ] + [0.19680747]], [[5.87610156e-05] + [1.06427230e-02] + [2.77654967e-01]], [[5.94899925e-05] + [1.06822132e-02] + [2.75020675e-01]], [[5.93176564e-05] + [1.03968293e-02] + [2.69032575e-01]], [[5.94408186e-05] + [1.06809621e-02] + [2.80145865e-01]], [[3.45195544e-05] + [4.08749343e-03] + [1.32703540e-01]], [[3.41476180e-05] + [4.04112643e-03] + [1.31284684e-01]], [[3.55075881e-05] + [4.20014745e-03] + [1.36516110e-01]], [[3.45190823e-05] + [4.08609920e-03] + [1.32772398e-01]][[6.53616088e-06] + [1.01396032e-02] + [4.17862796e-03]], [[6.14101518e-06] + [1.01647874e-02] + [3.28144648e-03]], [[6.21879601e-06] + [9.29002877e-03] + [4.29521996e-03]], [[9.37998012e-06] + [1.53282674e-02] + [5.13014723e-03]], [[4.29725320e-05] + [1.28419933e-03] + [7.15501363e-03]], [[3.69392134e-05] + [1.38678579e-03] + [7.86925329e-03]], [[1.70223774e-05] + [7.65771551e-04] + [7.31421975e-03]], [[3.86750728e-05] + [1.59354492e-03] + [5.78376198e-03]], [[4.00936601e-07] + [1.10265266e-04] + [4.85873047e-03]], [[1.02736776e-06] + [7.78918832e-05] + [3.25980910e-03]], [[8.71027724e-07] + [1.64820060e-04] + [5.02912867e-03]], [[8.63231446e-07] + [8.45518855e-05] + [4.89045708e-03]], [[9.39068799e-07] + [1.12928697e-04] + [4.21779516e-03]], [[1.94712273e-07] + [2.39886479e-05] + [9.22741200e-04]], [[4.30155635e-07] + [5.18679547e-05] + [1.94104652e-03]], [[8.32395987e-07] + [1.00319931e-04] + [3.73878581e-03]] \ No newline at end of file diff --git a/tests/regression_tests/tally_aggregation/test.py b/tests/regression_tests/tally_aggregation/test.py index f7df543de..8914ac2a8 100644 --- a/tests/regression_tests/tally_aggregation/test.py +++ b/tests/regression_tests/tally_aggregation/test.py @@ -1,26 +1,63 @@ import hashlib import openmc +import pytest from tests.testing_harness import PyAPITestHarness +@pytest.fixture +def model(): + model = openmc.model.Model() + + fuel = openmc.Material(name='UO2') + fuel.set_density('g/cm3', 10.29769) + fuel.add_nuclide("U234", 4.4843e-6) + fuel.add_nuclide("U235", 5.5815e-4) + fuel.add_nuclide("U238", 2.2408e-2) + fuel.add_nuclide("O16", 4.5829e-2) + water = openmc.Material(name='light water') + water.add_nuclide('H1', 2.0) + water.add_nuclide('O16', 1.0) + water.set_density('g/cm3', 1.0) + water.add_s_alpha_beta('c_H_in_H2O') + model.materials.extend([fuel, water]) + + cyl = openmc.ZCylinder(r=0.4) + c1 = openmc.Cell(fill=fuel, region=-cyl) + c2 = openmc.Cell(fill=water, region=+cyl) + pin = openmc.Universe(cells=[c1, c2]) + d = 1.2 + lattice = openmc.RectLattice() + lattice.lower_left = (-d, -d) + lattice.pitch = (d, d) + lattice.outer = pin + lattice.universes = [ + [pin, pin], + [pin, pin], + ] + box = openmc.model.rectangular_prism(2*d, 2*d, boundary_type='reflective') + main_cell = openmc.Cell(fill=lattice, region=box) + model.geometry = openmc.Geometry([main_cell]) + + model.settings.batches = 10 + model.settings.inactive = 5 + model.settings.particles = 1000 + + energy_filter = openmc.EnergyFilter([0.0, 0.253, 1.0e3, 1.0e6, 20.0e6]) + distrib_filter = openmc.DistribcellFilter(c1) + tally = openmc.Tally(name='distribcell tally') + tally.filters = [energy_filter, distrib_filter] + tally.scores = ['nu-fission', 'total'] + tally.nuclides = ['U234', 'U235', 'U238'] + model.tallies.append(tally) + + return model + + + class TallyAggregationTestHarness(PyAPITestHarness): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - # Initialize the filters - energy_filter = openmc.EnergyFilter([0.0, 0.253, 1.0e3, 1.0e6, 20.0e6]) - distrib_filter = openmc.DistribcellFilter(60) - - # Initialized the tallies - tally = openmc.Tally(name='distribcell tally') - tally.filters = [energy_filter, distrib_filter] - tally.scores = ['nu-fission', 'total'] - tally.nuclides = ['U234', 'U235', 'U238'] - self._model.tallies.append(tally) - - def _get_results(self, hash_output=True): + def _get_results(self, hash_output=False): """Digest info in the statepoint and return as a string.""" # Read the statepoint file. @@ -52,15 +89,9 @@ class TallyAggregationTestHarness(PyAPITestHarness): outstr += ', '.join(map(str, tally_sum.mean)) outstr += ', '.join(map(str, tally_sum.std_dev)) - # Hash the results if necessary - if hash_output: - sha512 = hashlib.sha512() - sha512.update(outstr.encode('utf-8')) - outstr = sha512.hexdigest() - return outstr -def test_tally_aggregation(): - harness = TallyAggregationTestHarness('statepoint.10.h5') +def test_tally_aggregation(model): + harness = TallyAggregationTestHarness('statepoint.10.h5', model) harness.main() From e1d2a9d802a469919b1749afcbfc11b17af2a7b1 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 19 Aug 2019 09:34:01 -0500 Subject: [PATCH 08/16] Update tally_arithmetic test --- .../tally_arithmetic/inputs_true.dat | 327 ++---------------- .../tally_arithmetic/results_true.dat | 188 +++------- .../regression_tests/tally_arithmetic/test.py | 114 +++--- 3 files changed, 140 insertions(+), 489 deletions(-) diff --git a/tests/regression_tests/tally_arithmetic/inputs_true.dat b/tests/regression_tests/tally_arithmetic/inputs_true.dat index 842b0df62..fbbf94fa9 100644 --- a/tests/regression_tests/tally_arithmetic/inputs_true.dat +++ b/tests/regression_tests/tally_arithmetic/inputs_true.dat @@ -1,338 +1,55 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1.26 1.26 - 17 17 - -10.71 -10.71 - -1 1 1 1 1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7 7 - - - - - - - - - - - - - - - - - - + + + + - - - - - - - + + + + + - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - eigenvalue - 100 - 10 - 5 - - - -160 -160 -183 160 160 183 - - + 1000 + 5 + 0 - 2 2 2 - -160.0 -160.0 -183.0 - 160.0 160.0 183.0 + 2 2 + -10.0 -10.0 + 10.0 10.0 - 1 3 + 1 2 - 0.0 2.53e-07 0.001 1.0 20.0 + 0.0 10.0 20000000.0 - - 60 - - + 1 - 2 1 3 + 2 1 U234 U235 nu-fission total - 1 4 + 1 3 U238 U235 total fission diff --git a/tests/regression_tests/tally_arithmetic/results_true.dat b/tests/regression_tests/tally_arithmetic/results_true.dat index 6302095d0..c10e0fb38 100644 --- a/tests/regression_tests/tally_arithmetic/results_true.dat +++ b/tests/regression_tests/tally_arithmetic/results_true.dat @@ -1,139 +1,49 @@ -[[[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - ... - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]]][[[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - ... - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]]][[[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - ... - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]] - - [[0. 0. 0. 0.] - [0. 0. 0. 0.] - [0. 0. 0. 0.]]][[[0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.]] - - [[0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.]] - - [[0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.]] - - ... - - [[0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.]] - - [[0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.]] - - [[0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.]]][[[0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.]] - - [[0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.]] - - [[0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.]] - - ... - - [[0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.]] - - [[0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.]] - - [[0. 0. 0.] - [0. 0. 0.] - [0. 0. 0.]]] \ No newline at end of file +[2.87610e-07 1.60278e-13 2.54988e-04 1.42099e-10 2.33002e-07 1.83973e-07 + 2.06574e-04 1.63105e-04 7.77662e-03 4.33372e-09 4.02417e-03 2.24257e-09 + 6.30008e-03 4.97439e-03 3.26010e-03 2.57410e-03 2.52614e-07 1.57719e-13 + 2.23961e-04 1.39830e-10 2.43493e-07 1.93615e-07 2.15874e-04 1.71654e-04 + 6.83035e-03 4.26453e-09 3.53450e-03 2.20677e-09 6.58373e-03 5.23510e-03 + 3.40688e-03 2.70901e-03 2.72019e-07 1.63161e-13 2.41165e-04 1.44654e-10 + 2.44531e-07 1.94194e-07 2.16795e-04 1.72167e-04 7.35506e-03 4.41166e-09 + 3.80602e-03 2.28290e-09 6.61180e-03 5.25075e-03 3.42141e-03 2.71710e-03 + 2.41472e-07 1.50936e-13 2.14083e-04 1.33816e-10 2.24252e-07 1.77892e-07 + 1.98816e-04 1.57715e-04 6.52910e-03 4.08113e-09 3.37861e-03 2.11186e-09 + 6.06350e-03 4.80998e-03 3.13768e-03 2.48902e-03 2.48914e-03 4.48016e-05 + 1.13508e-02 2.04302e-04 1.19934e-04 2.60981e-05 5.46915e-04 1.19011e-04 + 2.77675e-02 4.99783e-04 4.93334e-02 8.87945e-04 1.33792e-03 2.91137e-04 + 2.37703e-03 5.17251e-04 2.49083e-03 4.43597e-05 1.13585e-02 2.02286e-04 + 1.21668e-04 2.66359e-05 5.54821e-04 1.21463e-04 2.77864e-02 4.94854e-04 + 4.93670e-02 8.79187e-04 1.35726e-03 2.97136e-04 2.41139e-03 5.27909e-04 + 2.28387e-03 4.25108e-05 1.04148e-02 1.93855e-04 1.16292e-04 2.67442e-05 + 5.30307e-04 1.21957e-04 2.54776e-02 4.74228e-04 4.52651e-02 8.42543e-04 + 1.29729e-03 2.98344e-04 2.30485e-03 5.30056e-04 2.25849e-03 4.37806e-05 + 1.02990e-02 1.99646e-04 1.16539e-04 2.71633e-05 5.31435e-04 1.23868e-04 + 2.51945e-02 4.88393e-04 4.47620e-02 8.67709e-04 1.30005e-03 3.03020e-04 + 2.30975e-03 5.38363e-04][2.87610e-07 1.60278e-13 2.54988e-04 1.42099e-10 2.33002e-07 1.83973e-07 + 2.06574e-04 1.63105e-04 7.77662e-03 4.33372e-09 4.02417e-03 2.24257e-09 + 6.30008e-03 4.97439e-03 3.26010e-03 2.57410e-03 2.52614e-07 1.57719e-13 + 2.23961e-04 1.39830e-10 2.43493e-07 1.93615e-07 2.15874e-04 1.71654e-04 + 6.83035e-03 4.26453e-09 3.53450e-03 2.20677e-09 6.58373e-03 5.23510e-03 + 3.40688e-03 2.70901e-03 2.72019e-07 1.63161e-13 2.41165e-04 1.44654e-10 + 2.44531e-07 1.94194e-07 2.16795e-04 1.72167e-04 7.35506e-03 4.41166e-09 + 3.80602e-03 2.28290e-09 6.61180e-03 5.25075e-03 3.42141e-03 2.71710e-03 + 2.41472e-07 1.50936e-13 2.14083e-04 1.33816e-10 2.24252e-07 1.77892e-07 + 1.98816e-04 1.57715e-04 6.52910e-03 4.08113e-09 3.37861e-03 2.11186e-09 + 6.06350e-03 4.80998e-03 3.13768e-03 2.48902e-03 2.48914e-03 4.48016e-05 + 1.13508e-02 2.04302e-04 1.19934e-04 2.60981e-05 5.46915e-04 1.19011e-04 + 2.77675e-02 4.99783e-04 4.93334e-02 8.87945e-04 1.33792e-03 2.91137e-04 + 2.37703e-03 5.17251e-04 2.49083e-03 4.43597e-05 1.13585e-02 2.02286e-04 + 1.21668e-04 2.66359e-05 5.54821e-04 1.21463e-04 2.77864e-02 4.94854e-04 + 4.93670e-02 8.79187e-04 1.35726e-03 2.97136e-04 2.41139e-03 5.27909e-04 + 2.28387e-03 4.25108e-05 1.04148e-02 1.93855e-04 1.16292e-04 2.67442e-05 + 5.30307e-04 1.21957e-04 2.54776e-02 4.74228e-04 4.52651e-02 8.42543e-04 + 1.29729e-03 2.98344e-04 2.30485e-03 5.30056e-04 2.25849e-03 4.37806e-05 + 1.02990e-02 1.99646e-04 1.16539e-04 2.71633e-05 5.31435e-04 1.23868e-04 + 2.51945e-02 4.88393e-04 4.47620e-02 8.67709e-04 1.30005e-03 3.03020e-04 + 2.30975e-03 5.38363e-04][0.0063 0.00497 0.00326 0.00257 0.00658 0.00524 0.00341 0.00271 0.00661 + 0.00525 0.00342 0.00272 0.00606 0.00481 0.00314 0.00249 0.00134 0.00029 + 0.00238 0.00052 0.00136 0.0003 0.00241 0.00053 0.0013 0.0003 0.0023 + 0.00053 0.0013 0.0003 0.00231 0.00054][0.00025 0.00021 0.00402 0.00326 0.00022 0.00022 0.00353 0.00341 0.00024 + 0.00022 0.00381 0.00342 0.00021 0.0002 0.00338 0.00314 0.01135 0.00055 + 0.04933 0.00238 0.01136 0.00055 0.04937 0.00241 0.01041 0.00053 0.04527 + 0.0023 0.0103 0.00053 0.04476 0.00231][0.00326 0.00341 0.00342 0.00314 0.00238 0.00241 0.0023 0.00231] \ No newline at end of file diff --git a/tests/regression_tests/tally_arithmetic/test.py b/tests/regression_tests/tally_arithmetic/test.py index 236f5cc38..532160a17 100644 --- a/tests/regression_tests/tally_arithmetic/test.py +++ b/tests/regression_tests/tally_arithmetic/test.py @@ -1,39 +1,61 @@ import hashlib +import numpy as np import openmc +import pytest from tests.testing_harness import PyAPITestHarness +@pytest.fixture +def model(): + model = openmc.model.Model() + + fuel = openmc.Material() + fuel.set_density('g/cm3', 10.0) + fuel.add_nuclide('U234', 1.0) + fuel.add_nuclide('U235', 4.0) + fuel.add_nuclide('U238', 95.0) + water = openmc.Material(name='light water') + water.add_nuclide('H1', 2.0) + water.add_nuclide('O16', 1.0) + water.set_density('g/cm3', 1.0) + water.add_s_alpha_beta('c_H_in_H2O') + model.materials.extend([fuel, water]) + + cyl1 = openmc.ZCylinder(r=5.0) + cyl2 = openmc.ZCylinder(r=10.0, boundary_type='vacuum') + cell1 = openmc.Cell(fill=fuel, region=-cyl1) + cell2 = openmc.Cell(fill=water, region=+cyl1 & -cyl2) + model.geometry = openmc.Geometry([cell1, cell2]) + + model.settings.batches = 5 + model.settings.inactive = 0 + model.settings.particles = 1000 + + mesh = openmc.RegularMesh() + mesh.dimension = (2, 2) + mesh.lower_left = (-10.0, -10.0) + mesh.upper_right = (10.0, 10.0) + energy_filter = openmc.EnergyFilter((0.0, 10.0, 20.0e6)) + material_filter = openmc.MaterialFilter((fuel, water)) + mesh_filter = openmc.MeshFilter(mesh) + + tally = openmc.Tally(name='tally 1') + tally.filters = [material_filter, energy_filter] + tally.scores = ['nu-fission', 'total'] + tally.nuclides = ['U234', 'U235'] + model.tallies.append(tally) + tally = openmc.Tally(name='tally 2') + tally.filters = [energy_filter, mesh_filter] + tally.scores = ['total', 'fission'] + tally.nuclides = ['U238', 'U235'] + model.tallies.append(tally) + + return model + + class TallyArithmeticTestHarness(PyAPITestHarness): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - # Initialize Mesh - mesh = openmc.RegularMesh(mesh_id=1) - mesh.dimension = [2, 2, 2] - mesh.lower_left = [-160.0, -160.0, -183.0] - mesh.upper_right = [160.0, 160.0, 183.0] - - # Initialize the filters - energy_filter = openmc.EnergyFilter((0.0, 0.253e-6, 1.0e-3, 1.0, 20.0)) - material_filter = openmc.MaterialFilter((1, 3)) - distrib_filter = openmc.DistribcellFilter(60) - mesh_filter = openmc.MeshFilter(mesh) - - # Initialized the tallies - tally = openmc.Tally(name='tally 1') - tally.filters = [material_filter, energy_filter, distrib_filter] - tally.scores = ['nu-fission', 'total'] - tally.nuclides = ['U234', 'U235'] - self._model.tallies.append(tally) - - tally = openmc.Tally(name='tally 2') - tally.filters = [energy_filter, mesh_filter] - tally.scores = ['total', 'fission'] - tally.nuclides = ['U238', 'U235'] - self._model.tallies.append(tally) - def _get_results(self, hash_output=False): """Digest info in the statepoint and return as a string.""" @@ -45,27 +67,29 @@ class TallyArithmeticTestHarness(PyAPITestHarness): tally_2 = sp.get_tally(name='tally 2') # Perform all the tally arithmetic operations and output results - outstr = '' - tally_3 = tally_1 * tally_2 - outstr += str(tally_3.mean) + output = [] + with np.printoptions(precision=5, threshold=np.inf): + mean = (tally_1 * tally_2).mean + output.append(str(mean[np.nonzero(mean)])) - tally_3 = tally_1.hybrid_product(tally_2, '*', 'entrywise', 'tensor', - 'tensor') - outstr += str(tally_3.mean) + mean = tally_1.hybrid_product( + tally_2, '*', 'entrywise', 'tensor', 'tensor').mean + output.append(str(mean[np.nonzero(mean)])) - tally_3 = tally_1.hybrid_product(tally_2, '*', 'entrywise', 'entrywise', - 'tensor') - outstr += str(tally_3.mean) + mean = tally_1.hybrid_product( + tally_2, '*', 'entrywise', 'entrywise', 'tensor').mean + output.append(str(mean[np.nonzero(mean)])) - tally_3 = tally_1.hybrid_product(tally_2, '*', 'entrywise', 'tensor', - 'entrywise') - outstr += str(tally_3.mean) + mean = tally_1.hybrid_product( + tally_2, '*', 'entrywise', 'tensor', 'entrywise').mean + output.append(str(mean[np.nonzero(mean)])) - tally_3 = tally_1.hybrid_product(tally_2, '*', 'entrywise', 'entrywise', - 'entrywise') - outstr += str(tally_3.mean) + mean = tally_1.hybrid_product( + tally_2, '*', 'entrywise', 'entrywise', 'entrywise').mean + output.append(str(mean[np.nonzero(mean)])) # Hash the results if necessary + outstr = ''.join(output) if hash_output: sha512 = hashlib.sha512() sha512.update(outstr.encode('utf-8')) @@ -74,6 +98,6 @@ class TallyArithmeticTestHarness(PyAPITestHarness): return outstr -def test_tally_arithmetic(): - harness = TallyArithmeticTestHarness('statepoint.10.h5') +def test_tally_arithmetic(model): + harness = TallyArithmeticTestHarness('statepoint.5.h5', model) harness.main() From c245f78148cb2534f5e1058f2da751c514fc5125 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 19 Aug 2019 09:49:41 -0500 Subject: [PATCH 09/16] Update mgxs_library_mesh test --- .../mgxs_library_mesh/inputs_true.dat | 318 +---------- .../mgxs_library_mesh/results_true.dat | 504 +++++++++--------- .../mgxs_library_mesh/test.py | 100 ++-- 3 files changed, 336 insertions(+), 586 deletions(-) diff --git a/tests/regression_tests/mgxs_library_mesh/inputs_true.dat b/tests/regression_tests/mgxs_library_mesh/inputs_true.dat index 4f138b24f..f0f93d43c 100644 --- a/tests/regression_tests/mgxs_library_mesh/inputs_true.dat +++ b/tests/regression_tests/mgxs_library_mesh/inputs_true.dat @@ -1,311 +1,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1.26 1.26 - 17 17 - -10.71 -10.71 - -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 -1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 -1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - - - 1.26 1.26 - 17 17 - -10.71 -10.71 - -3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 -3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 -3 3 3 3 3 4 3 3 4 3 3 4 3 3 3 3 3 -3 3 3 4 3 3 3 3 3 3 3 3 3 4 3 3 3 -3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 -3 3 4 3 3 4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 8 8 7 7 7 -7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 -7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 -7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 -7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 -7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + eigenvalue - 100 - 10 - 5 - - - -160 -160 -183 160 160 183 - - + 1000 + 5 + 0 diff --git a/tests/regression_tests/mgxs_library_mesh/results_true.dat b/tests/regression_tests/mgxs_library_mesh/results_true.dat index 829edde9f..f1ff29d6c 100644 --- a/tests/regression_tests/mgxs_library_mesh/results_true.dat +++ b/tests/regression_tests/mgxs_library_mesh/results_true.dat @@ -1,310 +1,310 @@ mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.762544 0.085298 -2 1 2 1 1 total 0.644837 0.088457 -1 2 1 1 1 total 0.653375 0.153317 -3 2 2 1 1 total 0.676480 0.094215 +0 1 1 1 1 total 0.105390 0.006421 +2 1 2 1 1 total 0.105466 0.003175 +1 2 1 1 1 total 0.106221 0.004040 +3 2 2 1 1 total 0.102641 0.002129 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.473988 0.088732 -2 1 2 1 1 total 0.399254 0.091318 -1 2 1 1 1 total 0.379821 0.167092 -3 2 2 1 1 total 0.424265 0.099551 +0 1 1 1 1 total 0.078603 0.006888 +2 1 2 1 1 total 0.075950 0.003755 +1 2 1 1 1 total 0.074519 0.004589 +3 2 2 1 1 total 0.072616 0.002838 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.473988 0.088732 -2 1 2 1 1 total 0.399254 0.091318 -1 2 1 1 1 total 0.379821 0.167092 -3 2 2 1 1 total 0.424265 0.099551 +0 1 1 1 1 total 0.078605 0.006892 +2 1 2 1 1 total 0.075989 0.003746 +1 2 1 1 1 total 0.074571 0.004600 +3 2 2 1 1 total 0.072586 0.002824 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.027288 0.005813 -2 1 2 1 1 total 0.020262 0.003701 -1 2 1 1 1 total 0.019449 0.004420 -3 2 2 1 1 total 0.021266 0.002869 +0 1 1 1 1 total 0.013600 0.000926 +2 1 2 1 1 total 0.013584 0.000551 +1 2 1 1 1 total 0.013692 0.000712 +3 2 2 1 1 total 0.013022 0.000430 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.016037 0.006339 -2 1 2 1 1 total 0.013018 0.003521 -1 2 1 1 1 total 0.012153 0.003804 -3 2 2 1 1 total 0.012965 0.002454 +0 1 1 1 1 total 0.001333 0.001105 +2 1 2 1 1 total 0.001339 0.000693 +1 2 1 1 1 total 0.001330 0.000885 +3 2 2 1 1 total 0.001260 0.000534 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.011251 0.003050 -2 1 2 1 1 total 0.007243 0.001219 -1 2 1 1 1 total 0.007296 0.001795 -3 2 2 1 1 total 0.008301 0.001066 +0 1 1 1 1 total 0.012266 0.000830 +2 1 2 1 1 total 0.012244 0.000486 +1 2 1 1 1 total 0.012361 0.000650 +3 2 2 1 1 total 0.011762 0.000376 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.027498 0.007445 -2 1 2 1 1 total 0.017954 0.003077 -1 2 1 1 1 total 0.017912 0.004426 -3 2 2 1 1 total 0.020469 0.002617 +0 1 1 1 1 total 0.032001 0.002161 +2 1 2 1 1 total 0.031882 0.001271 +1 2 1 1 1 total 0.032193 0.001701 +3 2 2 1 1 total 0.030726 0.001000 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 2.177345e+06 589804.301157 -2 1 2 1 1 total 1.404096e+06 236476.852674 -1 2 1 1 1 total 1.413154e+06 347806.623478 -3 2 2 1 1 total 1.608259e+06 206502.707123 +0 1 1 1 1 total 2.372379e+06 160440.303797 +2 1 2 1 1 total 2.368109e+06 93914.371991 +1 2 1 1 1 total 2.390701e+06 125743.883417 +3 2 2 1 1 total 2.274785e+06 72785.094827 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.735256 0.080216 -2 1 2 1 1 total 0.624575 0.084974 -1 2 1 1 1 total 0.633925 0.149098 -3 2 2 1 1 total 0.655214 0.091422 +0 1 1 1 1 total 0.091790 0.005503 +2 1 2 1 1 total 0.091883 0.002653 +1 2 1 1 1 total 0.092530 0.003354 +3 2 2 1 1 total 0.089619 0.001721 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.763779 0.070696 -2 1 2 1 1 total 0.628158 0.064356 -1 2 1 1 1 total 0.640809 0.158369 -3 2 2 1 1 total 0.645171 0.080467 +0 1 1 1 1 total 0.087817 0.005624 +2 1 2 1 1 total 0.090790 0.005246 +1 2 1 1 1 total 0.093736 0.005609 +3 2 2 1 1 total 0.092035 0.003633 mesh 1 group in group out legendre nuclide mean std. dev. x y z -0 1 1 1 1 1 P0 total 0.763779 0.070696 -1 1 1 1 1 1 P1 total 0.288556 0.024446 -2 1 1 1 1 1 P2 total 0.082441 0.011443 -3 1 1 1 1 1 P3 total -0.005627 0.012638 -8 1 2 1 1 1 P0 total 0.628158 0.064356 -9 1 2 1 1 1 P1 total 0.245583 0.022676 -10 1 2 1 1 1 P2 total 0.086370 0.007833 -11 1 2 1 1 1 P3 total 0.019590 0.005345 -4 2 1 1 1 1 P0 total 0.640809 0.158369 -5 2 1 1 1 1 P1 total 0.273553 0.066437 -6 2 1 1 1 1 P2 total 0.108446 0.024435 -7 2 1 1 1 1 P3 total 0.012229 0.003785 -12 2 2 1 1 1 P0 total 0.645171 0.080467 -13 2 2 1 1 1 P1 total 0.252215 0.032154 -14 2 2 1 1 1 P2 total 0.089251 0.009734 -15 2 2 1 1 1 P3 total 0.004748 0.002987 +0 1 1 1 1 1 P0 total 0.087684 0.005584 +1 1 1 1 1 1 P1 total 0.026787 0.002493 +2 1 1 1 1 1 P2 total 0.014937 0.001035 +3 1 1 1 1 1 P3 total 0.007893 0.001109 +8 1 2 1 1 1 P0 total 0.090687 0.005242 +9 1 2 1 1 1 P1 total 0.029516 0.002004 +10 1 2 1 1 1 P2 total 0.016952 0.001093 +11 1 2 1 1 1 P3 total 0.008019 0.001095 +4 2 1 1 1 1 P0 total 0.093670 0.005616 +5 2 1 1 1 1 P1 total 0.031703 0.002177 +6 2 1 1 1 1 P2 total 0.017922 0.001352 +7 2 1 1 1 1 P3 total 0.011171 0.001055 +12 2 2 1 1 1 P0 total 0.091808 0.003617 +13 2 2 1 1 1 P1 total 0.030025 0.001876 +14 2 2 1 1 1 P2 total 0.015181 0.002277 +15 2 2 1 1 1 P3 total 0.009550 0.001713 mesh 1 group in group out legendre nuclide mean std. dev. x y z -0 1 1 1 1 1 P0 total 0.763779 0.070696 -1 1 1 1 1 1 P1 total 0.288556 0.024446 -2 1 1 1 1 1 P2 total 0.082441 0.011443 -3 1 1 1 1 1 P3 total -0.005627 0.012638 -8 1 2 1 1 1 P0 total 0.628158 0.064356 -9 1 2 1 1 1 P1 total 0.245583 0.022676 -10 1 2 1 1 1 P2 total 0.086370 0.007833 -11 1 2 1 1 1 P3 total 0.019590 0.005345 -4 2 1 1 1 1 P0 total 0.640809 0.158369 -5 2 1 1 1 1 P1 total 0.273553 0.066437 -6 2 1 1 1 1 P2 total 0.108446 0.024435 -7 2 1 1 1 1 P3 total 0.012229 0.003785 -12 2 2 1 1 1 P0 total 0.645171 0.080467 -13 2 2 1 1 1 P1 total 0.252215 0.032154 -14 2 2 1 1 1 P2 total 0.089251 0.009734 -15 2 2 1 1 1 P3 total 0.004748 0.002987 - mesh 1 group in group out nuclide mean std. dev. - x y z -0 1 1 1 1 1 total 1.0 0.108337 -2 1 2 1 1 1 total 1.0 0.113128 -1 2 1 1 1 1 total 1.0 0.238517 -3 2 2 1 1 1 total 1.0 0.132597 +0 1 1 1 1 1 P0 total 0.087817 0.005624 +1 1 1 1 1 1 P1 total 0.026785 0.002504 +2 1 1 1 1 1 P2 total 0.014973 0.001041 +3 1 1 1 1 1 P3 total 0.007913 0.001144 +8 1 2 1 1 1 P0 total 0.090790 0.005246 +9 1 2 1 1 1 P1 total 0.029477 0.001987 +10 1 2 1 1 1 P2 total 0.016940 0.001094 +11 1 2 1 1 1 P3 total 0.008033 0.001104 +4 2 1 1 1 1 P0 total 0.093736 0.005609 +5 2 1 1 1 1 P1 total 0.031651 0.002201 +6 2 1 1 1 1 P2 total 0.017953 0.001364 +7 2 1 1 1 1 P3 total 0.011158 0.001044 +12 2 2 1 1 1 P0 total 0.092035 0.003633 +13 2 2 1 1 1 P1 total 0.030055 0.001856 +14 2 2 1 1 1 P2 total 0.015245 0.002274 +15 2 2 1 1 1 P3 total 0.009534 0.001700 mesh 1 group in group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.015584 0.003404 -2 1 2 1 1 1 total 0.017684 0.002499 -1 2 1 1 1 1 total 0.014200 0.003676 -3 2 2 1 1 1 total 0.022409 0.002481 +0 1 1 1 1 1 total 1.001515 0.075311 +2 1 2 1 1 1 total 1.001135 0.061671 +1 2 1 1 1 1 total 1.000704 0.055977 +3 2 2 1 1 1 total 1.002471 0.042246 + mesh 1 group in group out nuclide mean std. dev. + x y z +0 1 1 1 1 1 total 0.031246 0.001839 +2 1 2 1 1 1 total 0.032452 0.002365 +1 2 1 1 1 1 total 0.032568 0.002068 +3 2 2 1 1 1 total 0.031529 0.001639 mesh 1 group in group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 1.0 0.108337 -2 1 2 1 1 1 total 1.0 0.113128 -1 2 1 1 1 1 total 1.0 0.238517 -3 2 2 1 1 1 total 1.0 0.132597 +0 1 1 1 1 1 total 1.0 0.074891 +2 1 2 1 1 1 total 1.0 0.061618 +1 2 1 1 1 1 total 1.0 0.056068 +3 2 2 1 1 1 total 1.0 0.042067 mesh 1 group in group out legendre nuclide mean std. dev. x y z -0 1 1 1 1 1 P0 total 0.735256 0.113047 -1 1 1 1 1 1 P1 total 0.277780 0.041434 -2 1 1 1 1 1 P2 total 0.079362 0.014706 -3 1 1 1 1 1 P3 total -0.005417 0.012184 -8 1 2 1 1 1 P0 total 0.624575 0.110512 -9 1 2 1 1 1 P1 total 0.244182 0.041824 -10 1 2 1 1 1 P2 total 0.085877 0.014634 -11 1 2 1 1 1 P3 total 0.019478 0.006012 -4 2 1 1 1 1 P0 total 0.633925 0.212349 -5 2 1 1 1 1 P1 total 0.270615 0.089799 -6 2 1 1 1 1 P2 total 0.107281 0.034246 -7 2 1 1 1 1 P3 total 0.012098 0.004637 -12 2 2 1 1 1 P0 total 0.655214 0.126119 -13 2 2 1 1 1 P1 total 0.256141 0.049765 -14 2 2 1 1 1 P2 total 0.090641 0.016563 -15 2 2 1 1 1 P3 total 0.004822 0.003115 +0 1 1 1 1 1 P0 total 0.091790 0.008806 +1 1 1 1 1 1 P1 total 0.028042 0.003295 +2 1 1 1 1 1 P2 total 0.015636 0.001560 +3 1 1 1 1 1 P3 total 0.008263 0.001304 +8 1 2 1 1 1 P0 total 0.091883 0.006252 +9 1 2 1 1 1 P1 total 0.029905 0.002297 +10 1 2 1 1 1 P2 total 0.017175 0.001268 +11 1 2 1 1 1 P3 total 0.008124 0.001147 +4 2 1 1 1 1 P0 total 0.092530 0.006177 +5 2 1 1 1 1 P1 total 0.031317 0.002339 +6 2 1 1 1 1 P2 total 0.017704 0.001433 +7 2 1 1 1 1 P3 total 0.011035 0.001092 +12 2 2 1 1 1 P0 total 0.089619 0.004144 +13 2 2 1 1 1 P1 total 0.029309 0.001964 +14 2 2 1 1 1 P2 total 0.014820 0.002251 +15 2 2 1 1 1 P3 total 0.009322 0.001687 mesh 1 group in group out legendre nuclide mean std. dev. x y z -0 1 1 1 1 1 P0 total 0.735256 0.138292 -1 1 1 1 1 1 P1 total 0.277780 0.051210 -2 1 1 1 1 1 P2 total 0.079362 0.017035 -3 1 1 1 1 1 P3 total -0.005417 0.012198 -8 1 2 1 1 1 P0 total 0.624575 0.131169 -9 1 2 1 1 1 P1 total 0.244182 0.050123 -10 1 2 1 1 1 P2 total 0.085877 0.017565 -11 1 2 1 1 1 P3 total 0.019478 0.006403 -4 2 1 1 1 1 P0 total 0.633925 0.260681 -5 2 1 1 1 1 P1 total 0.270615 0.110590 -6 2 1 1 1 1 P2 total 0.107281 0.042750 -7 2 1 1 1 1 P3 total 0.012098 0.005462 -12 2 2 1 1 1 P0 total 0.655214 0.153147 -13 2 2 1 1 1 P1 total 0.256141 0.060250 -14 2 2 1 1 1 P2 total 0.090641 0.020464 -15 2 2 1 1 1 P3 total 0.004822 0.003180 +0 1 1 1 1 1 P0 total 0.091929 0.011205 +1 1 1 1 1 1 P1 total 0.028084 0.003918 +2 1 1 1 1 1 P2 total 0.015660 0.001956 +3 1 1 1 1 1 P3 total 0.008276 0.001447 +8 1 2 1 1 1 P0 total 0.091987 0.008443 +9 1 2 1 1 1 P1 total 0.029939 0.002948 +10 1 2 1 1 1 P2 total 0.017195 0.001653 +11 1 2 1 1 1 P3 total 0.008134 0.001253 +4 2 1 1 1 1 P0 total 0.092595 0.008065 +5 2 1 1 1 1 P1 total 0.031339 0.002924 +6 2 1 1 1 1 P2 total 0.017716 0.001743 +7 2 1 1 1 1 P3 total 0.011042 0.001255 +12 2 2 1 1 1 P0 total 0.089840 0.005621 +13 2 2 1 1 1 P1 total 0.029381 0.002326 +14 2 2 1 1 1 P2 total 0.014856 0.002342 +15 2 2 1 1 1 P3 total 0.009345 0.001737 mesh 1 group out nuclide mean std. dev. x y z -0 1 1 1 1 total 1.0 0.300047 -2 1 2 1 1 total 1.0 0.178169 -1 2 1 1 1 total 1.0 0.262180 -3 2 2 1 1 total 1.0 0.104797 +0 1 1 1 1 total 1.0 0.066520 +2 1 2 1 1 total 1.0 0.087934 +1 2 1 1 1 total 1.0 0.063390 +3 2 2 1 1 total 1.0 0.063791 mesh 1 group out nuclide mean std. dev. x y z -0 1 1 1 1 total 1.0 0.300047 -2 1 2 1 1 total 1.0 0.178169 -1 2 1 1 1 total 1.0 0.262180 -3 2 2 1 1 total 1.0 0.108931 +0 1 1 1 1 total 1.0 0.068463 +2 1 2 1 1 total 1.0 0.091776 +1 2 1 1 1 total 1.0 0.064705 +3 2 2 1 1 total 1.0 0.063003 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 7.097008e-07 1.458546e-07 -2 1 2 1 1 total 4.407745e-07 7.903907e-08 -1 2 1 1 1 total 3.984535e-07 1.157576e-07 -3 2 2 1 1 total 4.750476e-07 6.207437e-08 +0 1 1 1 1 total 8.735713e-10 4.530341e-11 +2 1 2 1 1 total 8.821319e-10 3.206094e-11 +1 2 1 1 1 total 8.699208e-10 2.515246e-11 +3 2 2 1 1 total 8.738762e-10 1.734562e-11 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.027311 0.007397 -2 1 2 1 1 total 0.017820 0.003054 -1 2 1 1 1 total 0.017783 0.004394 -3 2 2 1 1 total 0.020320 0.002598 +0 1 1 1 1 total 0.031799 0.002147 +2 1 2 1 1 total 0.031680 0.001263 +1 2 1 1 1 total 0.031989 0.001691 +3 2 2 1 1 total 0.030533 0.000994 mesh 1 group in group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.015584 0.003404 -2 1 2 1 1 1 total 0.017684 0.002499 -1 2 1 1 1 1 total 0.014200 0.003676 -3 2 2 1 1 1 total 0.022259 0.002508 +0 1 1 1 1 1 total 0.031056 0.001862 +2 1 2 1 1 1 total 0.032188 0.002420 +1 2 1 1 1 1 total 0.032304 0.002073 +3 2 2 1 1 1 total 0.031336 0.001614 mesh 1 delayedgroup group in nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.000006 1.689606e-06 -1 1 1 1 2 1 total 0.000033 8.718916e-06 -2 1 1 1 3 1 total 0.000032 8.323051e-06 -3 1 1 1 4 1 total 0.000072 1.866015e-05 -4 1 1 1 5 1 total 0.000031 7.654909e-06 -5 1 1 1 6 1 total 0.000013 3.206343e-06 -12 1 2 1 1 1 total 0.000004 6.723192e-07 -13 1 2 1 2 1 total 0.000022 3.706235e-06 -14 1 2 1 3 1 total 0.000022 3.674263e-06 -15 1 2 1 4 1 total 0.000052 8.774048e-06 -16 1 2 1 5 1 total 0.000024 4.168024e-06 -17 1 2 1 6 1 total 0.000010 1.726268e-06 -6 2 1 1 1 1 total 0.000004 1.003100e-06 -7 2 1 1 2 1 total 0.000022 5.425275e-06 -8 2 1 1 3 1 total 0.000021 5.324236e-06 -9 2 1 1 4 1 total 0.000050 1.251572e-05 -10 2 1 1 5 1 total 0.000022 5.762184e-06 -11 2 1 1 6 1 total 0.000009 2.391676e-06 -18 2 2 1 1 1 total 0.000005 5.962367e-07 -19 2 2 1 2 1 total 0.000025 3.200900e-06 -20 2 2 1 3 1 total 0.000025 3.127442e-06 -21 2 2 1 4 1 total 0.000058 7.296157e-06 -22 2 2 1 5 1 total 0.000026 3.298196e-06 -23 2 2 1 6 1 total 0.000011 1.370918e-06 +0 1 1 1 1 1 total 0.000007 4.734745e-07 +1 1 1 1 2 1 total 0.000036 2.443930e-06 +2 1 1 1 3 1 total 0.000035 2.333188e-06 +3 1 1 1 4 1 total 0.000078 5.231199e-06 +4 1 1 1 5 1 total 0.000032 2.144718e-06 +5 1 1 1 6 1 total 0.000013 8.984148e-07 +12 1 2 1 1 1 total 0.000007 2.770884e-07 +13 1 2 1 2 1 total 0.000036 1.430245e-06 +14 1 2 1 3 1 total 0.000035 1.365436e-06 +15 1 2 1 4 1 total 0.000078 3.061421e-06 +16 1 2 1 5 1 total 0.000032 1.255139e-06 +17 1 2 1 6 1 total 0.000013 5.257735e-07 +6 2 1 1 1 1 total 0.000007 3.731284e-07 +7 2 1 1 2 1 total 0.000037 1.925974e-06 +8 2 1 1 3 1 total 0.000035 1.838702e-06 +9 2 1 1 4 1 total 0.000079 4.122522e-06 +10 2 1 1 5 1 total 0.000032 1.690176e-06 +11 2 1 1 6 1 total 0.000014 7.080087e-07 +18 2 2 1 1 1 total 0.000007 2.050310e-07 +19 2 2 1 2 1 total 0.000035 1.058307e-06 +20 2 2 1 3 1 total 0.000033 1.010352e-06 +21 2 2 1 4 1 total 0.000075 2.265292e-06 +22 2 2 1 5 1 total 0.000031 9.287379e-07 +23 2 2 1 6 1 total 0.000013 3.890451e-07 mesh 1 delayedgroup group out nuclide mean std. dev. x y z 0 1 1 1 1 1 total 0.0 0.000000 -1 1 1 1 2 1 total 0.0 0.000000 -2 1 1 1 3 1 total 0.0 0.000000 -3 1 1 1 4 1 total 0.0 0.000000 -4 1 1 1 5 1 total 0.0 0.000000 +1 1 1 1 2 1 total 1.0 1.414214 +2 1 1 1 3 1 total 1.0 0.868831 +3 1 1 1 4 1 total 1.0 1.414214 +4 1 1 1 5 1 total 1.0 1.414214 5 1 1 1 6 1 total 0.0 0.000000 12 1 2 1 1 1 total 0.0 0.000000 -13 1 2 1 2 1 total 0.0 0.000000 +13 1 2 1 2 1 total 1.0 0.866827 14 1 2 1 3 1 total 0.0 0.000000 -15 1 2 1 4 1 total 0.0 0.000000 -16 1 2 1 5 1 total 0.0 0.000000 +15 1 2 1 4 1 total 1.0 0.455171 +16 1 2 1 5 1 total 1.0 0.868553 17 1 2 1 6 1 total 0.0 0.000000 6 2 1 1 1 1 total 0.0 0.000000 -7 2 1 1 2 1 total 0.0 0.000000 -8 2 1 1 3 1 total 0.0 0.000000 -9 2 1 1 4 1 total 0.0 0.000000 -10 2 1 1 5 1 total 0.0 0.000000 -11 2 1 1 6 1 total 0.0 0.000000 -18 2 2 1 1 1 total 0.0 0.000000 -19 2 2 1 2 1 total 0.0 0.000000 +7 2 1 1 2 1 total 1.0 1.414214 +8 2 1 1 3 1 total 1.0 1.414214 +9 2 1 1 4 1 total 1.0 0.674843 +10 2 1 1 5 1 total 1.0 1.414214 +11 2 1 1 6 1 total 1.0 0.866033 +18 2 2 1 1 1 total 1.0 1.414214 +19 2 2 1 2 1 total 1.0 1.414214 20 2 2 1 3 1 total 1.0 1.414214 -21 2 2 1 4 1 total 0.0 0.000000 +21 2 2 1 4 1 total 1.0 0.579059 22 2 2 1 5 1 total 0.0 0.000000 -23 2 2 1 6 1 total 0.0 0.000000 +23 2 2 1 6 1 total 1.0 1.414214 mesh 1 delayedgroup group in nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.000228 0.000084 -1 1 1 1 2 1 total 0.001195 0.000438 -2 1 1 1 3 1 total 0.001153 0.000420 -3 1 1 1 4 1 total 0.002629 0.000950 -4 1 1 1 5 1 total 0.001125 0.000398 -5 1 1 1 6 1 total 0.000470 0.000166 -12 1 2 1 1 1 total 0.000225 0.000044 -13 1 2 1 2 1 total 0.001232 0.000242 -14 1 2 1 3 1 total 0.001216 0.000239 -15 1 2 1 4 1 total 0.002882 0.000570 -16 1 2 1 5 1 total 0.001345 0.000270 -17 1 2 1 6 1 total 0.000558 0.000112 -6 2 1 1 1 1 total 0.000228 0.000057 -7 2 1 1 2 1 total 0.001222 0.000309 -8 2 1 1 3 1 total 0.001193 0.000304 -9 2 1 1 4 1 total 0.002780 0.000713 -10 2 1 1 5 1 total 0.001250 0.000328 -11 2 1 1 6 1 total 0.000520 0.000136 -18 2 2 1 1 1 total 0.000227 0.000027 -19 2 2 1 2 1 total 0.001225 0.000143 -20 2 2 1 3 1 total 0.001201 0.000140 -21 2 2 1 4 1 total 0.002815 0.000326 -22 2 2 1 5 1 total 0.001284 0.000147 -23 2 2 1 6 1 total 0.000533 0.000061 +0 1 1 1 1 1 total 0.000221 0.000019 +1 1 1 1 2 1 total 0.001139 0.000096 +2 1 1 1 3 1 total 0.001087 0.000092 +3 1 1 1 4 1 total 0.002437 0.000206 +4 1 1 1 5 1 total 0.000999 0.000084 +5 1 1 1 6 1 total 0.000419 0.000035 +12 1 2 1 1 1 total 0.000222 0.000012 +13 1 2 1 2 1 total 0.001144 0.000060 +14 1 2 1 3 1 total 0.001092 0.000057 +15 1 2 1 4 1 total 0.002448 0.000129 +16 1 2 1 5 1 total 0.001004 0.000053 +17 1 2 1 6 1 total 0.000420 0.000022 +6 2 1 1 1 1 total 0.000221 0.000015 +7 2 1 1 2 1 total 0.001143 0.000078 +8 2 1 1 3 1 total 0.001091 0.000075 +9 2 1 1 4 1 total 0.002446 0.000167 +10 2 1 1 5 1 total 0.001003 0.000069 +11 2 1 1 6 1 total 0.000420 0.000029 +18 2 2 1 1 1 total 0.000220 0.000009 +19 2 2 1 2 1 total 0.001136 0.000047 +20 2 2 1 3 1 total 0.001084 0.000045 +21 2 2 1 4 1 total 0.002431 0.000100 +22 2 2 1 5 1 total 0.000997 0.000041 +23 2 2 1 6 1 total 0.000417 0.000017 mesh 1 delayedgroup group in nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.013345 0.004923 -1 1 1 1 2 1 total 0.032674 0.011850 -2 1 1 1 3 1 total 0.120923 0.043307 -3 1 1 1 4 1 total 0.304289 0.106753 -4 1 1 1 5 1 total 0.855760 0.286466 -5 1 1 1 6 1 total 2.874120 0.965609 -12 1 2 1 1 1 total 0.013367 0.002548 -13 1 2 1 2 1 total 0.032520 0.006266 -14 1 2 1 3 1 total 0.121250 0.023544 -15 1 2 1 4 1 total 0.307552 0.060464 -16 1 2 1 5 1 total 0.867665 0.175131 -17 1 2 1 6 1 total 2.914635 0.587161 -6 2 1 1 1 1 total 0.013357 0.003345 -7 2 1 1 2 1 total 0.032590 0.008273 -8 2 1 1 3 1 total 0.121103 0.031074 -9 2 1 1 4 1 total 0.306111 0.080011 -10 2 1 1 5 1 total 0.862660 0.235694 -11 2 1 1 6 1 total 2.897534 0.788926 -18 2 2 1 1 1 total 0.013360 0.001587 -19 2 2 1 2 1 total 0.032564 0.003810 -20 2 2 1 3 1 total 0.121158 0.014038 -21 2 2 1 4 1 total 0.306653 0.035052 -22 2 2 1 5 1 total 0.864587 0.096680 -23 2 2 1 6 1 total 2.904111 0.325170 - mesh 1 delayedgroup group in group out nuclide mean std. dev. - x y z -0 1 1 1 1 1 1 total 0.00000 0.000000 -1 1 1 1 2 1 1 total 0.00000 0.000000 -2 1 1 1 3 1 1 total 0.00000 0.000000 -3 1 1 1 4 1 1 total 0.00000 0.000000 -4 1 1 1 5 1 1 total 0.00000 0.000000 -5 1 1 1 6 1 1 total 0.00000 0.000000 -12 1 2 1 1 1 1 total 0.00000 0.000000 -13 1 2 1 2 1 1 total 0.00000 0.000000 -14 1 2 1 3 1 1 total 0.00000 0.000000 -15 1 2 1 4 1 1 total 0.00000 0.000000 -16 1 2 1 5 1 1 total 0.00000 0.000000 -17 1 2 1 6 1 1 total 0.00000 0.000000 -6 2 1 1 1 1 1 total 0.00000 0.000000 -7 2 1 1 2 1 1 total 0.00000 0.000000 -8 2 1 1 3 1 1 total 0.00000 0.000000 -9 2 1 1 4 1 1 total 0.00000 0.000000 -10 2 1 1 5 1 1 total 0.00000 0.000000 -11 2 1 1 6 1 1 total 0.00000 0.000000 -18 2 2 1 1 1 1 total 0.00000 0.000000 -19 2 2 1 2 1 1 total 0.00000 0.000000 -20 2 2 1 3 1 1 total 0.00015 0.000151 -21 2 2 1 4 1 1 total 0.00000 0.000000 -22 2 2 1 5 1 1 total 0.00000 0.000000 -23 2 2 1 6 1 1 total 0.00000 0.000000 +0 1 1 1 1 1 total 0.013336 0.001120 +1 1 1 1 2 1 total 0.032739 0.002751 +2 1 1 1 3 1 total 0.120780 0.010147 +3 1 1 1 4 1 total 0.302780 0.025438 +4 1 1 1 5 1 total 0.849490 0.071370 +5 1 1 1 6 1 total 2.853000 0.239696 +12 1 2 1 1 1 total 0.013336 0.000695 +13 1 2 1 2 1 total 0.032739 0.001707 +14 1 2 1 3 1 total 0.120780 0.006296 +15 1 2 1 4 1 total 0.302780 0.015784 +16 1 2 1 5 1 total 0.849490 0.044285 +17 1 2 1 6 1 total 2.853000 0.148730 +6 2 1 1 1 1 total 0.013336 0.000906 +7 2 1 1 2 1 total 0.032739 0.002224 +8 2 1 1 3 1 total 0.120780 0.008205 +9 2 1 1 4 1 total 0.302780 0.020570 +10 2 1 1 5 1 total 0.849490 0.057711 +11 2 1 1 6 1 total 2.853000 0.193821 +18 2 2 1 1 1 total 0.013336 0.000528 +19 2 2 1 2 1 total 0.032739 0.001296 +20 2 2 1 3 1 total 0.120780 0.004781 +21 2 2 1 4 1 total 0.302780 0.011986 +22 2 2 1 5 1 total 0.849490 0.033628 +23 2 2 1 6 1 total 2.853000 0.112940 + mesh 1 delayedgroup group in group out nuclide mean std. dev. + x y z +0 1 1 1 1 1 1 total 0.000000 0.000000 +1 1 1 1 2 1 1 total 0.000055 0.000055 +2 1 1 1 3 1 1 total 0.000055 0.000034 +3 1 1 1 4 1 1 total 0.000052 0.000052 +4 1 1 1 5 1 1 total 0.000029 0.000029 +5 1 1 1 6 1 1 total 0.000000 0.000000 +12 1 2 1 1 1 1 total 0.000000 0.000000 +13 1 2 1 2 1 1 total 0.000058 0.000036 +14 1 2 1 3 1 1 total 0.000000 0.000000 +15 1 2 1 4 1 1 total 0.000149 0.000048 +16 1 2 1 5 1 1 total 0.000057 0.000035 +17 1 2 1 6 1 1 total 0.000000 0.000000 +6 2 1 1 1 1 1 total 0.000000 0.000000 +7 2 1 1 2 1 1 total 0.000027 0.000027 +8 2 1 1 3 1 1 total 0.000026 0.000026 +9 2 1 1 4 1 1 total 0.000105 0.000051 +10 2 1 1 5 1 1 total 0.000054 0.000054 +11 2 1 1 6 1 1 total 0.000051 0.000031 +18 2 2 1 1 1 1 total 0.000028 0.000028 +19 2 2 1 2 1 1 total 0.000025 0.000025 +20 2 2 1 3 1 1 total 0.000032 0.000032 +21 2 2 1 4 1 1 total 0.000080 0.000033 +22 2 2 1 5 1 1 total 0.000000 0.000000 +23 2 2 1 6 1 1 total 0.000027 0.000027 diff --git a/tests/regression_tests/mgxs_library_mesh/test.py b/tests/regression_tests/mgxs_library_mesh/test.py index b72fdf2f1..3660d3eb7 100644 --- a/tests/regression_tests/mgxs_library_mesh/test.py +++ b/tests/regression_tests/mgxs_library_mesh/test.py @@ -2,42 +2,67 @@ import hashlib import openmc import openmc.mgxs +import pytest from tests.testing_harness import PyAPITestHarness +@pytest.fixture +def model(): + model = openmc.model.Model() + + fuel = openmc.Material() + fuel.set_density('g/cm3', 10.0) + fuel.add_nuclide('U235', 1.0) + zr = openmc.Material() + zr.set_density('g/cm3', 1.0) + zr.add_nuclide('Zr90', 1.0) + model.materials.extend([fuel, zr]) + + box1 = openmc.model.rectangular_prism(10.0, 10.0) + box2 = openmc.model.rectangular_prism(20.0, 20.0, boundary_type='reflective') + top = openmc.ZPlane(z0=10.0, boundary_type='vacuum') + bottom = openmc.ZPlane(z0=-10.0, boundary_type='vacuum') + cell1 = openmc.Cell(fill=fuel, region=box1 & +bottom & -top) + cell2 = openmc.Cell(fill=zr, region=~box1 & box2 & +bottom & -top) + model.geometry = openmc.Geometry([cell1, cell2]) + + model.settings.batches = 5 + model.settings.inactive = 0 + model.settings.particles = 1000 + + # Initialize a one-group structure + energy_groups = openmc.mgxs.EnergyGroups([0, 20.e6]) + + # Initialize MGXS Library for a few cross section types + # for one material-filled cell in the geometry + model.mgxs_lib = openmc.mgxs.Library(model.geometry) + model.mgxs_lib.by_nuclide = False + + # Test all MGXS types + model.mgxs_lib.mgxs_types = openmc.mgxs.MGXS_TYPES + openmc.mgxs.MDGXS_TYPES + model.mgxs_lib.energy_groups = energy_groups + model.mgxs_lib.num_delayed_groups = 6 + model.mgxs_lib.correction = None # Avoid warning about P0 correction + model.mgxs_lib.legendre_order = 3 + model.mgxs_lib.domain_type = 'mesh' + + # Instantiate a tally mesh + mesh = openmc.RegularMesh(mesh_id=1) + mesh.dimension = [2, 2] + mesh.lower_left = [-100., -100.] + mesh.width = [100., 100.] + + model.mgxs_lib.domains = [mesh] + model.mgxs_lib.build_library() + + # Add tallies + model.mgxs_lib.add_to_tallies_file(model.tallies, merge=False) + + return model + + class MGXSTestHarness(PyAPITestHarness): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - # Initialize a one-group structure - energy_groups = openmc.mgxs.EnergyGroups(group_edges=[0, 20.e6]) - - # Initialize MGXS Library for a few cross section types - # for one material-filled cell in the geometry - self.mgxs_lib = openmc.mgxs.Library(self._model.geometry) - self.mgxs_lib.by_nuclide = False - - # Test all MGXS types - self.mgxs_lib.mgxs_types = openmc.mgxs.MGXS_TYPES + \ - openmc.mgxs.MDGXS_TYPES - self.mgxs_lib.energy_groups = energy_groups - self.mgxs_lib.num_delayed_groups = 6 - self.mgxs_lib.legendre_order = 3 - self.mgxs_lib.domain_type = 'mesh' - - # Instantiate a tally mesh - mesh = openmc.RegularMesh(mesh_id=1) - mesh.dimension = [2, 2] - mesh.lower_left = [-100., -100.] - mesh.width = [100., 100.] - - self.mgxs_lib.domains = [mesh] - self.mgxs_lib.build_library() - - # Add tallies - self.mgxs_lib.add_to_tallies_file(self._model.tallies, merge=False) - def _get_results(self, hash_output=False): """Digest info in the statepoint and return as a string.""" @@ -45,13 +70,14 @@ class MGXSTestHarness(PyAPITestHarness): sp = openmc.StatePoint(self._sp_name) # Load the MGXS library from the statepoint - self.mgxs_lib.load_from_statepoint(sp) + mgxs_lib = self._model.mgxs_lib + mgxs_lib.load_from_statepoint(sp) # Build a string from Pandas Dataframe for each 1-group MGXS outstr = '' - for domain in self.mgxs_lib.domains: - for mgxs_type in self.mgxs_lib.mgxs_types: - mgxs = self.mgxs_lib.get_mgxs(domain, mgxs_type) + for domain in mgxs_lib.domains: + for mgxs_type in mgxs_lib.mgxs_types: + mgxs = mgxs_lib.get_mgxs(domain, mgxs_type) df = mgxs.get_pandas_dataframe() outstr += df.to_string() + '\n' @@ -64,6 +90,6 @@ class MGXSTestHarness(PyAPITestHarness): return outstr -def test_mgxs_library_mesh(): - harness = MGXSTestHarness('statepoint.10.h5') +def test_mgxs_library_mesh(model): + harness = MGXSTestHarness('statepoint.5.h5', model) harness.main() From 92433b255c397db3cd8da41222fd9f022f896b22 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 19 Aug 2019 09:56:21 -0500 Subject: [PATCH 10/16] Update filter_mesh test --- .../filter_mesh/inputs_true.dat | 334 ++---------------- .../filter_mesh/results_true.dat | 2 +- tests/regression_tests/filter_mesh/test.py | 151 ++++---- 3 files changed, 117 insertions(+), 370 deletions(-) diff --git a/tests/regression_tests/filter_mesh/inputs_true.dat b/tests/regression_tests/filter_mesh/inputs_true.dat index 6755a64c8..919347d69 100644 --- a/tests/regression_tests/filter_mesh/inputs_true.dat +++ b/tests/regression_tests/filter_mesh/inputs_true.dat @@ -1,332 +1,56 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1.26 1.26 - 17 17 - -10.71 -10.71 - -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 -1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 -1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -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7 7 -7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 -7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 -7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 -7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 -7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 -7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 -7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 -7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 -7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 -7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 -7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + eigenvalue - 100 - 10 - 5 - - - -160 -160 -183 160 160 183 - - + 1000 + 5 + 0 17 - -182.07 - 182.07 + -10.0 + 10.0 17 17 - -182.07 -182.07 - 182.07 182.07 + -10.0 -10.0 + 10.0 10.0 17 17 17 - -182.07 -182.07 -183.0 - 182.07 182.07 183.0 + -10.0 -10.0 -183.0 + 10.0 10.0 183.0 - -182.07 -160.65 -139.23 -117.81 -96.39 -74.97 -53.55000000000001 -32.129999999999995 -10.710000000000008 10.70999999999998 32.129999999999995 53.54999999999998 74.96999999999997 96.38999999999999 117.81 139.22999999999996 160.64999999999998 182.07 - -182.07 -160.65 -139.23 -117.81 -96.39 -74.97 -53.55000000000001 -32.129999999999995 -10.710000000000008 10.70999999999998 32.129999999999995 53.54999999999998 74.96999999999997 96.38999999999999 117.81 139.22999999999996 160.64999999999998 182.07 + -10.0 -8.823529411764707 -7.647058823529411 -6.470588235294118 -5.294117647058823 -4.117647058823529 -2.9411764705882355 -1.7647058823529402 -0.5882352941176467 0.5882352941176467 1.764705882352942 2.9411764705882355 4.117647058823529 5.294117647058824 6.4705882352941195 7.647058823529413 8.823529411764707 10.0 + -10.0 -8.823529411764707 -7.647058823529411 -6.470588235294118 -5.294117647058823 -4.117647058823529 -2.9411764705882355 -1.7647058823529402 -0.5882352941176467 0.5882352941176467 1.764705882352942 2.9411764705882355 4.117647058823529 5.294117647058824 6.4705882352941195 7.647058823529413 8.823529411764707 10.0 1.0 1.683624003879018 2.8345897864376153 4.772383405596668 8.034899257376447 13.52774925846868 22.77564337001445 38.34561988154435 64.55960607618856 108.69410247084474 182.99999999999991 diff --git a/tests/regression_tests/filter_mesh/results_true.dat b/tests/regression_tests/filter_mesh/results_true.dat index 05efffe2f..55653d1a5 100644 --- a/tests/regression_tests/filter_mesh/results_true.dat +++ b/tests/regression_tests/filter_mesh/results_true.dat @@ -1 +1 @@ -35f04a6f062ef64116ef4eb0e9b803cd44cff7e185e2b53c9174afad8a26ca1a436ca9b800d6a228e006a9129f4536d7dce289d7a11cd56c6949d71d6a201b31 \ No newline at end of file +2bc8fce4a61bc431e90c44400ac626e7043144b575eeb5ca66b8c4fefb9bed076b20663d096801dca63085f090a96e662f12b6281c85c3ba8ce73efbc55356ba \ No newline at end of file diff --git a/tests/regression_tests/filter_mesh/test.py b/tests/regression_tests/filter_mesh/test.py index ed2e9b35b..e68c5f0e1 100644 --- a/tests/regression_tests/filter_mesh/test.py +++ b/tests/regression_tests/filter_mesh/test.py @@ -1,87 +1,110 @@ import numpy as np import openmc +import pytest from tests.testing_harness import HashedPyAPITestHarness -class FilterMeshTestHarness(HashedPyAPITestHarness): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) +@pytest.fixture +def model(): + model = openmc.model.Model() - # Initialize Meshes - mesh_1d = openmc.RegularMesh(mesh_id=1) - mesh_1d.dimension = [17] - mesh_1d.lower_left = [-182.07] - mesh_1d.upper_right = [182.07] + fuel = openmc.Material() + fuel.set_density('g/cm3', 10.0) + fuel.add_nuclide('U235', 1.0) + zr = openmc.Material() + zr.set_density('g/cm3', 1.0) + zr.add_nuclide('Zr90', 1.0) + model.materials.extend([fuel, zr]) - mesh_2d = openmc.RegularMesh(mesh_id=2) - mesh_2d.dimension = [17, 17] - mesh_2d.lower_left = [-182.07, -182.07] - mesh_2d.upper_right = [182.07, 182.07] + box1 = openmc.model.rectangular_prism(10.0, 10.0) + box2 = openmc.model.rectangular_prism(20.0, 20.0, boundary_type='reflective') + top = openmc.ZPlane(z0=10.0, boundary_type='vacuum') + bottom = openmc.ZPlane(z0=-10.0, boundary_type='vacuum') + cell1 = openmc.Cell(fill=fuel, region=box1 & +bottom & -top) + cell2 = openmc.Cell(fill=zr, region=~box1 & box2 & +bottom & -top) + model.geometry = openmc.Geometry([cell1, cell2]) - mesh_3d = openmc.RegularMesh(mesh_id=3) - mesh_3d.dimension = [17, 17, 17] - mesh_3d.lower_left = [-182.07, -182.07, -183.00] - mesh_3d.upper_right = [182.07, 182.07, 183.00] + model.settings.batches = 5 + model.settings.inactive = 0 + model.settings.particles = 1000 - recti_mesh = openmc.RectilinearMesh(mesh_id=4) - recti_mesh.x_grid = np.linspace(-182.07, 182.07, 18) - recti_mesh.y_grid = np.linspace(-182.07, 182.07, 18) - recti_mesh.z_grid = np.logspace(0, np.log10(183), 11) + # Initialize Meshes + mesh_1d = openmc.RegularMesh() + mesh_1d.dimension = [17] + mesh_1d.lower_left = [-10.0] + mesh_1d.upper_right = [10.0] - # Initialize the filters - mesh_1d_filter = openmc.MeshFilter(mesh_1d) - mesh_2d_filter = openmc.MeshFilter(mesh_2d) - mesh_3d_filter = openmc.MeshFilter(mesh_3d) - recti_mesh_filter = openmc.MeshFilter(recti_mesh) - meshsurf_1d_filter = openmc.MeshSurfaceFilter(mesh_1d) - meshsurf_2d_filter = openmc.MeshSurfaceFilter(mesh_2d) - meshsurf_3d_filter = openmc.MeshSurfaceFilter(mesh_3d) - recti_meshsurf_filter = openmc.MeshSurfaceFilter(recti_mesh) + mesh_2d = openmc.RegularMesh() + mesh_2d.dimension = [17, 17] + mesh_2d.lower_left = [-10.0, -10.0] + mesh_2d.upper_right = [10.0, 10.0] - # Initialized the tallies - tally = openmc.Tally(name='tally 1') - tally.filters = [mesh_1d_filter] - tally.scores = ['total'] - self._model.tallies.append(tally) + mesh_3d = openmc.RegularMesh() + mesh_3d.dimension = [17, 17, 17] + mesh_3d.lower_left = [-10.0, -10.0, -183.00] + mesh_3d.upper_right = [10.0, 10.0, 183.00] - tally = openmc.Tally(name='tally 2') - tally.filters = [meshsurf_1d_filter] - tally.scores = ['current'] - self._model.tallies.append(tally) + recti_mesh = openmc.RectilinearMesh() + recti_mesh.x_grid = np.linspace(-10.0, 10.0, 18) + recti_mesh.y_grid = np.linspace(-10.0, 10.0, 18) + recti_mesh.z_grid = np.logspace(0, np.log10(183), 11) - tally = openmc.Tally(name='tally 3') - tally.filters = [mesh_2d_filter] - tally.scores = ['total'] - self._model.tallies.append(tally) + # Initialize the filters + mesh_1d_filter = openmc.MeshFilter(mesh_1d) + mesh_2d_filter = openmc.MeshFilter(mesh_2d) + mesh_3d_filter = openmc.MeshFilter(mesh_3d) + recti_mesh_filter = openmc.MeshFilter(recti_mesh) + meshsurf_1d_filter = openmc.MeshSurfaceFilter(mesh_1d) + meshsurf_2d_filter = openmc.MeshSurfaceFilter(mesh_2d) + meshsurf_3d_filter = openmc.MeshSurfaceFilter(mesh_3d) + recti_meshsurf_filter = openmc.MeshSurfaceFilter(recti_mesh) - tally = openmc.Tally(name='tally 4') - tally.filters = [meshsurf_2d_filter] - tally.scores = ['current'] - self._model.tallies.append(tally) + # Initialized the tallies + tally = openmc.Tally(name='tally 1') + tally.filters = [mesh_1d_filter] + tally.scores = ['total'] + model.tallies.append(tally) - tally = openmc.Tally(name='tally 5') - tally.filters = [mesh_3d_filter] - tally.scores = ['total'] - self._model.tallies.append(tally) + tally = openmc.Tally(name='tally 2') + tally.filters = [meshsurf_1d_filter] + tally.scores = ['current'] + model.tallies.append(tally) - tally = openmc.Tally(name='tally 6') - tally.filters = [meshsurf_3d_filter] - tally.scores = ['current'] - self._model.tallies.append(tally) + tally = openmc.Tally(name='tally 3') + tally.filters = [mesh_2d_filter] + tally.scores = ['total'] + model.tallies.append(tally) - tally = openmc.Tally(name='tally 7') - tally.filters = [recti_mesh_filter] - tally.scores = ['total'] - self._model.tallies.append(tally) + tally = openmc.Tally(name='tally 4') + tally.filters = [meshsurf_2d_filter] + tally.scores = ['current'] + model.tallies.append(tally) - tally = openmc.Tally(name='tally 8') - tally.filters = [recti_meshsurf_filter] - tally.scores = ['current'] - self._model.tallies.append(tally) + tally = openmc.Tally(name='tally 5') + tally.filters = [mesh_3d_filter] + tally.scores = ['total'] + model.tallies.append(tally) + + tally = openmc.Tally(name='tally 6') + tally.filters = [meshsurf_3d_filter] + tally.scores = ['current'] + model.tallies.append(tally) + + tally = openmc.Tally(name='tally 7') + tally.filters = [recti_mesh_filter] + tally.scores = ['total'] + model.tallies.append(tally) + + tally = openmc.Tally(name='tally 8') + tally.filters = [recti_meshsurf_filter] + tally.scores = ['current'] + model.tallies.append(tally) + + return model -def test_filter_mesh(): - harness = FilterMeshTestHarness('statepoint.10.h5') +def test_filter_mesh(model): + harness = HashedPyAPITestHarness('statepoint.5.h5', model) harness.main() From 36bfa08eae44423a10c60ca213d8e0e7b640b024 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 19 Aug 2019 10:03:19 -0500 Subject: [PATCH 11/16] Update filter_energyfun test --- .../filter_energyfun/inputs_true.dat | 307 +----------------- .../filter_energyfun/results_true.dat | 2 +- .../regression_tests/filter_energyfun/test.py | 73 +++-- 3 files changed, 53 insertions(+), 329 deletions(-) diff --git a/tests/regression_tests/filter_energyfun/inputs_true.dat b/tests/regression_tests/filter_energyfun/inputs_true.dat index 418354fc2..0f506f3f5 100644 --- a/tests/regression_tests/filter_energyfun/inputs_true.dat +++ b/tests/regression_tests/filter_energyfun/inputs_true.dat @@ -1,312 +1,21 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1.26 1.26 - 17 17 - -10.71 -10.71 - -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 -1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 -1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - - - 1.26 1.26 - 17 17 - -10.71 -10.71 - -3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 -3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 -3 3 3 3 3 4 3 3 4 3 3 4 3 3 3 3 3 -3 3 3 4 3 3 3 3 3 3 3 3 3 4 3 3 3 -3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 -3 3 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3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8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 -7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 -7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 -7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 -7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + eigenvalue - 100 - 10 - 5 - - - -160 -160 -183 160 160 183 - - + 1000 + 5 + 0 diff --git a/tests/regression_tests/filter_energyfun/results_true.dat b/tests/regression_tests/filter_energyfun/results_true.dat index 8e5577c43..a88cff496 100644 --- a/tests/regression_tests/filter_energyfun/results_true.dat +++ b/tests/regression_tests/filter_energyfun/results_true.dat @@ -1,2 +1,2 @@ energyfunction nuclide score mean std. dev. -0 d2effa26cb3cf2 Am241 ((n,gamma) / (n,gamma)) 1.00e-01 9.97e-03 +0 d2effa26cb3cf2 Am241 ((n,gamma) / (n,gamma)) 1.74e-01 3.55e-03 diff --git a/tests/regression_tests/filter_energyfun/test.py b/tests/regression_tests/filter_energyfun/test.py index 7c5645b65..f61f05d78 100644 --- a/tests/regression_tests/filter_energyfun/test.py +++ b/tests/regression_tests/filter_energyfun/test.py @@ -1,36 +1,51 @@ import openmc +import pytest from tests.testing_harness import PyAPITestHarness +@pytest.fixture +def model(): + model = openmc.model.Model() + + m = openmc.Material() + m.set_density('g/cm3', 10.0) + m.add_nuclide('Am241', 1.0) + model.materials.append(m) + + s = openmc.Sphere(r=100.0, boundary_type='vacuum') + c = openmc.Cell(fill=m, region=-s) + model.geometry = openmc.Geometry([c]) + + model.settings.batches = 5 + model.settings.inactive = 0 + model.settings.particles = 1000 + + # Define Am242m / Am242 branching ratio from ENDF/B-VII.1 data. + x = [1e-5, 3.69e-1, 1e3, 1e5, 6e5, 1e6, 2e6, 4e6, 3e7] + y = [0.1, 0.1, 0.1333, 0.158, 0.18467, 0.25618, 0.4297, 0.48, 0.48] + + # Make an EnergyFunctionFilter directly from the x and y lists. + filt1 = openmc.EnergyFunctionFilter(x, y) + + # Also make a filter with the .from_tabulated1d constructor. Make sure + # the filters are identical. + tab1d = openmc.data.Tabulated1D(x, y) + filt2 = openmc.EnergyFunctionFilter.from_tabulated1d(tab1d) + assert filt1 == filt2, 'Error with the .from_tabulated1d constructor' + + # Make tallies + tallies = [openmc.Tally(), openmc.Tally()] + for t in tallies: + t.scores = ['(n,gamma)'] + t.nuclides = ['Am241'] + tallies[1].filters = [filt1] + model.tallies.extend(tallies) + + return model + + class FilterEnergyFunHarness(PyAPITestHarness): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - # Add Am241 to the fuel. - self._model.materials[1].add_nuclide('Am241', 1e-7) - - # Define Am242m / Am242 branching ratio from ENDF/B-VII.1 data. - x = [1e-5, 3.69e-1, 1e3, 1e5, 6e5, 1e6, 2e6, 4e6, 3e7] - y = [0.1, 0.1, 0.1333, 0.158, 0.18467, 0.25618, 0.4297, 0.48, 0.48] - - # Make an EnergyFunctionFilter directly from the x and y lists. - filt1 = openmc.EnergyFunctionFilter(x, y) - - # Also make a filter with the .from_tabulated1d constructor. Make sure - # the filters are identical. - tab1d = openmc.data.Tabulated1D(x, y) - filt2 = openmc.EnergyFunctionFilter.from_tabulated1d(tab1d) - assert filt1 == filt2, 'Error with the .from_tabulated1d constructor' - - # Make tallies. - tallies = [openmc.Tally(1), openmc.Tally(2)] - for t in tallies: - t.scores = ['(n,gamma)'] - t.nuclides = ['Am241'] - tallies[1].filters = [filt1] - self._model.tallies = tallies - def _get_results(self): # Read the statepoint file. sp = openmc.StatePoint(self._sp_name) @@ -42,6 +57,6 @@ class FilterEnergyFunHarness(PyAPITestHarness): return br_tally.get_pandas_dataframe().to_string() + '\n' -def test_filter_energyfun(): - harness = FilterEnergyFunHarness('statepoint.10.h5') +def test_filter_energyfun(model): + harness = FilterEnergyFunHarness('statepoint.5.h5', model) harness.main() From da18820a88a69d864948074d5dca53bbb566f280 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 19 Aug 2019 14:35:48 -0500 Subject: [PATCH 12/16] Add a nuclide with Maxwell fission spectrum to energy_laws test --- .../regression_tests/energy_laws/geometry.xml | 5 --- .../energy_laws/inputs_true.dat | 23 ++++++++++ .../energy_laws/materials.xml | 10 ----- .../energy_laws/results_true.dat | 2 +- .../regression_tests/energy_laws/settings.xml | 10 ----- tests/regression_tests/energy_laws/test.py | 42 +++++++++++++++---- 6 files changed, 59 insertions(+), 33 deletions(-) delete mode 100644 tests/regression_tests/energy_laws/geometry.xml create mode 100644 tests/regression_tests/energy_laws/inputs_true.dat delete mode 100644 tests/regression_tests/energy_laws/materials.xml delete mode 100644 tests/regression_tests/energy_laws/settings.xml diff --git a/tests/regression_tests/energy_laws/geometry.xml b/tests/regression_tests/energy_laws/geometry.xml deleted file mode 100644 index c42f45597..000000000 --- a/tests/regression_tests/energy_laws/geometry.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/tests/regression_tests/energy_laws/inputs_true.dat b/tests/regression_tests/energy_laws/inputs_true.dat new file mode 100644 index 000000000..2320b21d5 --- /dev/null +++ b/tests/regression_tests/energy_laws/inputs_true.dat @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 10 + 5 + diff --git a/tests/regression_tests/energy_laws/materials.xml b/tests/regression_tests/energy_laws/materials.xml deleted file mode 100644 index e63f4018c..000000000 --- a/tests/regression_tests/energy_laws/materials.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tests/regression_tests/energy_laws/results_true.dat b/tests/regression_tests/energy_laws/results_true.dat index 02465fa79..ce93d6c82 100644 --- a/tests/regression_tests/energy_laws/results_true.dat +++ b/tests/regression_tests/energy_laws/results_true.dat @@ -1,2 +1,2 @@ k-combined: -2.122164E+00 1.946222E-02 +2.466441E+00 1.500183E-02 diff --git a/tests/regression_tests/energy_laws/settings.xml b/tests/regression_tests/energy_laws/settings.xml deleted file mode 100644 index 946345eeb..000000000 --- a/tests/regression_tests/energy_laws/settings.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - eigenvalue - 10 - 5 - 1000 - - - - diff --git a/tests/regression_tests/energy_laws/test.py b/tests/regression_tests/energy_laws/test.py index 8f9bbde35..1746b2d31 100644 --- a/tests/regression_tests/energy_laws/test.py +++ b/tests/regression_tests/energy_laws/test.py @@ -2,23 +2,51 @@ are not covered in other tests. It has a single material with the following nuclides: -U-233: Only nuclide that has a Watt fission spectrum +U233: Only nuclide that has a Watt fission spectrum -H-2: Only nuclide that has an N-body phase space distribution, in this case for +Am244: One of a few nuclides that has a Maxwell fission spectrum + +H2: Only nuclide that has an N-body phase space distribution, in this case for (n,2n) -Na-23: Has an evaporation spectrum and also has reactions that have multiple +Na23: Has an evaporation spectrum and also has reactions that have multiple angle-energy distributions, so it provides coverage for both of those situations. -Ta-181: One of a few nuclides that has reactions with Kalbach-Mann distributions +Ta181: One of a few nuclides that has reactions with Kalbach-Mann distributions that use linear-linear interpolation. """ -from tests.testing_harness import TestHarness +import openmc +import pytest + +from tests.testing_harness import PyAPITestHarness -def test_energy_laws(): - harness = TestHarness('statepoint.10.h5') +@pytest.fixture +def model(): + model = openmc.model.Model() + + m = openmc.Material() + m.set_density('g/cm3', 20.0) + m.add_nuclide('U233', 1.0) + m.add_nuclide('Am244', 1.0) + m.add_nuclide('H2', 1.0) + m.add_nuclide('Na23', 1.0) + m.add_nuclide('Ta181', 1.0) + + s = openmc.Sphere(r=100.0, boundary_type='reflective') + c = openmc.Cell(fill=m, region=-s) + model.geometry = openmc.Geometry([c]) + + model.settings.batches = 10 + model.settings.inactive = 5 + model.settings.particles = 1000 + + return model + + +def test_energy_laws(model): + harness = PyAPITestHarness('statepoint.10.h5', model) harness.main() From 37c0fff7ed6f3b0f9fdf91d5f109f24bd571d4af Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 19 Aug 2019 14:57:38 -0500 Subject: [PATCH 13/16] Update filter_mesh test to cover a few cases in mesh.cpp that were missed --- .../filter_mesh/inputs_true.dat | 40 ++++---- .../filter_mesh/results_true.dat | 2 +- tests/regression_tests/filter_mesh/test.py | 98 +++++++------------ 3 files changed, 57 insertions(+), 83 deletions(-) diff --git a/tests/regression_tests/filter_mesh/inputs_true.dat b/tests/regression_tests/filter_mesh/inputs_true.dat index 919347d69..37716c02e 100644 --- a/tests/regression_tests/filter_mesh/inputs_true.dat +++ b/tests/regression_tests/filter_mesh/inputs_true.dat @@ -34,24 +34,24 @@ - 17 - -10.0 - 10.0 + 5 + -7.5 + 7.5 - 17 17 - -10.0 -10.0 - 10.0 10.0 + 5 5 + -7.5 -7.5 + 7.5 7.5 - 17 17 17 - -10.0 -10.0 -183.0 - 10.0 10.0 183.0 + 5 5 5 + -7.5 -7.5 -7.5 + 7.5 7.5 7.5 - -10.0 -8.823529411764707 -7.647058823529411 -6.470588235294118 -5.294117647058823 -4.117647058823529 -2.9411764705882355 -1.7647058823529402 -0.5882352941176467 0.5882352941176467 1.764705882352942 2.9411764705882355 4.117647058823529 5.294117647058824 6.4705882352941195 7.647058823529413 8.823529411764707 10.0 - -10.0 -8.823529411764707 -7.647058823529411 -6.470588235294118 -5.294117647058823 -4.117647058823529 -2.9411764705882355 -1.7647058823529402 -0.5882352941176467 0.5882352941176467 1.764705882352942 2.9411764705882355 4.117647058823529 5.294117647058824 6.4705882352941195 7.647058823529413 8.823529411764707 10.0 - 1.0 1.683624003879018 2.8345897864376153 4.772383405596668 8.034899257376447 13.52774925846868 22.77564337001445 38.34561988154435 64.55960607618856 108.69410247084474 182.99999999999991 + -7.5 -6.617647058823529 -5.735294117647059 -4.852941176470589 -3.9705882352941178 -3.0882352941176467 -2.2058823529411766 -1.3235294117647065 -0.4411764705882355 0.4411764705882355 1.3235294117647065 2.2058823529411757 3.0882352941176467 3.9705882352941178 4.852941176470587 5.735294117647058 6.617647058823529 7.5 + -7.5 -6.617647058823529 -5.735294117647059 -4.852941176470589 -3.9705882352941178 -3.0882352941176467 -2.2058823529411766 -1.3235294117647065 -0.4411764705882355 0.4411764705882355 1.3235294117647065 2.2058823529411757 3.0882352941176467 3.9705882352941178 4.852941176470587 5.735294117647058 6.617647058823529 7.5 + 1.0 1.223224374241637 1.4962778697388448 1.8302835609029084 2.2388474634702153 2.7386127875258306 3.3499379133114306 4.09772570775871 5.012437964687018 6.131336292779302 7.500000000000001 1 @@ -77,35 +77,35 @@ 4 - + 1 total - + 5 current - + 2 total - + 6 current - + 3 total - + 7 current - + 4 total - + 8 current diff --git a/tests/regression_tests/filter_mesh/results_true.dat b/tests/regression_tests/filter_mesh/results_true.dat index 55653d1a5..10ea99f64 100644 --- a/tests/regression_tests/filter_mesh/results_true.dat +++ b/tests/regression_tests/filter_mesh/results_true.dat @@ -1 +1 @@ -2bc8fce4a61bc431e90c44400ac626e7043144b575eeb5ca66b8c4fefb9bed076b20663d096801dca63085f090a96e662f12b6281c85c3ba8ce73efbc55356ba \ No newline at end of file +c3560155c2f713e5e2ad84451ddcd40484942faf94e2829db77df9b648ea880b3fba35c2a80dd1502e1ba62843e19e746638b2fe4961bde4ded3ce98624a2447 \ No newline at end of file diff --git a/tests/regression_tests/filter_mesh/test.py b/tests/regression_tests/filter_mesh/test.py index e68c5f0e1..c8aa871a8 100644 --- a/tests/regression_tests/filter_mesh/test.py +++ b/tests/regression_tests/filter_mesh/test.py @@ -30,77 +30,51 @@ def model(): model.settings.inactive = 0 model.settings.particles = 1000 - # Initialize Meshes + # Create meshes mesh_1d = openmc.RegularMesh() - mesh_1d.dimension = [17] - mesh_1d.lower_left = [-10.0] - mesh_1d.upper_right = [10.0] + mesh_1d.dimension = [5] + mesh_1d.lower_left = [-7.5] + mesh_1d.upper_right = [7.5] mesh_2d = openmc.RegularMesh() - mesh_2d.dimension = [17, 17] - mesh_2d.lower_left = [-10.0, -10.0] - mesh_2d.upper_right = [10.0, 10.0] + mesh_2d.dimension = [5, 5] + mesh_2d.lower_left = [-7.5, -7.5] + mesh_2d.upper_right = [7.5, 7.5] mesh_3d = openmc.RegularMesh() - mesh_3d.dimension = [17, 17, 17] - mesh_3d.lower_left = [-10.0, -10.0, -183.00] - mesh_3d.upper_right = [10.0, 10.0, 183.00] + mesh_3d.dimension = [5, 5, 5] + mesh_3d.lower_left = [-7.5, -7.5, -7.5] + mesh_3d.upper_right = [7.5, 7.5, 7.5] recti_mesh = openmc.RectilinearMesh() - recti_mesh.x_grid = np.linspace(-10.0, 10.0, 18) - recti_mesh.y_grid = np.linspace(-10.0, 10.0, 18) - recti_mesh.z_grid = np.logspace(0, np.log10(183), 11) + recti_mesh.x_grid = np.linspace(-7.5, 7.5, 18) + recti_mesh.y_grid = np.linspace(-7.5, 7.5, 18) + recti_mesh.z_grid = np.logspace(0, np.log10(7.5), 11) - # Initialize the filters - mesh_1d_filter = openmc.MeshFilter(mesh_1d) - mesh_2d_filter = openmc.MeshFilter(mesh_2d) - mesh_3d_filter = openmc.MeshFilter(mesh_3d) - recti_mesh_filter = openmc.MeshFilter(recti_mesh) - meshsurf_1d_filter = openmc.MeshSurfaceFilter(mesh_1d) - meshsurf_2d_filter = openmc.MeshSurfaceFilter(mesh_2d) - meshsurf_3d_filter = openmc.MeshSurfaceFilter(mesh_3d) - recti_meshsurf_filter = openmc.MeshSurfaceFilter(recti_mesh) + # Create filters + reg_filters = [ + openmc.MeshFilter(mesh_1d), + openmc.MeshFilter(mesh_2d), + openmc.MeshFilter(mesh_3d), + openmc.MeshFilter(recti_mesh) + ] + surf_filters = [ + openmc.MeshSurfaceFilter(mesh_1d), + openmc.MeshSurfaceFilter(mesh_2d), + openmc.MeshSurfaceFilter(mesh_3d), + openmc.MeshSurfaceFilter(recti_mesh) + ] - # Initialized the tallies - tally = openmc.Tally(name='tally 1') - tally.filters = [mesh_1d_filter] - tally.scores = ['total'] - model.tallies.append(tally) - - tally = openmc.Tally(name='tally 2') - tally.filters = [meshsurf_1d_filter] - tally.scores = ['current'] - model.tallies.append(tally) - - tally = openmc.Tally(name='tally 3') - tally.filters = [mesh_2d_filter] - tally.scores = ['total'] - model.tallies.append(tally) - - tally = openmc.Tally(name='tally 4') - tally.filters = [meshsurf_2d_filter] - tally.scores = ['current'] - model.tallies.append(tally) - - tally = openmc.Tally(name='tally 5') - tally.filters = [mesh_3d_filter] - tally.scores = ['total'] - model.tallies.append(tally) - - tally = openmc.Tally(name='tally 6') - tally.filters = [meshsurf_3d_filter] - tally.scores = ['current'] - model.tallies.append(tally) - - tally = openmc.Tally(name='tally 7') - tally.filters = [recti_mesh_filter] - tally.scores = ['total'] - model.tallies.append(tally) - - tally = openmc.Tally(name='tally 8') - tally.filters = [recti_meshsurf_filter] - tally.scores = ['current'] - model.tallies.append(tally) + # Create tallies + for f1, f2 in zip(reg_filters, surf_filters): + tally = openmc.Tally() + tally.filters = [f1] + tally.scores = ['total'] + model.tallies.append(tally) + tally = openmc.Tally() + tally.filters = [f2] + tally.scores = ['current'] + model.tallies.append(tally) return model From 9287db4a2636bc725050b8f49b427e493c165f0b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 22 Aug 2019 09:41:39 -0500 Subject: [PATCH 14/16] Support more secondary nuclides in Chain.set_branch_ratios Reactions are pulled from reaction scores table on https://docs.openmc.org/en/latest/usersguide/tallies.html#scores for reactions that produce hydrogen and helium isotopes --- openmc/deplete/chain.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/openmc/deplete/chain.py b/openmc/deplete/chain.py index b557a6111..3cb3dbf01 100644 --- a/openmc/deplete/chain.py +++ b/openmc/deplete/chain.py @@ -12,7 +12,7 @@ from collections import OrderedDict, defaultdict from collections.abc import Mapping from warnings import warn -from openmc.checkvalue import check_type, check_less_than +from openmc.checkvalue import check_type from openmc.data import gnd_name, zam # Try to use lxml if it is available. It preserves the order of attributes and @@ -103,6 +103,19 @@ def replace_missing(product, decay_data): return product +_secondary_particles = { + "p": ["H1"], "d": ["H2"], "t": ["H3"], "3He": ["He3"], "a": ["He4"], + "2nd": ["H2"], "na": ["He4"], "n3a": ["He4"] * 3, "2na": ["He4"], + "3na": ["He4"], "np": ["H1"], "n2a": ["He4"] * 2, + "2n2a": ["He4"] * 2, "nd": ["H2"], "nt": ["H3"], + "nHe-3": ["He3"], "nd2a": ["H2", "He4"], "nt2a": ["H3", "He4", "He4"], + "2np": ["H1"], "3np": ["H1"], "n2p": ["H1"] * 2, + "2a": ["He4"] * 2, "3a": ["He4"] * 3, "2p": ["H1"] * 2, + "pa": ["H1", "He4"], "t2a": ["H3", "He4", "He4"], + "d2a": ["H2", "He4", "He4"], "pd": ["H1", "H2"], "pt": ["H1", "H3"], + "da": ["H2", "He4"]} + + class Chain(object): """Full representation of a depletion chain. @@ -122,7 +135,6 @@ class Chain(object): Reactions that are tracked in the depletion chain nuclide_dict : OrderedDict of str to int Maps a nuclide name to an index in nuclides. - """ def __init__(self): @@ -546,7 +558,8 @@ class Chain(object): bad_sums = {} # Secondary products, like alpha particles, should not be modified - secondary = "He4" if reaction == "(n,a)" else None + secondary = _secondary_particles.get( + reaction[reaction.index(",") + 1:-1], []) # Check for validity before manipulation @@ -576,7 +589,7 @@ class Chain(object): indexes = [] for ix, rx in enumerate(self[parent].reactions): - if rx.type == reaction and rx.target != secondary: + if rx.type == reaction and rx.target not in secondary: indexes.append(ix) if "_m" not in rx.target: grounds[parent] = rx.target From c8e205aff87af51ecc83aafcb8406d091cec9bcb Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 23 Aug 2019 11:43:19 -0500 Subject: [PATCH 15/16] Update dictionary of secondary particles for Chain --- openmc/deplete/chain.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/openmc/deplete/chain.py b/openmc/deplete/chain.py index 04fdf658e..b3e2dae29 100644 --- a/openmc/deplete/chain.py +++ b/openmc/deplete/chain.py @@ -104,17 +104,17 @@ def replace_missing(product, decay_data): return product -_secondary_particles = { - "p": ["H1"], "d": ["H2"], "t": ["H3"], "3He": ["He3"], "a": ["He4"], - "2nd": ["H2"], "na": ["He4"], "n3a": ["He4"] * 3, "2na": ["He4"], - "3na": ["He4"], "np": ["H1"], "n2a": ["He4"] * 2, - "2n2a": ["He4"] * 2, "nd": ["H2"], "nt": ["H3"], - "nHe-3": ["He3"], "nd2a": ["H2", "He4"], "nt2a": ["H3", "He4", "He4"], - "2np": ["H1"], "3np": ["H1"], "n2p": ["H1"] * 2, - "2a": ["He4"] * 2, "3a": ["He4"] * 3, "2p": ["H1"] * 2, - "pa": ["H1", "He4"], "t2a": ["H3", "He4", "He4"], - "d2a": ["H2", "He4", "He4"], "pd": ["H1", "H2"], "pt": ["H1", "H3"], - "da": ["H2", "He4"]} +_SECONDARY_PARTICLES = { + "(n,p)": ["H1"], "(n,d)": ["H2"], "(n,t)": ["H3"], "(n,3He)": ["He3"], + "(n,a)": ["He4"], "(n,2nd)": ["H2"], "(n,na)": ["He4"], "(n,3na)": ["He4"], + "(n,n3a)": ["He4"] * 3, "(n,2na)": ["He4"], "(n,np)": ["H1"], + "(n,n2a)": ["He4"] * 2, "(n,2n2a)": ["He4"] * 2, "(n,nd)": ["H2"], + "(n,nt)": ["H3"], "(n,nHe-3)": ["He3"], "(n,nd2a)": ["H2", "He4"], + "(n,nt2a)": ["H3", "He4", "He4"], "(n,2np)": ["H1"], "(n,3np)": ["H1"], + "(n,n2p)": ["H1"] * 2, "(n,2a)": ["He4"] * 2, "(n,3a)": ["He4"] * 3, + "(n,2p)": ["H1"] * 2, "(n,pa)": ["H1", "He4"], + "(n,t2a)": ["H3", "He4", "He4"], "(n,d2a)": ["H2", "He4", "He4"], + "(n,pd)": ["H1", "H2"], "(n,pt)": ["H1", "H3"], "(n,da)": ["H2", "He4"]} class Chain(object): @@ -559,8 +559,7 @@ class Chain(object): bad_sums = {} # Secondary products, like alpha particles, should not be modified - secondary = _secondary_particles.get( - reaction[reaction.index(",") + 1:-1], []) + secondary = _SECONDARY_PARTICLES.get(reaction, []) # Check for validity before manipulation From 12ec18796af10bd2eccce403778b6a4074987d94 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 23 Aug 2019 13:17:03 -0500 Subject: [PATCH 16/16] Respond to @drewejohnson comments on #1320 --- tests/regression_tests/lattice_multiple/test.py | 8 ++------ tests/regression_tests/tally_aggregation/test.py | 6 ++---- tests/regression_tests/tally_assumesep/tallies.xml | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/tests/regression_tests/lattice_multiple/test.py b/tests/regression_tests/lattice_multiple/test.py index a9b15c9c8..c287c0102 100644 --- a/tests/regression_tests/lattice_multiple/test.py +++ b/tests/regression_tests/lattice_multiple/test.py @@ -22,12 +22,8 @@ def model(): cyl = openmc.ZCylinder(r=0.4) big_cyl = openmc.ZCylinder(r=0.5) - c1 = openmc.Cell(fill=uo2, region=-cyl) - c2 = openmc.Cell(fill=water, region=+cyl) - pin = openmc.Universe(cells=[c1, c2]) - c3 = openmc.Cell(fill=uo2, region=-big_cyl) - c4 = openmc.Cell(fill=water, region=+big_cyl) - big_pin = openmc.Universe(cells=[c3, c4]) + pin = openmc.model.pin([cyl], [uo2, water]) + big_pin = openmc.model.pin([big_cyl], [uo2, water]) d = 1.2 inner_lattice = openmc.RectLattice() diff --git a/tests/regression_tests/tally_aggregation/test.py b/tests/regression_tests/tally_aggregation/test.py index 8914ac2a8..70a948be6 100644 --- a/tests/regression_tests/tally_aggregation/test.py +++ b/tests/regression_tests/tally_aggregation/test.py @@ -24,9 +24,7 @@ def model(): model.materials.extend([fuel, water]) cyl = openmc.ZCylinder(r=0.4) - c1 = openmc.Cell(fill=fuel, region=-cyl) - c2 = openmc.Cell(fill=water, region=+cyl) - pin = openmc.Universe(cells=[c1, c2]) + pin = openmc.model.pin([cyl], [fuel, water]) d = 1.2 lattice = openmc.RectLattice() lattice.lower_left = (-d, -d) @@ -45,7 +43,7 @@ def model(): model.settings.particles = 1000 energy_filter = openmc.EnergyFilter([0.0, 0.253, 1.0e3, 1.0e6, 20.0e6]) - distrib_filter = openmc.DistribcellFilter(c1) + distrib_filter = openmc.DistribcellFilter(pin.cells[1]) tally = openmc.Tally(name='distribcell tally') tally.filters = [energy_filter, distrib_filter] tally.scores = ['nu-fission', 'total'] diff --git a/tests/regression_tests/tally_assumesep/tallies.xml b/tests/regression_tests/tally_assumesep/tallies.xml index 1e1c5492a..f65e5dfec 100644 --- a/tests/regression_tests/tally_assumesep/tallies.xml +++ b/tests/regression_tests/tally_assumesep/tallies.xml @@ -1,7 +1,7 @@ - false + true cell