mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
adding back files to be reviewed
This commit is contained in:
parent
ae28233110
commit
bc09d1ef55
1244 changed files with 301904 additions and 0 deletions
0
tests/regression_tests/plot/__init__.py
Normal file
0
tests/regression_tests/plot/__init__.py
Normal file
13
tests/regression_tests/plot/geometry.xml
Normal file
13
tests/regression_tests/plot/geometry.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<surface id="1" type="z-cylinder" coeffs="0 0 2" />
|
||||
<surface id="2" type="z-cylinder" coeffs="0 0 5" />
|
||||
<surface id="3" type="z-cylinder" coeffs="0 0 10" boundary="vacuum" />
|
||||
<surface id="4" type="y-plane" coeffs="5" boundary="vacuum" />
|
||||
|
||||
<cell id="1" material="1" region=" -1 -4" />
|
||||
<cell id="2" material="3" region="1 -2 -4" />
|
||||
<cell id="3" material="2" region="2 -3 -4" />
|
||||
|
||||
</geometry>
|
||||
19
tests/regression_tests/plot/materials.xml
Normal file
19
tests/regression_tests/plot/materials.xml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<material id="1">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U235" ao="1.0" />
|
||||
</material>
|
||||
|
||||
<material id="2">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U235" ao="1.0" />
|
||||
</material>
|
||||
|
||||
<material id="3">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U235" ao="1.0" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
33
tests/regression_tests/plot/plots.xml
Normal file
33
tests/regression_tests/plot/plots.xml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0"?>
|
||||
<plots>
|
||||
|
||||
<plot id="1" basis="xy">
|
||||
<origin>0. 0. 0.</origin>
|
||||
<width>25 25</width>
|
||||
<pixels>200 200</pixels>
|
||||
<color id="1" rgb="255 0 0" /> <!-- Red -->
|
||||
<meshlines meshtype="entropy" linewidth="0" />
|
||||
</plot>
|
||||
|
||||
<plot id="2" basis="xz">
|
||||
<origin>0. 0. 0.</origin>
|
||||
<width>25 25</width>
|
||||
<pixels>200 200</pixels>
|
||||
<mask components="1 3" background="255 255 255" />
|
||||
<meshlines meshtype="tally" id="2" linewidth="0" />
|
||||
</plot>
|
||||
|
||||
<plot id="3" basis="yz" color_by="material">
|
||||
<origin>0. 0. 0.</origin>
|
||||
<width>25 25</width>
|
||||
<pixels>200 200</pixels>
|
||||
<background>0 0 0</background>
|
||||
</plot>
|
||||
|
||||
<plot id="4" type="voxel">
|
||||
<pixels>100 100 10</pixels>
|
||||
<origin>0. 0. 0.</origin>
|
||||
<width>20 20 10</width>
|
||||
</plot>
|
||||
|
||||
</plots>
|
||||
1
tests/regression_tests/plot/results_true.dat
Normal file
1
tests/regression_tests/plot/results_true.dat
Normal file
|
|
@ -0,0 +1 @@
|
|||
fd61f6a5de632f06a39e2a938480ba3dc314810655e684291e4b255bb8c142a16f10fec414c587ecd727fa559d3760d6e5b43f53fe86e90238a69d9c5698db8e
|
||||
13
tests/regression_tests/plot/settings.xml
Normal file
13
tests/regression_tests/plot/settings.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<run_mode>plot</run_mode>
|
||||
|
||||
<mesh id="1">
|
||||
<dimension>5 4 3</dimension>
|
||||
<lower_left>-10 -10 -10</lower_left>
|
||||
<upper_right>10 10 10</upper_right>
|
||||
</mesh>
|
||||
<entropy_mesh>1</entropy_mesh>
|
||||
|
||||
</settings>
|
||||
20
tests/regression_tests/plot/tallies.xml
Normal file
20
tests/regression_tests/plot/tallies.xml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
<tallies>
|
||||
|
||||
<mesh id="2" type="rectilinear">
|
||||
<x_grid>-10 10</x_grid>
|
||||
<y_grid>-10 10</y_grid>
|
||||
<z_grid>-10 0 5 7.5 8.75 10</z_grid>
|
||||
</mesh>
|
||||
|
||||
<filter id="1">
|
||||
<type>mesh</type>
|
||||
<bins>2</bins>
|
||||
</filter>
|
||||
|
||||
<tally id="1">
|
||||
<filters>1</filters>
|
||||
<scores>total</scores>
|
||||
</tally>
|
||||
|
||||
</tallies>
|
||||
61
tests/regression_tests/plot/test.py
Normal file
61
tests/regression_tests/plot/test.py
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import glob
|
||||
import hashlib
|
||||
import os
|
||||
|
||||
import h5py
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import TestHarness
|
||||
from tests.regression_tests import config
|
||||
|
||||
|
||||
class PlotTestHarness(TestHarness):
|
||||
"""Specialized TestHarness for running OpenMC plotting tests."""
|
||||
def __init__(self, plot_names):
|
||||
super().__init__(None)
|
||||
self._plot_names = plot_names
|
||||
|
||||
def _run_openmc(self):
|
||||
openmc.plot_geometry(openmc_exec=config['exe'])
|
||||
|
||||
def _test_output_created(self):
|
||||
"""Make sure *.ppm has been created."""
|
||||
for fname in self._plot_names:
|
||||
assert os.path.exists(fname), 'Plot output file does not exist.'
|
||||
|
||||
def _cleanup(self):
|
||||
super()._cleanup()
|
||||
for fname in self._plot_names:
|
||||
if os.path.exists(fname):
|
||||
os.remove(fname)
|
||||
|
||||
def _get_results(self):
|
||||
"""Return a string hash of the plot files."""
|
||||
outstr = bytes()
|
||||
|
||||
for fname in self._plot_names:
|
||||
if fname.endswith('.ppm'):
|
||||
# Add PPM output to results
|
||||
with open(fname, 'rb') as fh:
|
||||
outstr += fh.read()
|
||||
elif fname.endswith('.h5'):
|
||||
# Add voxel data to results
|
||||
with h5py.File(fname, 'r') as fh:
|
||||
outstr += fh.attrs['filetype']
|
||||
outstr += fh.attrs['num_voxels'].tostring()
|
||||
outstr += fh.attrs['lower_left'].tostring()
|
||||
outstr += fh.attrs['voxel_width'].tostring()
|
||||
outstr += fh['data'].value.tostring()
|
||||
|
||||
# Hash the information and return.
|
||||
sha512 = hashlib.sha512()
|
||||
sha512.update(outstr)
|
||||
outstr = sha512.hexdigest()
|
||||
|
||||
return outstr
|
||||
|
||||
|
||||
def test_plot():
|
||||
harness = PlotTestHarness(('plot_1.ppm', 'plot_2.ppm', 'plot_3.ppm',
|
||||
'plot_4.h5'))
|
||||
harness.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue