Dear Users and Professors,
when I use a Filesource written myself, it teminate as " terminate called after throwing an instance of ‘std::runtime_error’ ", as in follow pictures.
The error was:
RuntimeError: Did not sample any nuclide during collision.
I give a constraints in Energy: constriants={‘energy_bounds’:[0, 10e6]}, however it did not work.
int sample_nuclide(Particle& p)
{
// Sample cumulative distribution function
double cutoff = prn(p.current_seed()) * p.macro_xs().total;
// Get pointers to nuclide/density arrays
const auto& mat {model::materials[p.material()]};
int n = mat->nuclide_.size();
double prob = 0.0;
for (int i = 0; i < n; ++i) {
// Get atom density
int i_nuclide = mat->nuclide_[i];
double atom_density = mat->atom_density_[i];
// Increment probability to compare to cutoff
prob += atom_density * p.neutron_xs(i_nuclide).total;
if (prob >= cutoff)
return i_nuclide;
}
// If we reach here, no nuclide was sampled
p.write_restart();
throw std::runtime_error {"Did not sample any nuclide during collision."};
}
Just trying to track down from where the error is happening. when that sample_nuclide()
method is called it finds a nuclide with in any material (given that your material has multiple nuclides) for collision sampling. The thing is prob += atom_density * p.neutron_xs(i_nuclide).total;
is not crossing the cut_off
value. I guess the main reason is p.neutron_xs(i_nuclide)
maybe getting a zero value. So the main problem might be cross section data.
Try to look if that thing is set correctly. Or maybe try to run the simulation using a different seed (this one is just my wild guess)
Sorry if that doesn’t help.
Thanks a lot, I will try.