mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Update CMFD test suite
This commit is contained in:
parent
ee9a6ab065
commit
b4a2687af9
8 changed files with 120 additions and 116 deletions
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<cmfd>
|
||||
|
||||
<mesh>
|
||||
<lower_left> -10 -1 -1 </lower_left>
|
||||
<upper_right> 10 1 1 </upper_right>
|
||||
<dimension> 10 1 1 </dimension>
|
||||
<albedo> 0.0 0.0 1.0 1.0 1.0 1.0 </albedo>
|
||||
</mesh>
|
||||
|
||||
<begin>5</begin>
|
||||
<display>dominance</display>
|
||||
<feedback>true</feedback>
|
||||
<gauss_seidel_tolerance>1.e-15 1.e-20</gauss_seidel_tolerance>
|
||||
</cmfd>
|
||||
|
|
@ -391,10 +391,6 @@ cmfd indices
|
|||
1.000000E+00
|
||||
1.000000E+00
|
||||
k cmfd
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
1.170416E+00
|
||||
1.172966E+00
|
||||
1.165537E+00
|
||||
|
|
@ -412,10 +408,6 @@ k cmfd
|
|||
1.167848E+00
|
||||
1.165116E+00
|
||||
cmfd entropy
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
3.203643E+00
|
||||
3.207943E+00
|
||||
3.213367E+00
|
||||
|
|
@ -433,10 +425,6 @@ cmfd entropy
|
|||
3.233193E+00
|
||||
3.232564E+00
|
||||
cmfd balance
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
4.009062E-03
|
||||
4.431773E-03
|
||||
3.152666E-03
|
||||
|
|
@ -446,18 +434,14 @@ cmfd balance
|
|||
1.502427E-03
|
||||
1.589825E-03
|
||||
1.566020E-03
|
||||
1.219160E-03
|
||||
1.017888E-03
|
||||
9.771622E-04
|
||||
1.010120E-03
|
||||
1.073382E-03
|
||||
1.172758E-03
|
||||
9.827332E-04
|
||||
1.170009E-03
|
||||
9.507594E-04
|
||||
9.072590E-04
|
||||
1.009003E-03
|
||||
1.064703E-03
|
||||
1.163610E-03
|
||||
9.756308E-04
|
||||
cmfd dominance ratio
|
||||
0.000E+00
|
||||
0.000E+00
|
||||
0.000E+00
|
||||
0.000E+00
|
||||
5.397E-01
|
||||
5.425E-01
|
||||
5.481E-01
|
||||
|
|
@ -475,10 +459,6 @@ cmfd dominance ratio
|
|||
5.524E-01
|
||||
5.523E-01
|
||||
cmfd openmc source comparison
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
6.959834E-03
|
||||
5.655657E-03
|
||||
3.886185E-03
|
||||
|
|
|
|||
|
|
@ -1,6 +1,43 @@
|
|||
from tests.testing_harness import CMFDTestHarness
|
||||
|
||||
import openmc
|
||||
import numpy as np
|
||||
|
||||
def test_cmfd_feed():
|
||||
harness = CMFDTestHarness('statepoint.20.h5')
|
||||
# Initialize and set CMFD mesh
|
||||
cmfd_mesh = openmc.CMFDMesh()
|
||||
cmfd_mesh.lower_left = -10.0, -1.0, -1.0
|
||||
cmfd_mesh.upper_right = 10.0, 1.0, 1.0
|
||||
cmfd_mesh.dimension = 10, 1, 1
|
||||
cmfd_mesh.albedo = 0.0, 0.0, 1.0, 1.0, 1.0, 1.0
|
||||
|
||||
# Initialize and run CMFDRun object
|
||||
cmfd_run = openmc.CMFDRun()
|
||||
cmfd_run.cmfd_mesh = cmfd_mesh
|
||||
cmfd_run.cmfd_begin = 5
|
||||
cmfd_run.cmfd_display = 'dominance'
|
||||
cmfd_run.cmfd_feedback = True
|
||||
cmfd_run.gauss_seidel_tolerance = [1.e-15, 1.e-20]
|
||||
cmfd_run.run()
|
||||
|
||||
# Create output string of all CMFD results to pass into testing harness
|
||||
outstr = 'cmfd indices\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run._indices])
|
||||
outstr += '\nk cmfd\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run._k_cmfd])
|
||||
outstr += '\ncmfd entropy\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run._entropy])
|
||||
outstr += '\ncmfd balance\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run._balance])
|
||||
outstr += '\ncmfd dominance ratio\n'
|
||||
outstr += '\n'.join(['{0:10.3E}'.format(x) for x in cmfd_run._dom])
|
||||
outstr += '\ncmfd openmc source comparison\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run._src_cmp])
|
||||
outstr += '\ncmfd source\n'
|
||||
cmfdsrc = np.reshape(cmfd_run._cmfd_src, np.product(cmfd_run._indices),
|
||||
order='F')
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfdsrc])
|
||||
outstr += '\n'
|
||||
|
||||
# Initialize and run CMFD test harness
|
||||
harness = CMFDTestHarness('statepoint.20.h5', cmfd_results=outstr)
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<cmfd>
|
||||
|
||||
<mesh>
|
||||
<lower_left> -10 -1 -1 </lower_left>
|
||||
<upper_right> 10 1 1 </upper_right>
|
||||
<dimension> 10 1 1 </dimension>
|
||||
<albedo> 0.0 0.0 1.0 1.0 1.0 1.0 </albedo>
|
||||
</mesh>
|
||||
|
||||
<begin> 5 </begin>
|
||||
<display> dominance </display>
|
||||
<feedback> false </feedback>
|
||||
<gauss_seidel_tolerance> 1.e-15 1.e-20 </gauss_seidel_tolerance>
|
||||
|
||||
</cmfd>
|
||||
|
|
@ -391,10 +391,6 @@ cmfd indices
|
|||
1.000000E+00
|
||||
1.000000E+00
|
||||
k cmfd
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
1.170416E+00
|
||||
1.172572E+00
|
||||
1.171159E+00
|
||||
|
|
@ -412,10 +408,6 @@ k cmfd
|
|||
1.153714E+00
|
||||
1.159485E+00
|
||||
cmfd entropy
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
3.203643E+00
|
||||
3.204555E+00
|
||||
3.210935E+00
|
||||
|
|
@ -433,10 +425,6 @@ cmfd entropy
|
|||
3.221580E+00
|
||||
3.220523E+00
|
||||
cmfd balance
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
4.009062E-03
|
||||
4.869661E-03
|
||||
2.997290E-03
|
||||
|
|
@ -446,18 +434,14 @@ cmfd balance
|
|||
1.403979E-03
|
||||
1.398429E-03
|
||||
1.818398E-03
|
||||
1.761250E-03
|
||||
1.646649E-03
|
||||
1.480119E-03
|
||||
1.399559E-03
|
||||
1.400162E-03
|
||||
1.178363E-03
|
||||
1.292280E-03
|
||||
1.458254E-03
|
||||
1.437876E-03
|
||||
1.276844E-03
|
||||
1.289036E-03
|
||||
1.330300E-03
|
||||
1.139999E-03
|
||||
1.233647E-03
|
||||
cmfd dominance ratio
|
||||
0.000E+00
|
||||
0.000E+00
|
||||
0.000E+00
|
||||
0.000E+00
|
||||
5.397E-01
|
||||
5.405E-01
|
||||
5.412E-01
|
||||
|
|
@ -475,10 +459,6 @@ cmfd dominance ratio
|
|||
5.461E-01
|
||||
5.443E-01
|
||||
cmfd openmc source comparison
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
6.959834E-03
|
||||
5.494667E-03
|
||||
4.076255E-03
|
||||
|
|
|
|||
|
|
@ -1,6 +1,43 @@
|
|||
from tests.testing_harness import CMFDTestHarness
|
||||
|
||||
import openmc
|
||||
import numpy as np
|
||||
|
||||
def test_cmfd_nofeed():
|
||||
harness = CMFDTestHarness('statepoint.20.h5')
|
||||
# Initialize and set CMFD mesh
|
||||
cmfd_mesh = openmc.CMFDMesh()
|
||||
cmfd_mesh.lower_left = -10.0, -1.0, -1.0
|
||||
cmfd_mesh.upper_right = 10.0, 1.0, 1.0
|
||||
cmfd_mesh.dimension = 10, 1, 1
|
||||
cmfd_mesh.albedo = 0.0, 0.0, 1.0, 1.0, 1.0, 1.0
|
||||
|
||||
# Initialize and run CMFDRun object
|
||||
cmfd_run = openmc.CMFDRun()
|
||||
cmfd_run.cmfd_mesh = cmfd_mesh
|
||||
cmfd_run.cmfd_begin = 5
|
||||
cmfd_run.cmfd_display = 'dominance'
|
||||
cmfd_run.cmfd_feedback = False
|
||||
cmfd_run.gauss_seidel_tolerance = [1.e-15, 1.e-20]
|
||||
cmfd_run.run()
|
||||
|
||||
# Create output string of all CMFD results to pass into testing harness
|
||||
outstr = 'cmfd indices\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run._indices])
|
||||
outstr += '\nk cmfd\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run._k_cmfd])
|
||||
outstr += '\ncmfd entropy\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run._entropy])
|
||||
outstr += '\ncmfd balance\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run._balance])
|
||||
outstr += '\ncmfd dominance ratio\n'
|
||||
outstr += '\n'.join(['{0:10.3E}'.format(x) for x in cmfd_run._dom])
|
||||
outstr += '\ncmfd openmc source comparison\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run._src_cmp])
|
||||
outstr += '\ncmfd source\n'
|
||||
cmfdsrc = np.reshape(cmfd_run._cmfd_src, np.product(cmfd_run._indices),
|
||||
order='F')
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfdsrc])
|
||||
outstr += '\n'
|
||||
|
||||
# Initialize and run CMFD test harness
|
||||
harness = CMFDTestHarness('statepoint.20.h5', cmfd_results=outstr)
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -133,35 +133,37 @@ class HashedTestHarness(TestHarness):
|
|||
class CMFDTestHarness(TestHarness):
|
||||
"""Specialized TestHarness for running OpenMC CMFD tests."""
|
||||
|
||||
def _get_results(self):
|
||||
"""Digest info in the statepoint and return as a string."""
|
||||
def __init__(self, statepoint_name, cmfd_results=None):
|
||||
self._sp_name = statepoint_name
|
||||
self._cmfd_results = cmfd_results
|
||||
|
||||
# Write out the eigenvalue and tallies.
|
||||
outstr = super()._get_results()
|
||||
def execute_test(self):
|
||||
"""Don't call _run_openmc as OpenMC will be called through C API for
|
||||
CMFD tests, and write CMFD results that were passsed as argument
|
||||
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(self._sp_name)[0]
|
||||
with openmc.StatePoint(statepoint) as sp:
|
||||
# Write out CMFD data.
|
||||
outstr += 'cmfd indices\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp.cmfd_indices])
|
||||
outstr += '\nk cmfd\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp.k_cmfd])
|
||||
outstr += '\ncmfd entropy\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp.cmfd_entropy])
|
||||
outstr += '\ncmfd balance\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp.cmfd_balance])
|
||||
outstr += '\ncmfd dominance ratio\n'
|
||||
outstr += '\n'.join(['{0:10.3E}'.format(x) for x in sp.cmfd_dominance])
|
||||
outstr += '\ncmfd openmc source comparison\n'
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp.cmfd_srccmp])
|
||||
outstr += '\ncmfd source\n'
|
||||
cmfdsrc = np.reshape(sp.cmfd_src, np.product(sp.cmfd_indices),
|
||||
order='F')
|
||||
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfdsrc])
|
||||
outstr += '\n'
|
||||
"""
|
||||
try:
|
||||
self._test_output_created()
|
||||
results = self._get_results()
|
||||
results += self._cmfd_results
|
||||
self._write_results(results)
|
||||
self._compare_results()
|
||||
finally:
|
||||
self._cleanup()
|
||||
|
||||
return outstr
|
||||
def update_results(self):
|
||||
"""Don't call _run_openmc as OpenMC will be called through C API for
|
||||
CMFD tests, and write CMFD results that were passsed as argument
|
||||
|
||||
"""
|
||||
try:
|
||||
self._test_output_created()
|
||||
results = self._get_results()
|
||||
results += self._cmfd_results
|
||||
self._write_results(results)
|
||||
self._overwrite_results()
|
||||
finally:
|
||||
self._cleanup()
|
||||
|
||||
|
||||
class ParticleRestartTestHarness(TestHarness):
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ def test_export_to_xml(run_in_tmpdir):
|
|||
s.confidence_intervals = True
|
||||
s.cross_sections = '/path/to/cross_sections.xml'
|
||||
s.ptables = True
|
||||
s.run_cmfd = False
|
||||
s.seed = 17
|
||||
s.survival_biasing = True
|
||||
s.cutoff = {'weight': 0.25, 'weight_avg': 0.5, 'energy': 1.0e-5}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue