Commit 1dd3ffbf authored by Sterling Harper's avatar Sterling Harper Committed by GitHub

Merge pull request #1236 from paulromano/thermal-elastic-bugfix

Bug fix: calculating thermal elastic scattering cross section
parents e252ff8e d1e051c8
include CMakeLists.txt
include LICENSE
include CODE_OF_CONDUCT.md
include CONTRIBUTING.md
include schemas.xml
include pyproject.toml
include pytest.ini
include openmc/data/reconstruct.pyx
include docs/source/_templates/layout.html
include docs/sphinxext/LICENSE
......@@ -33,4 +36,11 @@ recursive-include tests *.dat
recursive-include tests *.h5
recursive-include tests *.py
recursive-include tests *.xml
recursive-include vendor CMakeLists.txt
recursive-include vendor *.cmake.in
recursive-include vendor *.cc
recursive-include vendor *.cpp
recursive-include vendor *.hh
recursive-include vendor *.hpp
prune docs/build
prune docs/source/pythonapi/generated/
......@@ -86,7 +86,7 @@ Elastic Scattering
------------------
Note that the multi-group mode makes no distinction between elastic or
inelastic scattering reactions. The spceific multi-group scattering
inelastic scattering reactions. The specific multi-group scattering
implementation is discussed in the :ref:`multi-group-scatter` section.
Elastic scattering refers to the process by which a neutron scatters off a
......
......@@ -39,7 +39,13 @@ kwargs = {
'author': 'The OpenMC Development Team',
'author_email': 'openmc-dev@googlegroups.com',
'description': 'OpenMC',
'url': 'https://github.com/openmc-dev/openmc',
'url': 'https://openmc.org',
'download_url': 'https://github.com/openmc-dev/openmc/releases',
'project_urls': {
'Issue Tracker': 'https://github.com/openmc-dev/openmc/issues',
'Documentation': 'https://openmc.readthedocs.io',
'Source Code': 'https://github.com/openmc-dev/openmc',
},
'classifiers': [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
......@@ -48,6 +54,7 @@ kwargs = {
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Topic :: Scientific/Engineering'
'Programming Language :: C++',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
......@@ -55,13 +62,12 @@ kwargs = {
'Programming Language :: Python :: 3.7',
],
# Required dependencies
# Dependencies
'python_requires': '>=3.4',
'install_requires': [
'numpy>=1.9', 'h5py', 'scipy', 'ipython', 'matplotlib',
'pandas', 'lxml', 'uncertainties'
],
# Optional dependencies
'extras_require': {
'test': ['pytest', 'pytest-cov'],
'vtk': ['vtk'],
......
......@@ -400,7 +400,7 @@ void read_settings_xml()
SourceDistribution source {
UPtrSpace{new SpatialPoint({0.0, 0.0, 0.0})},
UPtrAngle{new Isotropic()},
UPtrDist{new Watt(0.988, 2.249e-6)}
UPtrDist{new Watt(0.988e6, 2.249e-6)}
};
model::external_sources.push_back(std::move(source));
}
......
......@@ -199,10 +199,10 @@ ThermalScattering::calculate_xs(double E, double sqrtkT, int* i_temp,
// Calculate S(a,b) inelastic scattering cross section
auto& xs = sab.inelastic_sigma_;
*inelastic = (1.0 - f) * xs[i_grid] + f * xs[i_grid + 1];
*inelastic = xs[i_grid] + f * (xs[i_grid + 1] - xs[i_grid]);
// Check for elastic data
if (E < sab.threshold_elastic_) {
if (!sab.elastic_e_in_.empty()) {
// Determine whether elastic scattering is given in the coherent or
// incoherent approximation. For coherent, the cross section is
// represented as P/E whereas for incoherent, it is simply P
......@@ -231,7 +231,7 @@ ThermalScattering::calculate_xs(double E, double sqrtkT, int* i_temp,
// Calculate S(a,b) elastic scattering cross section
auto& xs = sab.elastic_P_;
*elastic = (1.0 - f) * xs[i_grid] + f * xs[i_grid + 1];
*elastic = xs[i_grid] + f*(xs[i_grid + 1] - xs[i_grid]);
}
} else {
// No elastic data
......
4b75e203d06d0fc1b4c4dfcb8c180d6f3df8fa2bc44e9775b59bbfd8f7a3785f956f9a9f301526f69c0f8a963ce2e553e0c62c7f6c696656ce1d47b415af6076
\ No newline at end of file
4401f503237c94e9d9cfc9f60e0269d5ae5bb67be3225e18c5510ed08616482964e2962a06268751f66a455fac3ddd5faf91555638dfb56fcd09eee60219edff
\ No newline at end of file
k-combined:
1.038883E+00 1.017026E-02
1.038883E+00 1.017030E-02
tally 1:
1.167304E+02
1.362680E+03
......@@ -49,7 +49,7 @@ tally 3:
0.000000E+00
2.033842E-02
4.375294E-05
4.296338E+00
4.296339E+00
9.280716E-01
3.493776E+00
6.157094E-01
......@@ -74,7 +74,7 @@ tally 3:
9.717439E+01
4.724254E+02
8.435691E-01
3.666151E-02
3.666152E-02
6.192881E+01
1.924016E+02
0.000000E+00
......@@ -82,7 +82,7 @@ tally 3:
1.796382E-02
3.190854E-05
4.343238E+00
9.514039E-01
9.514040E-01
3.504683E+00
6.157615E-01
0.000000E+00
......@@ -106,7 +106,7 @@ tally 3:
9.885292E+01
4.888720E+02
9.509199E-01
4.670951E-02
4.670952E-02
tally 4:
0.000000E+00
0.000000E+00
......@@ -383,7 +383,7 @@ cmfd balance
1.08402E-03
1.09178E-03
5.45977E-04
4.45554E-04
4.45555E-04
4.01147E-04
3.71025E-04
3.57715E-04
......
k-combined:
1.029540E+00 1.765356E-02
1.029540E+00 1.765357E-02
tally 1:
1.144958E+02
1.311468E+03
......@@ -93,7 +93,7 @@ tally 3:
0.000000E+00
6.939496E+01
3.014077E+02
6.294738E-01
6.294737E-01
2.532146E-02
4.991526E+01
1.566280E+02
......@@ -129,7 +129,7 @@ tally 3:
0.000000E+00
6.885265E+01
2.965191E+02
6.537576E-01
6.537575E-01
2.783733E-02
4.958341E+01
1.546656E+02
......
......@@ -39,7 +39,7 @@
<nuclide ao="0.0049817" name="U235" />
</material>
<material id="14">
<density units="atom/b-cm" value="0.087742" />
<density units="atom/b-cm" value="0.017742" />
<nuclide ao="1.0" name="C0" />
<sab name="c_Graphite" />
</material>
......@@ -67,8 +67,8 @@
<settings>
<run_mode>eigenvalue</run_mode>
<particles>1000</particles>
<batches>10</batches>
<inactive>5</inactive>
<batches>5</batches>
<inactive>2</inactive>
<source strength="1.0">
<space type="box">
<parameters>-0.9899494936611666 -0.9899494936611666 0.0 0.9899494936611666 0.9899494936611666 10.0</parameters>
......
k-combined:
1.741370E+00 1.384609E-03
1.910374E+00 2.685991E-02
import numpy as np
from math import sqrt
import openmc
from tests.testing_harness import PyAPITestHarness
......@@ -13,7 +14,7 @@ class HexLatticeCoincidentTestHarness(PyAPITestHarness):
materials.append(fuel_mat)
matrix = openmc.Material()
matrix.set_density('atom/b-cm', 8.7742E-02)
matrix.set_density('atom/b-cm', 1.7742E-02)
matrix.add_element('C', 1.0, 'ao')
matrix.add_s_alpha_beta('c_Graphite')
materials.append(matrix)
......@@ -94,7 +95,7 @@ class HexLatticeCoincidentTestHarness(PyAPITestHarness):
coolant_univ.add_cells(coolant_channel)
half_width = assembly_pitch # cm
edge_length = (2./np.sqrt(3.0)) * half_width
edge_length = (2./sqrt(3.0)) * half_width
inf_mat = openmc.Cell()
inf_mat.fill = matrix
......@@ -132,19 +133,19 @@ class HexLatticeCoincidentTestHarness(PyAPITestHarness):
settings.run_mode = 'eigenvalue'
source = openmc.Source()
corner_dist = np.sqrt(2) * pin_rad
corner_dist = sqrt(2) * pin_rad
ll = [-corner_dist, -corner_dist, 0.0]
ur = [corner_dist, corner_dist, 10.0]
source.space = openmc.stats.Box(ll, ur)
source.strength = 1.0
settings.source = source
settings.output = {'summary' : False}
settings.batches = 10
settings.inactive = 5
settings.batches = 5
settings.inactive = 2
settings.particles = 1000
settings.seed = 22
settings.export_to_xml()
def test_lattice_hex_coincident_surf():
harness = HexLatticeCoincidentTestHarness('statepoint.10.h5')
harness = HexLatticeCoincidentTestHarness('statepoint.5.h5')
harness.main()
......@@ -49,7 +49,7 @@
<?xml version='1.0' encoding='utf-8'?>
<settings>
<run_mode>eigenvalue</run_mode>
<particles>1000</particles>
<particles>400</particles>
<batches>5</batches>
<inactive>0</inactive>
<source strength="1.0">
......
k-combined:
8.403447E-01 2.461538E-02
8.474822E-01 1.767966E-02
......@@ -66,7 +66,7 @@ def make_model():
# Settings
model.settings.batches = 5
model.settings.inactive = 0
model.settings.particles = 1000
model.settings.particles = 400
model.settings.source = openmc.Source(space=openmc.stats.Box(
[-4, -4, -4], [4, 4, 4]))
......
k-combined:
1.707485E+00 9.795497E-02
1.701412E+00 3.180881E-02
k-combined:
1.062505E+00 2.674375E-02
9.612556E-01 1.990135E-02
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment