Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
collect material info to display in message box
  • Loading branch information
kkiesling committed Jun 30, 2022
commit 98b0646ac6f91f945fb114eb89dd6e047a0603d1
27 changes: 22 additions & 5 deletions openmc_plotter/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,6 @@ def openView(self):
message = 'Error loading plot settings. Incompatible model.'
self.statusBar().showMessage(message, 5000)

def viewMaterialProps(self, id):
msg_box = QMessageBox()
msg_box.setText("Testing mat prop box for mat {}".format(id))
msg_box.exec_()

def openStatePoint(self):
# check for an alread-open statepoint
if self.model.statepoint:
Expand Down Expand Up @@ -1233,3 +1228,25 @@ def exportTallyData(self):
# show export tool dialog
self.showExportDialog()

def viewMaterialProps(self, id):
"""display material properties in message box"""
mat = openmc.lib.materials[id]
if mat.name:
msg_str = "Material {} ({}) Properties\n\n".format(id, mat.name)
else:
msg_str = "Material {} Properties\n\n".format(id)
Comment thread
kkiesling marked this conversation as resolved.
Resolved

# get density and temperature
dens_g = mat.get_density(units='g/cm3')
dens_a = mat.get_density(units='atom/b-cm')
msg_str += "Density: {:.3f} g/cm3 ({:.3e} atom/b-cm)\n".format(dens_g, dens_a)
msg_str += "Temperature: {} K\n\n".format(mat.temperature)
Comment thread
kkiesling marked this conversation as resolved.
Resolved

# get nuclides and their densities
msg_str += "Nuclide densities [atom/b-cm]:\n"
for nuc, dens in zip(mat.nuclides, mat.densities):
msg_str += '{}: {:5.3e}\n'.format(nuc, dens)
Comment thread
kkiesling marked this conversation as resolved.
Resolved

msg_box = QMessageBox()
msg_box.setText(msg_str)
msg_box.exec_()
Comment thread
kkiesling marked this conversation as resolved.
Resolved