Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #7034 require tally score and mesh #7453

Merged
merged 5 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions sirepo/package_data/static/css/vtk.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion sirepo/package_data/static/html/vtk-display.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<div class="viewer-title" style="font-weight: normal; text-align: center"></div>
<div class="sr-screenshot">
<div class="vtk-canvas-holder" data-ng-class="{'vtk-canvas-holder-border': showBorder}"></div>
<div class="vtk-canvas-holder"></div>
<div class="vtk-info-overlay vtk-info-overlay-move" data-ng-attr-style="width: {{ canvasGeometry().size.width }}px; height:{{ canvasGeometry().size.height }}px; top:{{ canvasGeometry().pos.top }}px; left:{{ canvasGeometry().pos.left }}px;">
<div data-vtk-axes="" data-ng-if="enableAxes" data-width="canvasGeometry().size.width" data-height="canvasGeometry().size.height" data-bound-obj="axisObj" data-axis-cfg="axisCfg"></div>
<div class="vtk-load-indicator">
Expand Down
12 changes: 9 additions & 3 deletions sirepo/package_data/static/js/openmc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ SIREPO.app.config(() => {
`;
SIREPO.appFieldEditors = `
<div data-ng-switch-when="Point3D" class="col-sm-7">
<div data-point3d="" data-model="model" data-field="field"></div>
<div data-point3d="" data-model="model" data-field="field" data-type="Float"></div>
</div>
<div data-ng-switch-when="Size3D" class="col-sm-7">
<div data-point3d="" data-model="model" data-field="field" data-type="integer" data-min="1"></div>
</div>
<div data-ng-switch-when="MaterialComponents" class="col-sm-12">
<div data-material-components=""></div>
Expand Down Expand Up @@ -1416,7 +1419,7 @@ SIREPO.app.directive('geometry3d', function(appState, openmcService, plotting, p
},
template: `
<div data-vtk-display="" class="vtk-display col-sm-11"
data-ng-style="sizeStyle()" data-show-border="true"
data-ng-style="sizeStyle()"
data-model-name="{{ modelName }}"
data-reset-side="y" data-reset-direction="-1"
data-enable-axes="true" data-axis-cfg="axisCfg"
Expand Down Expand Up @@ -2549,12 +2552,15 @@ SIREPO.app.directive('point3d', function() {
scope: {
model: '=',
field: '=',
type: '@',
min: '@',
},
template: `
<div data-ng-repeat="v in model[field] track by $index"
style="display: inline-block; width: 7em; margin-right: 5px;" >
<input class="form-control" data-string-to-number="Float"
<input class="form-control" data-string-to-number="{{ type }}"
data-ng-model="model[field][$index]"
data-min="min"
style="text-align: right" required />
</div>
`,
Expand Down
2 changes: 1 addition & 1 deletion sirepo/package_data/static/js/radia.js
Original file line number Diff line number Diff line change
Expand Up @@ -2236,7 +2236,7 @@ SIREPO.app.directive('radiaViewerContent', function(appState, geometry, panelSta
template: `
<div data-advanced-editor-pane="" data-view-name="modelName" data-want-buttons="true" data-field-def="basic" data-model-data="modelData" data-parent-controller="parentController"></div>
<div data-ng-transclude="">
<div data-vtk-display="" class="vtk-display" data-ng-class="{'col-sm-11': isViewTypeFields()}" style="padding-right: 0" data-show-border="true" data-model-name="{{ modelName }}" data-enable-axes="true" data-axis-cfg="axisCfg" data-axis-obj="axisObj" data-enable-selection="true" data-reset-side="x"></div>
<div data-vtk-display="" class="vtk-display" data-ng-class="{'col-sm-11': isViewTypeFields()}" style="padding-right: 0" data-model-name="{{ modelName }}" data-enable-axes="true" data-axis-cfg="axisCfg" data-axis-obj="axisObj" data-enable-selection="true" data-reset-side="x"></div>
<div class="col-sm-1" style="padding-left: 0" data-ng-if="isViewTypeFields()">
<div class="colorbar"></div>
</div>
Expand Down
1 change: 0 additions & 1 deletion sirepo/package_data/static/js/sirepo-plotting-vtk.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 10 additions & 2 deletions sirepo/package_data/static/json/openmc-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
["sum", "sum"],
["macro", "macro"]
],
"Estimator": [
["default", "Default"],
["analog", "Analog"],
["tracklength", "Track Length"],
["collision", "Collision"]
],
"EnrichmentType": [
["none", ""],
["ao", "ao"],
Expand Down Expand Up @@ -379,7 +385,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]]
},
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -884,6 +891,7 @@
"advanced": [
["Main", [
"name",
"estimator",
"scores"
]],
["Filters", [
Expand Down
11 changes: 3 additions & 8 deletions sirepo/package_data/template/openmc/parameters.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}


Expand Down
1 change: 1 addition & 0 deletions sirepo/sim_data/openmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions sirepo/template/openmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,9 +892,14 @@ 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])}]
"""
if tally.estimator != "default":
res += f"""t{tally._index + 1}.estimator = "{tally.estimator}"
"""
if len(tally.nuclides):
res += f"""
Expand Down Expand Up @@ -1121,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


Expand Down