mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Merge pull request #1135 from paulromano/resample-fix
Make sure fission neutron energy is resampled if > max energy
This commit is contained in:
commit
da750d4e49
3 changed files with 7 additions and 3 deletions
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@
|
|||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#ifdef _OPENMP
|
||||
#include <omp.h>
|
||||
#endif
|
||||
|
||||
#include "openmc/capi.h"
|
||||
#include "openmc/constants.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue