mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -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/mg_basic/__init__.py
Normal file
0
tests/regression_tests/mg_basic/__init__.py
Normal file
64
tests/regression_tests/mg_basic/inputs_true.dat
Normal file
64
tests/regression_tests/mg_basic/inputs_true.dat
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<geometry>
|
||||
<cell id="1" material="1" region="1 -2" universe="0" />
|
||||
<cell id="2" material="2" region="2 -3" universe="0" />
|
||||
<cell id="3" material="3" region="3 -4" universe="0" />
|
||||
<cell id="4" material="4" region="4 -5" universe="0" />
|
||||
<cell id="5" material="5" region="5 -6" universe="0" />
|
||||
<cell id="6" material="6" region="6 -7" universe="0" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="1" type="x-plane" />
|
||||
<surface coeffs="154.90833333333333" id="2" type="x-plane" />
|
||||
<surface coeffs="309.81666666666666" id="3" type="x-plane" />
|
||||
<surface coeffs="464.725" id="4" type="x-plane" />
|
||||
<surface coeffs="619.6333333333333" id="5" type="x-plane" />
|
||||
<surface coeffs="774.5416666666666" id="6" type="x-plane" />
|
||||
<surface boundary="vacuum" coeffs="929.45" id="7" type="x-plane" />
|
||||
</geometry>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<materials>
|
||||
<cross_sections>2g.h5</cross_sections>
|
||||
<material id="1" name="base leg">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="mat_1" />
|
||||
</material>
|
||||
<material id="2" name="base tab">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="mat_2" />
|
||||
</material>
|
||||
<material id="3" name="base hist">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="mat_3" />
|
||||
</material>
|
||||
<material id="4" name="base matrix">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="mat_4" />
|
||||
</material>
|
||||
<material id="5" name="base ang">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="mat_5" />
|
||||
</material>
|
||||
<material id="6" name="micro">
|
||||
<density units="sum" />
|
||||
<nuclide ao="0.5" name="mat_1" />
|
||||
<nuclide ao="0.5" name="mat_6" />
|
||||
</material>
|
||||
</materials>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<settings>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<particles>1000</particles>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<source strength="1.0">
|
||||
<space type="box">
|
||||
<parameters>0.0 -1000.0 -1000.0 154.90833333333333 1000.0 1000.0</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<output>
|
||||
<summary>false</summary>
|
||||
</output>
|
||||
<energy_mode>multi-group</energy_mode>
|
||||
<tabular_legendre>
|
||||
<enable>false</enable>
|
||||
</tabular_legendre>
|
||||
</settings>
|
||||
2
tests/regression_tests/mg_basic/results_true.dat
Normal file
2
tests/regression_tests/mg_basic/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
1.005345E+00 1.109180E-02
|
||||
97
tests/regression_tests/mg_basic/test.py
Normal file
97
tests/regression_tests/mg_basic/test.py
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
import os
|
||||
|
||||
import numpy as np
|
||||
|
||||
import openmc
|
||||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
def create_library():
|
||||
# Instantiate the energy group data and file object
|
||||
groups = openmc.mgxs.EnergyGroups(group_edges=[0.0, 0.625, 20.0e6])
|
||||
|
||||
mg_cross_sections_file = openmc.MGXSLibrary(groups)
|
||||
|
||||
# Make the base, isotropic data
|
||||
nu = [2.50, 2.50]
|
||||
fiss = np.array([0.002817, 0.097])
|
||||
capture = [0.008708, 0.02518]
|
||||
absorption = np.add(capture, fiss)
|
||||
scatter = np.array(
|
||||
[[[0.31980, 0.06694], [0.004555, -0.0003972]],
|
||||
[[0.00000, 0.00000], [0.424100, 0.05439000]]])
|
||||
total = [0.33588, 0.54628]
|
||||
chi = [1., 0.]
|
||||
|
||||
mat_1 = openmc.XSdata('mat_1', groups)
|
||||
mat_1.order = 1
|
||||
mat_1.set_nu_fission(np.multiply(nu, fiss))
|
||||
mat_1.set_absorption(absorption)
|
||||
mat_1.set_scatter_matrix(scatter)
|
||||
mat_1.set_total(total)
|
||||
mat_1.set_chi(chi)
|
||||
mg_cross_sections_file.add_xsdata(mat_1)
|
||||
|
||||
# Make a version of mat-1 which has a tabular representation of the
|
||||
# scattering vice Legendre with 33 points
|
||||
mat_2 = mat_1.convert_scatter_format('tabular', 33)
|
||||
mat_2.name = 'mat_2'
|
||||
mg_cross_sections_file.add_xsdata(mat_2)
|
||||
|
||||
# Make a version of mat-1 which has a histogram representation of the
|
||||
# scattering vice Legendre with 33 bins
|
||||
mat_3 = mat_1.convert_scatter_format('histogram', 33)
|
||||
mat_3.name = 'mat_3'
|
||||
mg_cross_sections_file.add_xsdata(mat_3)
|
||||
|
||||
# Make a version which uses a fission matrix vice chi & nu-fission
|
||||
mat_4 = openmc.XSdata('mat_4', groups)
|
||||
mat_4.order = 1
|
||||
mat_4.set_nu_fission(np.outer(np.multiply(nu, fiss), chi))
|
||||
mat_4.set_absorption(absorption)
|
||||
mat_4.set_scatter_matrix(scatter)
|
||||
mat_4.set_total(total)
|
||||
mg_cross_sections_file.add_xsdata(mat_4)
|
||||
|
||||
# Make an angle-dependent version of mat_1 with 2 polar and 2 azim. angles
|
||||
mat_5 = mat_1.convert_representation('angle', 2, 2)
|
||||
mat_5.name = 'mat_5'
|
||||
mg_cross_sections_file.add_xsdata(mat_5)
|
||||
|
||||
# Make a copy of mat_1 for testing microscopic cross sections
|
||||
mat_6 = openmc.XSdata('mat_6', groups)
|
||||
mat_6.order = 1
|
||||
mat_6.set_nu_fission(np.multiply(nu, fiss))
|
||||
mat_6.set_absorption(absorption)
|
||||
mat_6.set_scatter_matrix(scatter)
|
||||
mat_6.set_total(total)
|
||||
mat_6.set_chi(chi)
|
||||
mg_cross_sections_file.add_xsdata(mat_6)
|
||||
|
||||
# Write the file
|
||||
mg_cross_sections_file.export_to_hdf5('2g.h5')
|
||||
|
||||
|
||||
class MGXSTestHarness(PyAPITestHarness):
|
||||
def _cleanup(self):
|
||||
super()._cleanup()
|
||||
f = '2g.h5'
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
||||
|
||||
def test_mg_basic():
|
||||
create_library()
|
||||
mat_names = ['base leg', 'base tab', 'base hist', 'base matrix',
|
||||
'base ang', 'micro']
|
||||
model = slab_mg(num_regions=6, mat_names=mat_names)
|
||||
# Modify the last material to be a microscopic combination of nuclides
|
||||
model.materials[-1] = openmc.Material(name='micro', material_id=6)
|
||||
model.materials[-1].set_density("sum")
|
||||
model.materials[-1].add_nuclide("mat_1", 0.5)
|
||||
model.materials[-1].add_nuclide("mat_6", 0.5)
|
||||
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue