Fix delayed group indexing errors

This commit is contained in:
Paul Romano 2019-11-07 10:47:54 -06:00
parent 8a449666bc
commit 9409f0ff8f
2 changed files with 14 additions and 20 deletions

View file

@ -548,8 +548,7 @@ Mgxs::sample_fission_energy(int gin, int& dg, int& gout)
double nu_fission = xs_t->nu_fission(cache[tid].a, gin);
// Find the probability of having a prompt neutron
double prob_prompt =
xs_t->prompt_nu_fission(cache[tid].a, gin);
double prob_prompt = xs_t->prompt_nu_fission(cache[tid].a, gin);
// sample random numbers
double xi_pd = prn() * nu_fission;
@ -564,8 +563,7 @@ Mgxs::sample_fission_energy(int gin, int& dg, int& gout)
// sample the outgoing energy group
gout = 0;
double prob_gout =
xs_t->chi_prompt(cache[tid].a, gin, gout);
double prob_gout = xs_t->chi_prompt(cache[tid].a, gin, gout);
while (prob_gout < xi_gout) {
gout++;
prob_gout += xs_t->chi_prompt(cache[tid].a, gin, gout);
@ -575,11 +573,9 @@ Mgxs::sample_fission_energy(int gin, int& dg, int& gout)
// the neutron is delayed
// get the delayed group
dg = 0;
while (xi_pd >= prob_prompt) {
dg++;
prob_prompt +=
xs_t->delayed_nu_fission(cache[tid].a, dg, gin);
for (dg = 0; dg < num_delayed_groups; ++dg) {
prob_prompt += xs_t->delayed_nu_fission(cache[tid].a, dg, gin);
if (xi_pd < prob_prompt) break;
}
// adjust dg in case of round-off error
@ -587,12 +583,10 @@ Mgxs::sample_fission_energy(int gin, int& dg, int& gout)
// sample the outgoing energy group
gout = 0;
double prob_gout =
xs_t->chi_delayed(cache[tid].a, dg, gin, gout);
double prob_gout = xs_t->chi_delayed(cache[tid].a, dg, gin, gout);
while (prob_gout < xi_gout) {
gout++;
prob_gout +=
xs_t->chi_delayed(cache[tid].a, dg, gin, gout);
prob_gout += xs_t->chi_delayed(cache[tid].a, dg, gin, gout);
}
}
}

View file

@ -1720,7 +1720,7 @@ score_general_mg(const Particle* p, int i_tally, int start_index,
model::tally_filters[i_dg_filt].get())};
// Tally each delayed group bin individually
for (auto d_bin = 0; d_bin < filt.n_bins(); ++d_bin) {
auto d = filt.groups()[d_bin];
auto d = filt.groups()[d_bin] - 1;
score = p->wgt_absorb_ * flux;
if (i_nuclide >= 0) {
score *=
@ -1802,7 +1802,7 @@ score_general_mg(const Particle* p, int i_tally, int start_index,
model::tally_filters[i_dg_filt].get())};
// Tally each delayed group bin individually
for (auto d_bin = 0; d_bin < filt.n_bins(); ++d_bin) {
auto d = filt.groups()[d_bin];
auto d = filt.groups()[d_bin] - 1;
if (i_nuclide >= 0) {
score = flux * atom_density
* get_nuclide_xs(i_nuclide, MG_GET_XS_DELAYED_NU_FISSION,
@ -1842,7 +1842,7 @@ score_general_mg(const Particle* p, int i_tally, int start_index,
model::tally_filters[i_dg_filt].get())};
// Tally each delayed group bin individually
for (auto d_bin = 0; d_bin < filt.n_bins(); ++d_bin) {
auto d = filt.groups()[d_bin];
auto d = filt.groups()[d_bin] - 1;
score = p->wgt_absorb_ * flux;
if (i_nuclide >= 0) {
score *=
@ -1902,8 +1902,8 @@ score_general_mg(const Particle* p, int i_tally, int start_index,
for (auto i = 0; i < p->n_bank_; ++i) {
auto i_bank = simulation::fission_bank.size() - p->n_bank_ + i;
const auto& bank = simulation::fission_bank[i_bank];
auto g = bank.delayed_group;
if (g != 0) {
auto g = bank.delayed_group - 1;
if (g != -1) {
if (i_nuclide >= 0) {
score += simulation::keff * atom_density * bank.wgt * flux
* get_nuclide_xs(i_nuclide, MG_GET_XS_DECAY_RATE, p_g,
@ -1923,7 +1923,7 @@ score_general_mg(const Particle* p, int i_tally, int start_index,
// Find the corresponding filter bin and then score
for (auto d_bin = 0; d_bin < filt.n_bins(); ++d_bin) {
auto d = filt.groups()[d_bin];
if (d == g)
if (d == g + 1)
score_fission_delayed_dg(i_tally, d_bin, score,
score_index);
}
@ -1941,7 +1941,7 @@ score_general_mg(const Particle* p, int i_tally, int start_index,
model::tally_filters[i_dg_filt].get())};
// Tally each delayed group bin individually
for (auto d_bin = 0; d_bin < filt.n_bins(); ++d_bin) {
auto d = filt.groups()[d_bin];
auto d = filt.groups()[d_bin] - 1;
if (i_nuclide >= 0) {
score += atom_density * flux
* get_nuclide_xs(i_nuclide, MG_GET_XS_DECAY_RATE,