Moved flux derivatives to the particle. Diff tallies are still not getting right answer, but they look closer...

This commit is contained in:
John Tramm 2019-12-12 16:02:06 +00:00
parent 1bb03f004a
commit 38fa90b3e4
6 changed files with 52 additions and 61 deletions

View file

@ -313,6 +313,8 @@ public:
std::vector<Particle::Bank> secondary_bank_;
int64_t current_work_; // current work index
std::vector<double> flux_derivs_; // Derivatives of the current particle's weight
};
} // namespace openmc

View file

@ -19,7 +19,6 @@ struct TallyDerivative {
int variable; //!< Independent variable (like temperature)
int diff_material; //!< Material this derivative is applied to
int diff_nuclide; //!< Nuclide this material is applied to
double flux_deriv; //!< Derivative of the current particle's weight
TallyDerivative() {}
explicit TallyDerivative(pugi::xml_node node);
@ -46,16 +45,16 @@ apply_derivative_to_score(const Particle* p, int i_tally, int i_nuclide,
//! further tallies are scored.
//
//! \param p The particle being tracked
void score_collision_derivative(const Particle* p);
void score_collision_derivative(Particle* p);
//! Adjust diff tally flux derivatives for a particle tracking event.
//
//! \param p The particle being tracked
//! \param distance The distance in [cm] traveled by the particle
void score_track_derivative(const Particle* p, double distance);
void score_track_derivative(Particle* p, double distance);
//! Set the flux derivatives on differential tallies to zero.
void zero_flux_derivs();
void zero_flux_derivs(std::vector<double> v);
} // namespace openmc
@ -63,15 +62,10 @@ void zero_flux_derivs();
// Global variables
//==============================================================================
// Explicit vector template specialization declaration of threadprivate variable
// outside of the openmc namespace for the picky Intel compiler.
//extern template class std::vector<openmc::TallyDerivative>;
namespace openmc {
namespace model {
extern std::vector<TallyDerivative> tally_derivs;
//#pragma omp threadprivate(tally_derivs)
extern std::unordered_map<int, int> tally_deriv_map;
} // namespace model