diff --git a/include/openmc/lattice.h b/include/openmc/lattice.h index 9c8b8af686..25ab4c0348 100644 --- a/include/openmc/lattice.h +++ b/include/openmc/lattice.h @@ -152,8 +152,7 @@ public: int indx_; //!< An index to a Lattice universes or offsets array. LatticeIter(Lattice &lat, int indx) - : lat_(lat), - indx_(indx) + : indx_(indx), lat_(lat) {} bool operator==(const LatticeIter &rhs) {return (indx_ == rhs.indx_);} diff --git a/src/physics.cpp b/src/physics.cpp index 85b6e2417e..858aae8f4b 100644 --- a/src/physics.cpp +++ b/src/physics.cpp @@ -267,7 +267,7 @@ void sample_photon_reaction(Particle* p) double phi = 2.0*PI*prn(); double E_electron = (alpha - alpha_out)*MASS_ELECTRON_EV - e_b; int electron = static_cast(Particle::Type::electron); - if (E_electron >= settings::energy_cutoff[electron]) { + if (E_electron >= settings::energy_cutoff[electron]) { double mu_electron = (alpha - alpha_out*mu) / std::sqrt(alpha*alpha + alpha_out*alpha_out - 2.0*alpha*alpha_out*mu); Direction u = rotate_angle(p->u(), mu_electron, &phi); @@ -504,6 +504,9 @@ Reaction* sample_fission(int i_nuclide, double E) // Create fission bank sites if fission occurs if (prob > cutoff) return rx; } + + // If we reached here, no reaction was sampled + throw std::runtime_error{"No fission reaction was sampled for " + nuc->name_}; } void sample_photon_product(int i_nuclide, double E, int* i_rx, int* i_product) @@ -901,8 +904,11 @@ Direction sample_target_velocity(const Nuclide* nuc, double E, Direction u, } } } - } // case RVS, DBRC + } // case RVS, DBRC } // switch (sampling_method) + + throw std::runtime_error{"Unable to sample target velocity for " + "elastic scattering."}; } Direction diff --git a/src/tallies/filter_sph_harm.cpp b/src/tallies/filter_sph_harm.cpp index 9aae06beed..1e97e64c1b 100644 --- a/src/tallies/filter_sph_harm.cpp +++ b/src/tallies/filter_sph_harm.cpp @@ -80,9 +80,10 @@ SphericalHarmonicsFilter::text_label(int bin) const if (bin < (n + 1) * (n + 1)) { int m = (bin - n*n) - n; out << "Spherical harmonic expansion, Y" << n << "," << m; - return out.str(); + break; } } + return out.str(); } //============================================================================== diff --git a/src/tallies/filter_zernike.cpp b/src/tallies/filter_zernike.cpp index c4e620c767..9f66a68f98 100644 --- a/src/tallies/filter_zernike.cpp +++ b/src/tallies/filter_zernike.cpp @@ -65,9 +65,10 @@ ZernikeFilter::text_label(int bin) const int first = last - (n + 1); int m = -n + (bin - first) * 2; out << "Zernike expansion, Z" << n << "," << m; - return out.str(); + break; } } + return out.str(); } void diff --git a/src/tallies/trigger.cpp b/src/tallies/trigger.cpp index 2f7f369203..c1b0a93649 100644 --- a/src/tallies/trigger.cpp +++ b/src/tallies/trigger.cpp @@ -83,6 +83,9 @@ check_tally_triggers(double& ratio, int& tally_id, int& score) case TriggerMetric::relative_error: uncertainty = rel_err; break; + case TriggerMetric::not_active: + uncertainty = 0.0; + break; } // Compute the uncertainty / threshold ratio. @@ -109,7 +112,6 @@ double check_keff_trigger() { if (settings::run_mode != RUN_MODE_EIGENVALUE) return 0.; - if (settings::keff_trigger.metric == TriggerMetric::not_active) return 0.; double k_combined[2]; int err = openmc_get_keff(k_combined); @@ -124,6 +126,9 @@ check_keff_trigger() break; case TriggerMetric::relative_error: uncertainty = k_combined[1] / k_combined[0]; + break; + case TriggerMetric::not_active: + break; } double ratio = uncertainty / settings::keff_trigger.threshold;