mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Added core map plotting capability.
This commit is contained in:
parent
8483b3fc2a
commit
cff7a56525
1 changed files with 35 additions and 0 deletions
35
src/utils/plot_map.py
Executable file
35
src/utils/plot_map.py
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as pyplot
|
||||
|
||||
axial_level = 10
|
||||
|
||||
# Get filename and file object
|
||||
filename = sys.argv[1]
|
||||
fh = open(filename,'r')
|
||||
|
||||
# Read size of mesh
|
||||
words = fh.readline().split()
|
||||
nx, ny, nz = [int(item) for item in words]
|
||||
|
||||
# Read values
|
||||
value_dict = {}
|
||||
for line in fh:
|
||||
words = line.split()
|
||||
i, j, k = [int(item) for item in words[:3]]
|
||||
value = float(words[3])
|
||||
value_dict[i,j,k] = value
|
||||
|
||||
# Set up matrix
|
||||
matrix = np.array([[value_dict[i+1,j+1,axial_level] for i in range(nx)]
|
||||
for j in range(ny)])
|
||||
|
||||
# Make figure
|
||||
pyplot.pcolor(matrix)
|
||||
pyplot.colorbar()
|
||||
pyplot.xticks([])
|
||||
pyplot.yticks([])
|
||||
pyplot.show()
|
||||
Loading…
Add table
Add a link
Reference in a new issue