Merge pull request #1135 from paulromano/resample-fix

Make sure fission neutron energy is resampled if > max energy
This commit is contained in:
Adam Nelson 2018-12-05 12:49:45 -05:00 committed by GitHub
commit da750d4e49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View file

@ -121,7 +121,7 @@ def find_material(xyz):
_dll.openmc_find_cell((c_double*3)(*xyz), index, instance)
mats = openmc.capi.Cell(index=index.value).fill
if isinstance(mats, openmc.capi.Material):
if isinstance(mats, (openmc.capi.Material, type(None))):
return mats
else:
return mats[instance.value]

View file

@ -1057,7 +1057,8 @@ void sample_fission_neutron(int i_nuclide, const Reaction* rx, double E_in, Bank
rx->products_[group].sample(E_in, site->E, mu);
// resample if energy is greater than maximum neutron energy
constexpr int neutron = static_cast<int>(ParticleType::neutron);
// TODO: off-by-one
constexpr int neutron = static_cast<int>(ParticleType::neutron) - 1;
if (site->E < data::energy_max[neutron]) break;
// check for large number of resamples
@ -1082,7 +1083,8 @@ void sample_fission_neutron(int i_nuclide, const Reaction* rx, double E_in, Bank
rx->products_[0].sample(E_in, site->E, mu);
// resample if energy is greater than maximum neutron energy
constexpr int neutron = static_cast<int>(ParticleType::neutron);
// TODO: off-by-one
constexpr int neutron = static_cast<int>(ParticleType::neutron) - 1;
if (site->E < data::energy_max[neutron]) break;
// check for large number of resamples

View file

@ -5,7 +5,9 @@
#include <sstream>
#include <string>
#ifdef _OPENMP
#include <omp.h>
#endif
#include "openmc/capi.h"
#include "openmc/constants.h"