Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,589 changes: 3,589 additions & 0 deletions include/openmc/atomic_mass.h

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions include/openmc/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <limits>

#include "openmc/array.h"
#include "openmc/atomic_mass.h"
#include "openmc/vector.h"
#include "openmc/version.h"

Expand Down Expand Up @@ -86,12 +87,12 @@ constexpr double INFTY {std::numeric_limits<double>::max()};
// (CODATA) 2018 recommendation (https://physics.nist.gov/cuu/Constants/).

// Physical constants
constexpr double MASS_NEUTRON {1.00866491595}; // mass of a neutron in amu
constexpr double AMU_EV {
9.3149410242e8}; // atomic mass unit energy equivalent in eV/c^2
constexpr double MASS_NEUTRON_EV {
939.56542052e6}; // mass of a neutron in eV/c^2
constexpr double MASS_PROTON {1.007276466621}; // mass of a proton in amu
MASS_NEUTRON * AMU_EV}; // neutron mass energy equivalent in eV/c^2
Comment thread
GuySten marked this conversation as resolved.
Outdated
constexpr double MASS_ELECTRON_EV {
0.51099895000e6}; // electron mass energy equivalent in eV/c^2
MASS_ELECTRON * AMU_EV}; // electron mass energy equivalent in eV/c^2
constexpr double FINE_STRUCTURE {
137.035999084}; // inverse fine structure constant
constexpr double PLANCK_C {
Expand Down
12 changes: 12 additions & 0 deletions include/openmc/particle_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <type_traits>

#include "openmc/constants.h"
#include "openmc/error.h"

namespace openmc {

Expand Down Expand Up @@ -61,6 +62,17 @@ class ParticleType {
//----------------------------------------------------------------------------
// Methods

// Get particle mass
double mass() const
{
int32_t p = std::abs(pdg_number_);
if (atomic_mass.count(p)) {
return atomic_mass[p];
} else {
fatal_error("Unknown mass for particle " + str());
}
}

// Convert to string representation
std::string str() const;

Expand Down
16 changes: 1 addition & 15 deletions src/particle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,7 @@ double Particle::speed() const
{
if (settings::run_CE) {
// Determine mass in eV/c^2
double mass;
switch (this->type().pdg_number()) {
case PDG_NEUTRON:
mass = MASS_NEUTRON_EV;
break;
case PDG_PHOTON:
mass = 0.0;
break;
case PDG_ELECTRON:
case PDG_POSITRON:
mass = MASS_ELECTRON_EV;
break;
default:
fatal_error("Unsupported particle for speed calculation.");
}
double mass = this->type().mass() * AMU_EV;
// Equivalent to C * sqrt(1-(m/(m+E))^2) without problem at E<<m:
return C_LIGHT * std::sqrt(this->E() * (this->E() + 2 * mass)) /
(this->E() + mass);
Expand Down
2 changes: 1 addition & 1 deletion tests/regression_tests/cmfd_feed_2g/results_true.dat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
k-combined:
1.027434E+00 6.509170E-03
1.027434E+00 6.509157E-03
tally 1:
1.162758E+02
1.352562E+03
Expand Down
2 changes: 1 addition & 1 deletion tests/regression_tests/cmfd_feed_ng/results_true.dat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
k-combined:
1.008852E+00 9.028695E-03
1.008852E+00 9.028696E-03
tally 1:
1.151271E+02
1.325871E+03
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Binary file modified tests/regression_tests/deplete_with_transport/test_reference.h5
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/regression_tests/filter_mesh/results_true.dat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e07ed2bc8893c69721abf61b123336f1f6128a3bee6ec63b84d1f549f31707a74a6ce885091ccc0eac6b7f16f7cab39ede4784584c08825829e108de878ea5fb
749d980164f4b587cd4af455c8fb214d26dbe8c14a114dc5faa96ca95f9198199e55fb86b1eb0d4038b41bbbc9dfb6d754fb21b1b655ba396530edfacbe51a54
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
nuclides,reactions,groups,xs
U235,"(n,gamma)",1,0.1475718536187164
U235,fission,1,1.2504996049257149
O16,"(n,gamma)",1,0.00010981236259441559
U235,"(n,gamma)",1,0.14757185361871647
U235,fission,1,1.2504996049257133
O16,"(n,gamma)",1,0.00010981236259441548
O16,fission,1,0.0
Xe135,"(n,gamma)",1,0.014570546772870611
Xe135,"(n,gamma)",1,0.014570546772870624
Xe135,fission,1,0.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
nuclides,reactions,groups,xs
U235,"(n,gamma)",1,0.15003016703758473
U235,fission,1,1.2646269005413537
O16,"(n,gamma)",1,0.00012069778439640301
U235,"(n,gamma)",1,0.15003016703758476
U235,fission,1,1.2646269005413535
O16,"(n,gamma)",1,0.00012069778439640315
O16,fission,1,0.0
Xe135,"(n,gamma)",1,0.014820264774863562
Xe135,fission,1,0.0
8 changes: 4 additions & 4 deletions tests/regression_tests/microxs/test_reference_mesh_direct.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
nuclides,reactions,groups,xs
U235,"(n,gamma)",1,0.14757185361871633
U235,fission,1,1.2504996049257142
O16,"(n,gamma)",1,0.0001098123625944155
U235,"(n,gamma)",1,0.14757185361871636
U235,fission,1,1.250499604925713
O16,"(n,gamma)",1,0.00010981236259441542
O16,fission,1,0.0
Xe135,"(n,gamma)",1,0.0145705467728706
Xe135,"(n,gamma)",1,0.014570546772870606
Xe135,fission,1,0.0
6 changes: 3 additions & 3 deletions tests/regression_tests/microxs/test_reference_mesh_flux.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
nuclides,reactions,groups,xs
U235,"(n,gamma)",1,0.15003016703758473
U235,fission,1,1.2646269005413537
O16,"(n,gamma)",1,0.00012069778439640301
U235,fission,1,1.2646269005413535
O16,"(n,gamma)",1,0.00012069778439640312
O16,fission,1,0.0
Xe135,"(n,gamma)",1,0.014820264774863562
Xe135,"(n,gamma)",1,0.01482026477486356
Xe135,fission,1,0.0
4 changes: 2 additions & 2 deletions tests/regression_tests/pulse_height/results_true.dat
Original file line number Diff line number Diff line change
Expand Up @@ -197,5 +197,5 @@ tally 1:
0.000000E+00
0.000000E+00
0.000000E+00
2.000000E-01
8.600000E-03
1.900000E-01
7.500000E-03
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ tally 1:
0.000000E+00
0.000000E+00
0.000000E+00
9.248400E-01
9.248399E-01
1.710699E-01
0.000000E+00
0.000000E+00
Expand Down Expand Up @@ -148,7 +148,7 @@ tally 1:
9.272977E-01
1.721077E-01
3.161443E-02
2.000179E-04
2.000180E-04
2.002789E-07
8.027290E-15
8.778794E-01
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tally 1:
1.707007E-02
5.933921E-05
4.154514E-02
3.514889E-04
3.514888E-04
1.513147E+00
4.652938E-01
1.810962E-02
Expand All @@ -34,7 +34,7 @@ tally 1:
4.347893E+00
3.798064E+00
6.851785E-03
9.430195E-06
9.430194E-06
1.695426E-02
5.773923E-05
2.809071E+00
Expand Down Expand Up @@ -152,7 +152,7 @@ tally 1:
4.036663E-02
3.323832E-04
1.516801E+00
4.675245E-01
4.675244E-01
1.752096E-02
6.241641E-05
4.264304E-02
Expand Down
6 changes: 3 additions & 3 deletions tests/regression_tests/random_ray_k_eff/results_true.dat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
k-combined:
8.400321E-01 8.023357E-03
8.400321E-01 8.023358E-03
tally 1:
1.075769E+00
2.317354E-01
Expand Down Expand Up @@ -28,7 +28,7 @@ tally 1:
1.509054E+00
4.629325E-01
1.749679E-02
6.226587E-05
6.226588E-05
4.258421E-02
3.688336E-04
4.322054E+00
Expand Down Expand Up @@ -131,7 +131,7 @@ tally 1:
2.304093E-01
4.053505E-01
3.291277E-02
9.865420E-01
9.865421E-01
1.949549E-01
6.047420E-01
7.327008E-02
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
k-combined:
8.379203E-01 8.057199E-03
8.379203E-01 8.057198E-03
tally 1:
1.073897E+00
2.309328E-01
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ tally 1:
1.746692E+00
1.536860E-01
4.251098E+00
9.103405E-01
9.103406E-01
3.651202E+00
6.682179E-01
5.431675E-01
Expand Down
Binary file modified tests/regression_tests/surface_source/surface_source_true.h5
Binary file not shown.
Binary file modified tests/regression_tests/surface_source/surface_source_true.mcpl
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/regression_tests/triso/results_true.dat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
k-combined:
1.604832E+00 2.031393E-03
1.604832E+00 2.031398E-03
Loading