mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -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_delayed/__init__.py
Normal file
0
tests/regression_tests/mg_basic_delayed/__init__.py
Normal file
63
tests/regression_tests/mg_basic_delayed/inputs_true.dat
Normal file
63
tests/regression_tests/mg_basic_delayed/inputs_true.dat
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?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="vec beta">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="mat_1" />
|
||||
</material>
|
||||
<material id="2" name="vec no beta">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="mat_2" />
|
||||
</material>
|
||||
<material id="3" name="matrix beta">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="mat_3" />
|
||||
</material>
|
||||
<material id="4" name="matrix no beta">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="mat_4" />
|
||||
</material>
|
||||
<material id="5" name="vec group beta">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="mat_5" />
|
||||
</material>
|
||||
<material id="6" name="matrix group beta">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic 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_delayed/results_true.dat
Normal file
2
tests/regression_tests/mg_basic_delayed/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
1.003463E+00 2.173155E-02
|
||||
131
tests/regression_tests/mg_basic_delayed/test.py
Normal file
131
tests/regression_tests/mg_basic_delayed/test.py
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
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])
|
||||
n_dg = 2
|
||||
|
||||
mg_cross_sections_file = openmc.MGXSLibrary(groups)
|
||||
mg_cross_sections_file.num_delayed_groups = n_dg
|
||||
|
||||
beta = np.array([0.003, 0.003])
|
||||
one_m_beta = 1. - np.sum(beta)
|
||||
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.]
|
||||
|
||||
# Make the base data that uses chi & nu-fission vectors with a beta
|
||||
mat_1 = openmc.XSdata('mat_1', groups)
|
||||
mat_1.order = 1
|
||||
mat_1.num_delayed_groups = 2
|
||||
mat_1.set_beta(beta)
|
||||
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 that uses prompt and delayed version of nufiss and chi
|
||||
mat_2 = openmc.XSdata('mat_2', groups)
|
||||
mat_2.order = 1
|
||||
mat_2.num_delayed_groups = 2
|
||||
mat_2.set_prompt_nu_fission(one_m_beta * np.multiply(nu, fiss))
|
||||
delay_nu_fiss = np.zeros((n_dg, groups.num_groups))
|
||||
for dg in range(n_dg):
|
||||
for g in range(groups.num_groups):
|
||||
delay_nu_fiss[dg, g] = beta[dg] * nu[g] * fiss[g]
|
||||
mat_2.set_delayed_nu_fission(delay_nu_fiss)
|
||||
mat_2.set_absorption(absorption)
|
||||
mat_2.set_scatter_matrix(scatter)
|
||||
mat_2.set_total(total)
|
||||
mat_2.set_chi_prompt(chi)
|
||||
mat_2.set_chi_delayed(np.stack([chi] * n_dg))
|
||||
mg_cross_sections_file.add_xsdata(mat_2)
|
||||
|
||||
# Make a version that uses a nu-fission matrix with a beta
|
||||
mat_3 = openmc.XSdata('mat_3', groups)
|
||||
mat_3.order = 1
|
||||
mat_3.num_delayed_groups = 2
|
||||
mat_3.set_beta(beta)
|
||||
mat_3.set_nu_fission(np.outer(np.multiply(nu, fiss), chi))
|
||||
mat_3.set_absorption(absorption)
|
||||
mat_3.set_scatter_matrix(scatter)
|
||||
mat_3.set_total(total)
|
||||
mg_cross_sections_file.add_xsdata(mat_3)
|
||||
|
||||
# Make a version that uses prompt and delayed version of the nufiss matrix
|
||||
mat_4 = openmc.XSdata('mat_4', groups)
|
||||
mat_4.order = 1
|
||||
mat_4.num_delayed_groups = 2
|
||||
mat_4.set_prompt_nu_fission(one_m_beta *
|
||||
np.outer(np.multiply(nu, fiss), chi))
|
||||
delay_nu_fiss = np.zeros((n_dg, groups.num_groups, groups.num_groups))
|
||||
for dg in range(n_dg):
|
||||
for g in range(groups.num_groups):
|
||||
for go in range(groups.num_groups):
|
||||
delay_nu_fiss[dg, g, go] = beta[dg] * nu[g] * fiss[g] * chi[go]
|
||||
mat_4.set_delayed_nu_fission(delay_nu_fiss)
|
||||
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 the base data that uses chi & nu-fiss vectors with a group-wise beta
|
||||
mat_5 = openmc.XSdata('mat_5', groups)
|
||||
mat_5.order = 1
|
||||
mat_5.num_delayed_groups = 2
|
||||
mat_5.set_beta(np.stack([beta] * groups.num_groups))
|
||||
mat_5.set_nu_fission(np.multiply(nu, fiss))
|
||||
mat_5.set_absorption(absorption)
|
||||
mat_5.set_scatter_matrix(scatter)
|
||||
mat_5.set_total(total)
|
||||
mat_5.set_chi(chi)
|
||||
mg_cross_sections_file.add_xsdata(mat_5)
|
||||
|
||||
# Make a version that uses a nu-fission matrix with a group-wise beta
|
||||
mat_6 = openmc.XSdata('mat_6', groups)
|
||||
mat_6.order = 1
|
||||
mat_6.num_delayed_groups = 2
|
||||
mat_6.set_beta(np.stack([beta] * groups.num_groups))
|
||||
mat_6.set_nu_fission(np.outer(np.multiply(nu, fiss), chi))
|
||||
mat_6.set_absorption(absorption)
|
||||
mat_6.set_scatter_matrix(scatter)
|
||||
mat_6.set_total(total)
|
||||
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_delayed():
|
||||
create_library()
|
||||
model = slab_mg(num_regions=6, mat_names=['vec beta', 'vec no beta',
|
||||
'matrix beta', 'matrix no beta',
|
||||
'vec group beta',
|
||||
'matrix group beta'])
|
||||
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue