From 38c0510c715b264fc708d23474052913d5b67492 Mon Sep 17 00:00:00 2001 From: Paul Moeller Date: Thu, 13 Feb 2025 18:30:16 +0000 Subject: [PATCH 1/4] fix #7034 require tally score and mesh fix #7183 validate mesh dimensions are positive --- sirepo/package_data/static/js/openmc.js | 10 ++++++++-- sirepo/package_data/static/json/openmc-schema.json | 2 +- sirepo/template/openmc.py | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sirepo/package_data/static/js/openmc.js b/sirepo/package_data/static/js/openmc.js index 776ed09ad0..3fd74353f8 100644 --- a/sirepo/package_data/static/js/openmc.js +++ b/sirepo/package_data/static/js/openmc.js @@ -14,7 +14,10 @@ SIREPO.app.config(() => { `; SIREPO.appFieldEditors = `
-
+
+
+
+
@@ -2549,12 +2552,15 @@ SIREPO.app.directive('point3d', function() { scope: { model: '=', field: '=', + type: '@', + min: '@', }, template: `
-
`, diff --git a/sirepo/package_data/static/json/openmc-schema.json b/sirepo/package_data/static/json/openmc-schema.json index e20cb10306..6faa9e6db8 100644 --- a/sirepo/package_data/static/json/openmc-schema.json +++ b/sirepo/package_data/static/json/openmc-schema.json @@ -379,7 +379,7 @@ }, "meshFilter": { "_super": ["_", "model", "filter"], - "dimension": ["Mesh cell count", "Point3D", [10, 10, 10]], + "dimension": ["Mesh cell count", "Size3D", [10, 10, 10]], "lower_left": ["Mesh lower left [cm]", "Point3D", [-5.0, -5.0, -5.0]], "upper_right": ["Mesh upper right [cm]", "Point3D", [5.0, 5.0, 5.0]] }, diff --git a/sirepo/template/openmc.py b/sirepo/template/openmc.py index 68b73d4afc..d9d18eb00a 100644 --- a/sirepo/template/openmc.py +++ b/sirepo/template/openmc.py @@ -892,7 +892,9 @@ def _generate_tally(tally, volumes): openmc.ParticleFilter([{'"' + '","'.join(v.value for v in f.bins) + '"'}]), """ else: - raise AssertionError("filter not yet implemented: {}".format(f._type)) + raise AssertionError("Unknown filter selected: {}".format(f._type)) + if not len(tally.scores): + raise AssertionError(f"Tally {tally.name} has no scores defined") res += f"""] t{tally._index + 1}.scores = [{','.join(["'" + s.score + "'" for s in tally.scores])}] """ From 312042fb7914af7875a3abb395ccf4bdaf7214da Mon Sep 17 00:00:00 2001 From: Paul Moeller Date: Thu, 13 Feb 2025 20:42:51 +0000 Subject: [PATCH 2/4] fix #7203 add tally estimator to UI --- sirepo/package_data/static/json/openmc-schema.json | 10 +++++++++- sirepo/sim_data/openmc.py | 1 + sirepo/template/openmc.py | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sirepo/package_data/static/json/openmc-schema.json b/sirepo/package_data/static/json/openmc-schema.json index 6faa9e6db8..eebfe33440 100644 --- a/sirepo/package_data/static/json/openmc-schema.json +++ b/sirepo/package_data/static/json/openmc-schema.json @@ -51,6 +51,12 @@ ["sum", "sum"], ["macro", "macro"] ], + "Estimator": [ + ["default", "Default"], + ["analog", "Analog"], + ["tracklength", "Track Length"], + ["collision", "Collision"] + ], "EnrichmentType": [ ["none", ""], ["ao", "ao"], @@ -530,7 +536,8 @@ "filter4": ["Filter", "Filter", {"_type": "None"}], "filter5": ["Filter", "Filter", {"_type": "None"}], "scores": ["Scores", "SimpleListEditor", [], "", "tallyScore"], - "nuclides": ["Nuclides", "SimpleListEditor", [], "List of nuclides to use when scoring results", "nuclide"] + "nuclides": ["Nuclides", "SimpleListEditor", [], "List of nuclides to use when scoring results", "nuclide"], + "estimator": ["Estimator", "Estimator", "default", "If Default is selected, OpenMC will automatically select an appropriate estimator based on the tally filters and scores with a preference for \"tracklength\"."] }, "tallyReport": { "axis": ["Slice axis", "Axis", "y"], @@ -884,6 +891,7 @@ "advanced": [ ["Main", [ "name", + "estimator", "scores" ]], ["Filters", [ diff --git a/sirepo/sim_data/openmc.py b/sirepo/sim_data/openmc.py index 659b112f5a..edc5b96b5e 100644 --- a/sirepo/sim_data/openmc.py +++ b/sirepo/sim_data/openmc.py @@ -109,6 +109,7 @@ def _fix_val(model, field): dm.energyAnimation.tally = dm.openmcAnimation.tally dm.energyAnimation.score = dm.openmcAnimation.score for t in dm.settings.tallies: + cls.update_model_defaults(t, "tally") for i in range(1, sch.constants.maxFilters + 1): f = t[f"filter{i}"] y = f._type diff --git a/sirepo/template/openmc.py b/sirepo/template/openmc.py index d9d18eb00a..eaceb0d619 100644 --- a/sirepo/template/openmc.py +++ b/sirepo/template/openmc.py @@ -897,6 +897,9 @@ def _generate_tally(tally, volumes): raise AssertionError(f"Tally {tally.name} has no scores defined") res += f"""] t{tally._index + 1}.scores = [{','.join(["'" + s.score + "'" for s in tally.scores])}] +""" + if tally.estimator != "default": + res += f"""t{tally._index + 1}.estimator = "{tally.estimator}" """ if len(tally.nuclides): res += f""" From bdf0d0394adbd9cb3fbebc3d2d1a61d3bfe80834 Mon Sep 17 00:00:00 2001 From: Paul Moeller Date: Fri, 14 Feb 2025 17:10:46 +0000 Subject: [PATCH 3/4] fix #7374 use bounded_universe() if no graveyard --- .../package_data/template/openmc/parameters.py.jinja | 11 +++-------- sirepo/template/openmc.py | 6 ++++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/sirepo/package_data/template/openmc/parameters.py.jinja b/sirepo/package_data/template/openmc/parameters.py.jinja index 6f46ba6a3a..3ed9e90614 100644 --- a/sirepo/package_data/template/openmc/parameters.py.jinja +++ b/sirepo/package_data/template/openmc/parameters.py.jinja @@ -14,21 +14,16 @@ def create_geometry(): auto_geom_ids=True, ) {% if reflectivePlanes_useReflectivePlanes == '1' %} - # creates an edge of universe boundary surface - vac_surf = openmc.Sphere(r=10000, boundary_type="vacuum") {{ planes }} univ = openmc.Cell( - region=-vac_surf {{ region }}, - fill=univ, + region={{ region }}, + fill=univ.bounded_universe(), ) openmc.Geometry([univ]).export_to_xml() {% elif hasGraveyard %} openmc.Geometry(univ).export_to_xml() {% else %} - graveyard = openmc.Sphere(r=10000, boundary_type="vacuum") - root = openmc.Universe() - root.add_cells([openmc.Cell(region=-graveyard, fill=univ)]) - openmc.Geometry(root).export_to_xml() + openmc.Geometry(univ.bounded_universe()).export_to_xml() {% endif %} diff --git a/sirepo/template/openmc.py b/sirepo/template/openmc.py index eaceb0d619..5068c54b0d 100644 --- a/sirepo/template/openmc.py +++ b/sirepo/template/openmc.py @@ -1126,10 +1126,12 @@ def _prep_standard_material_cache(): def _region(data): res = "" for i, p in enumerate(data.models.reflectivePlanes.planesList): + if res: + res += " & " if p.inside == "1": - res += f"& +p{i + 1} " + res += f"+p{i + 1}" else: - res += f"& -p{i + 1} " + res += f"-p{i + 1}" return res From f22584564981e47aaba3011b02609dd85ef985c4 Mon Sep 17 00:00:00 2001 From: Paul Moeller Date: Fri, 14 Feb 2025 17:12:26 +0000 Subject: [PATCH 4/4] removed unneeded vtk plot border --- sirepo/package_data/static/css/vtk.css | 7 ------- sirepo/package_data/static/html/vtk-display.html | 2 +- sirepo/package_data/static/js/openmc.js | 2 +- sirepo/package_data/static/js/radia.js | 2 +- sirepo/package_data/static/js/sirepo-plotting-vtk.js | 1 - 5 files changed, 3 insertions(+), 11 deletions(-) diff --git a/sirepo/package_data/static/css/vtk.css b/sirepo/package_data/static/css/vtk.css index ca9afb84bf..fab3fb54f4 100644 --- a/sirepo/package_data/static/css/vtk.css +++ b/sirepo/package_data/static/css/vtk.css @@ -2,13 +2,6 @@ display: none; } -.vtk-canvas-holder-border { - border-color: #cccccc; - border-radius: 4px; - border-style: solid; - border-width: 1px; -} - .vtk-display { padding: 8px; } diff --git a/sirepo/package_data/static/html/vtk-display.html b/sirepo/package_data/static/html/vtk-display.html index 1a8fbfe9d5..288f5c5ab4 100644 --- a/sirepo/package_data/static/html/vtk-display.html +++ b/sirepo/package_data/static/html/vtk-display.html @@ -2,7 +2,7 @@
-
+
diff --git a/sirepo/package_data/static/js/openmc.js b/sirepo/package_data/static/js/openmc.js index 3fd74353f8..fe3eda5993 100644 --- a/sirepo/package_data/static/js/openmc.js +++ b/sirepo/package_data/static/js/openmc.js @@ -1419,7 +1419,7 @@ SIREPO.app.directive('geometry3d', function(appState, openmcService, plotting, p }, template: `
-
+
diff --git a/sirepo/package_data/static/js/sirepo-plotting-vtk.js b/sirepo/package_data/static/js/sirepo-plotting-vtk.js index 409a636f17..279c4beaf0 100644 --- a/sirepo/package_data/static/js/sirepo-plotting-vtk.js +++ b/sirepo/package_data/static/js/sirepo-plotting-vtk.js @@ -1918,7 +1918,6 @@ SIREPO.app.directive('vtkDisplay', function(appState, utilities, $window) { modelName: '@', resetDirection: '@', resetSide: '@', - showBorder: '@', }, templateUrl: '/static/html/vtk-display.html' + SIREPO.SOURCE_CACHE_KEY, controller: function($scope, $element) {