-
Notifications
You must be signed in to change notification settings - Fork 621
Approximate multigroup velocity #3766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 50 commits
3e45571
1d19ba0
6c51c14
51dfb76
3d22ce7
a1b09c2
7ac31b3
6e358d1
ba43542
59c0b50
6568952
fb469c6
5672eac
9ef5648
05abd9c
957d098
59b4c00
a954f5d
a78f7d6
a394950
68822cf
aa1703f
4998e8a
28c044f
58c0090
26e6c6d
4571f8d
2c98286
c4f149f
0c057df
db2c48c
1f653f7
e56b6ed
0854ff5
d5af24c
1861ab1
fe7e5a3
d4f7c34
f9a7e38
ab6c770
3d91c0d
c017a90
f8da4ff
f7b0fd4
efa9250
d16f89a
03af12d
2226113
76edf35
33b021b
874fcac
12b57f5
33f7e99
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -289,6 +289,47 @@ sections. This allows flexibility for the model to use highly anisotropic | |
| scattering information in the water while the fuel can be simulated with linear | ||
| or even isotropic scattering. | ||
|
|
||
| Particle Speed | ||
| -------------- | ||
|
|
||
| When using a multigroup representation of cross sections, the particle speed has | ||
| meaning only in an average sense. The particle speed is important when modeling | ||
| dynamic behavior. OpenMC calculates the particle speed using the inverse | ||
| velocity multigroup data if it is available. If such data is not available, | ||
| OpenMC uses an approximate velocity using the group energy bounds in the | ||
| following way: | ||
|
|
||
| .. math:: | ||
|
|
||
| \frac{1}{v_g} = \int_{E_{\text{min}}^g}^{E_{\text{max}}^g} \frac{1}{v(E)} \frac{k}{E} dE | ||
|
|
||
| Where :math:`E_{\text{min}}^g` and :math:`E_{\text{max}}^g` are the group energy | ||
| boundaries for group :math:`g`. :math:`v(E)` is the neutron velocity calculated | ||
| using relativistic kinematics, :math:`k` is a normalization constant for the | ||
| :math:`\frac{1}{E}` spectrum. | ||
|
|
||
| This equation is valid when inside the group boundaries the neutron spectrum | ||
| follows a typical :math:`\frac{1}{E}` slowing down spectrum. This assumption is | ||
| widely used when generating fine group neutron cross section data libraries from | ||
| continuous energy data. | ||
|
|
||
| The solution to this equation is: | ||
|
|
||
| .. math:: | ||
|
|
||
| v_g = \frac{1}{c \log\left(\frac{E_{\text{max}}^g}{E_{\text{min}}^g}\right)} | ||
| \left[ 2(\arctan(k_\text{max}) - \arctan(k_\text{min})) + (k_\text{max}-k_\text{min})) \right] | ||
|
||
|
|
||
| where :math:`k_{\text{max}}`, :math:`k_{\text{min}}` are defined by a change of | ||
| variables: | ||
|
|
||
| .. math:: | ||
|
|
||
| k = \sqrt{1+\frac{2 m_n}{E}} | ||
|
|
||
| where :math:`E` is the particle kinetic energy in [eV] and :math:`m_n` is the | ||
| neutron mass in units of [eV]. | ||
|
|
||
| .. _logarithmic mapping technique: | ||
| https://mcnp.lanl.gov/pdf_files/TechReport_2014_LANL_LA-UR-14-24530_Brown.pdf | ||
| .. _Hwang: https://doi.org/10.13182/NSE87-A16381 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import openmc | ||
| import numpy as np | ||
| import pytest | ||
|
|
||
| @pytest.fixture | ||
| def one_group_lib(): | ||
| groups = openmc.mgxs.EnergyGroups([0.0, 20.0e6]) | ||
| xsdata = openmc.XSdata('slab_mat', groups) | ||
| xsdata.order = 0 | ||
| xsdata.set_total([0.0]) | ||
| xsdata.set_absorption([0.0]) | ||
| xsdata.set_scatter_matrix([[[0.0]]]) | ||
|
|
||
| mg_library = openmc.MGXSLibrary(groups) | ||
| mg_library.add_xsdata(xsdata) | ||
| name = 'mgxs.h5' | ||
| mg_library.export_to_hdf5(name) | ||
| yield name | ||
|
|
||
| @pytest.fixture | ||
| def slab_model(one_group_lib): | ||
| model = openmc.Model() | ||
| mat = openmc.Material(name='slab_material') | ||
| mat.set_density('macro', 1.0) | ||
| mat.add_macroscopic('slab_mat') | ||
|
|
||
| model.materials = openmc.Materials([mat]) | ||
| model.materials.cross_sections = one_group_lib | ||
|
|
||
| x_min = openmc.XPlane(x0=0.0, boundary_type='vacuum') | ||
| x_max = openmc.XPlane(x0=10.0, boundary_type='vacuum') | ||
|
|
||
| y_min = openmc.YPlane(y0=-10.0, boundary_type='vacuum') | ||
| y_max = openmc.YPlane(y0=10.0, boundary_type='vacuum') | ||
| z_min = openmc.ZPlane(z0=-10.0, boundary_type='vacuum') | ||
| z_max = openmc.ZPlane(z0=19.0, boundary_type='vacuum') | ||
|
|
||
| cell = openmc.Cell(fill=mat, region=+z_min & -x_max & +y_min & -y_max & +z_min & -z_max) | ||
| model.geometry = openmc.Geometry([cell]) | ||
|
|
||
| model.settings = openmc.Settings() | ||
| model.settings.energy_mode = 'multi-group' | ||
| model.settings.run_mode = 'fixed source' | ||
| model.settings.batches = 3 | ||
| model.settings.particles = 10 | ||
|
|
||
| source = openmc.IndependentSource() | ||
| source.space = openmc.stats.Point((5.0, 0.0, 0.0)) | ||
| model.settings.source = source | ||
| return model | ||
|
|
||
| def test_inverse_velocity(run_in_tmpdir, slab_model): | ||
| tally = openmc.Tally() | ||
| tally.scores = ['flux','inverse-velocity'] | ||
| slab_model.tallies = [tally] | ||
| slab_model.run(apply_tally_results=True) | ||
| inverse_velocity = tally.mean.squeeze()[1]/tally.mean.squeeze()[0] | ||
|
|
||
| assert inverse_velocity == pytest.approx(1.6144e-5, rel=1e-4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add under what conditions this solution is derived. I could have added it but I want it to come from you so I dont incorrectly state the assumptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more item, add a statement in the docs/source/io_formats/mgxs_library.rst file, under inverse-velocity that says what happens when the value is not provided but a tally of such data is requested. Feel free to point to this cross_sections.rst as much as you wish.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.