OpenMC/include/openmc/tallies/trigger.h
Travis L c976653abf
Allow zero bins in tally triggers (#2928)
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
2024-05-02 14:00:22 +00:00

53 lines
1.5 KiB
C++

#ifndef OPENMC_TALLIES_TRIGGER_H
#define OPENMC_TALLIES_TRIGGER_H
#include <string>
#include "pugixml.hpp"
namespace openmc {
//==============================================================================
// Type definitions
//==============================================================================
enum class TriggerMetric {
variance,
relative_error,
standard_deviation,
not_active
};
//! Stops the simulation early if a desired tally uncertainty is reached.
struct Trigger {
TriggerMetric metric; //!< The type of uncertainty (e.g. std dev) measured
double threshold; //!< Uncertainty value below which trigger is satisfied
bool ignore_zeros; //!< Whether to allow zero tally bins to be ignored
int score_index; //!< Index of the relevant score in the tally's arrays
};
//! Stops the simulation early if a desired k-effective uncertainty is reached.
struct KTrigger {
TriggerMetric metric {TriggerMetric::not_active};
double threshold {0.};
};
//==============================================================================
// Global variable declarations
//==============================================================================
// TODO: consider a different namespace
namespace settings {
extern KTrigger keff_trigger;
}
//==============================================================================
// Non-memeber functions
//==============================================================================
void check_triggers();
} // namespace openmc
#endif // OPENMC_TALLIES_TRIGGER_H