fix positron and electron collision message

This commit is contained in:
liangjg 2019-04-04 16:02:36 -04:00
parent c91aa58e8e
commit ec49c32a61
3 changed files with 33 additions and 28 deletions

View file

@ -62,13 +62,15 @@ void collision(Particle* p)
if (settings::verbosity >= 10 || simulation::trace) {
std::stringstream msg;
if (p->event_ == EVENT_KILL) {
msg << " " << " Killed. Energy = " << p->E_ << " eV.";
msg << " Killed. Energy = " << p->E_ << " eV.";
} else if (p->type_ == Particle::Type::neutron) {
msg << " " << reaction_name(p->event_mt_) << " with " <<
data::nuclides[p->event_nuclide_]->name_ << ". Energy = " << p->E_ << " eV.";
} else {
} else if (p->type_ == Particle::Type::photon) {
msg << " " << reaction_name(p->event_mt_) << " with " <<
data::elements[p->event_nuclide_].name_ << ". Energy = " << p->E_ << " eV.";
} else {
msg << " Disappeared. Energy = " << p->E_ << " eV.";
}
write_message(msg, 1);
}

View file

@ -9,6 +9,7 @@
#include "openmc/mgxs_interface.h"
#include "openmc/nuclide.h"
#include "openmc/particle.h"
#include "openmc/reaction.h"
#include "openmc/reaction_product.h"
#include "openmc/settings.h"
#include "openmc/simulation.h"
@ -772,7 +773,7 @@ void read_tallies_xml()
case SCORE_PROMPT_NU_FISSION:
case SCORE_DECAY_RATE:
warning("Particle filter is not used with photon transport"
" on and " + std::to_string(score) + " score.");
" on and " + reaction_name(score) + " score.");
break;
}
}

View file

@ -1237,31 +1237,33 @@ score_general_ce(Particle* p, int i_tally, int start_index,
score -= bank.E;
}
score *= p->wgt_last_ * flux;
} else if (p->type_ == Particle::Type::photon) {
// Calculate photon heating cross section on-the-fly
score = 0.;
if (i_nuclide >= 0) {
// Find the element corresponding to the nuclide
auto name = data::nuclides[i_nuclide]->name_;
int pos = name.find_first_of("0123456789");
std::string element = name.substr(0, pos);
int i_element = data::element_map[element];
auto& heating {data::elements[i_element].heating_};
auto i_grid = p->photon_xs_[i_element].index_grid;
auto f = p->photon_xs_[i_element].interp_factor;
score = std::exp(heating(i_grid) + f * (heating(i_grid+1) -
heating(i_grid))) * atom_density * flux;
} else {
if (p->material_ != MATERIAL_VOID) {
const Material& material {*model::materials[p->material_]};
for (auto i = 0; i < material.nuclide_.size(); ++i) {
auto i_element = material.element_[i];
auto atom_density = material.atom_density_(i);
auto& heating {data::elements[i_element].heating_};
auto i_grid = p->photon_xs_[i_element].index_grid;
auto f = p->photon_xs_[i_element].interp_factor;
score += std::exp(heating(i_grid) + f * (heating(i_grid+1) -
heating(i_grid))) * atom_density * flux;
} else {
if (p->type_ == Particle::Type::photon) {
// Calculate photon heating cross section on-the-fly
score = 0.;
if (i_nuclide >= 0) {
// Find the element corresponding to the nuclide
auto name = data::nuclides[i_nuclide]->name_;
int pos = name.find_first_of("0123456789");
std::string element = name.substr(0, pos);
int i_element = data::element_map[element];
auto& heating {data::elements[i_element].heating_};
auto i_grid = p->photon_xs_[i_element].index_grid;
auto f = p->photon_xs_[i_element].interp_factor;
score = std::exp(heating(i_grid) + f * (heating(i_grid+1) -
heating(i_grid))) * atom_density * flux;
} else {
if (p->material_ != MATERIAL_VOID) {
const Material& material {*model::materials[p->material_]};
for (auto i = 0; i < material.nuclide_.size(); ++i) {
auto i_element = material.element_[i];
auto atom_density = material.atom_density_(i);
auto& heating {data::elements[i_element].heating_};
auto i_grid = p->photon_xs_[i_element].index_grid;
auto f = p->photon_xs_[i_element].interp_factor;
score += std::exp(heating(i_grid) + f * (heating(i_grid+1) -
heating(i_grid))) * atom_density * flux;
}
}
}
}