24 #include "PostprocessorInterface.h" 28 #include "openmc/bank.h" 29 #include "openmc/capi.h" 30 #include "openmc/cell.h" 31 #include "openmc/geometry.h" 32 #include "openmc/geometry_aux.h" 33 #include "openmc/hdf5_interface.h" 34 #include "openmc/material.h" 35 #include "openmc/mesh.h" 36 #include "openmc/settings.h" 37 #include "openmc/simulation.h" 38 #include "openmc/source.h" 39 #include "openmc/state_point.h" 40 #include "openmc/tallies/tally.h" 41 #include "openmc/tallies/filter_cell_instance.h" 42 #include "xtensor/xview.hpp" 93 unsigned int addExternalVariable(
const std::string & name,
const std::vector<SubdomainName> * block =
nullptr);
126 virtual void geometryType(
bool & has_csg_universe,
bool & has_dag_universe)
const;
157 virtual void syncSolutions(ExternalProblem::Direction direction)
override;
175 xt::xtensor<double, 1>
tallySum(openmc::Tally *
tally,
const unsigned int & score)
const;
227 xt::xtensor<double, 1>
relativeError(
const xt::xtensor<double, 1> & sum,
228 const xt::xtensor<double, 1> & sum_sq,
const int & n_realizations)
const;
253 int32_t
cellID(
const int32_t index)
const;
260 int32_t
materialID(
const int32_t index)
const;
266 std::string
printPoint(
const Point & p)
const;
311 virtual void setCellTemperature(
const int32_t &
id,
const int32_t & instance,
const Real & T,
327 virtual std::string
printCell(
const cellInfo & cell_info,
const bool brief =
false)
const;
335 virtual std::vector<int32_t>
cellFill(
const cellInfo & cell_info,
int & fill_type)
const;
402 const std::vector<unsigned int> & elem_ids,
411 return openmc::settings::path_output +
"initial_source_" +
TallyTriggerTypeEnum
Type of trigger to apply.
Definition: CardinalEnums.h:173
unsigned int _total_n_particles
Total number of particles simulated.
Definition: OpenMCProblemBase.h:469
int _fixed_point_iteration
Definition: OpenMCProblemBase.h:466
std::string materialName(const int32_t index) const
bool isReactionRateScore(const std::string &score) const
void writeSourceBank(const std::string &filename)
double tallyMeanAcrossBins(std::vector< openmc::Tally * > tally, const unsigned int &score) const
const bool _specified_scaling
Whether a mesh scaling was specified by the user.
Definition: OpenMCProblemBase.h:434
const bool & _skip_statepoint
Whether to skip writing statepoints from OpenMC.
Definition: OpenMCProblemBase.h:458
const Real & densityConversionFactor() const
Definition: OpenMCProblemBase.h:234
const bool _calc_kinetics_params
A flag to indicate if OpenMC is calculating kinetics parameters.
Definition: OpenMCProblemBase.h:508
bool materialFill(const cellInfo &cell_info, int32_t &material_index) const
long unsigned int numCells() const
virtual ~OpenMCProblemBase() override
void checkOpenMCUserObjectIDs() const
Ensure that the IDs of OpenMC objects in UserObjects don't clash.
static InputParameters validParams()
int32_t materialID(const int32_t index) const
bool isHeatingScore(const std::string &score) const
Definition: OpenMCTallyEditor.h:30
unsigned int addExternalVariable(const std::string &name, const std::vector< SubdomainName > *block=nullptr)
virtual std::vector< int32_t > cellFill(const cellInfo &cell_info, int &fill_type) const
virtual bool adaptMesh() override
std::vector< unsigned int > _local_to_global_elem
Mapping from local element indices to global element indices for this rank.
Definition: OpenMCProblemBase.h:495
bool computeKineticsParams() const
Definition: OpenMCProblemBase.h:362
const bool _has_adaptivity
Whether or not the problem contains mesh adaptivity.
Definition: OpenMCProblemBase.h:498
std::string sourceBankFileName() const
Definition: OpenMCProblemBase.h:409
Definition: OpenMCNuclideDensities.h:28
OpenMCProblemBase(const InputParameters ¶ms)
void sendNuclideDensitiesToOpenMC()
Set the nuclide densities for any materials being modified via MOOSE.
static constexpr int MATERIAL_VOID
ID used by OpenMC to indicate that a material fill is VOID.
Definition: OpenMCProblemBase.h:520
int _ifp_tally_index
The index of a global tally to accumulate the scores required for kinetics parameters.
Definition: OpenMCProblemBase.h:511
virtual void geometryType(bool &has_csg_universe, bool &has_dag_universe) const
virtual void setCellTemperature(const int32_t &id, const int32_t &instance, const Real &T, const cellInfo &cell_info) const
int _n_cell_digits
Definition: OpenMCProblemBase.h:480
void getOpenMCUserObjects()
Find all userobjects which are changing OpenMC data structures.
void checkTallyEditorIDs() const
Ensure that any tally editors don't apply to Cardinal-mapped tallies.
Definition: CardinalEnums.h:216
Definition: OpenMCDomainFilterEditor.h:32
xt::xtensor< double, 1 > relativeError(const xt::xtensor< double, 1 > &sum, const xt::xtensor< double, 1 > &sum_sq, const int &n_realizations) const
openmc::Tally * _ifp_tally
The global tally used to accumulate the scores required for kinetics parameters.
Definition: OpenMCProblemBase.h:514
std::vector< OpenMCTallyEditor * > _tally_editor_uos
Userobjects for creating/changing OpenMC tallies.
Definition: OpenMCProblemBase.h:492
int32_t cellID(const int32_t index) const
virtual std::string printCell(const cellInfo &cell_info, const bool brief=false) const
Definition: CardinalProblem.h:26
void executeTallyEditors()
Execute all tally editor userobjects.
openmc::TriggerMetric triggerMetric(trigger::TallyTriggerTypeEnum trigger) const
std::vector< OpenMCNuclideDensities * > _nuclide_densities_uos
Userobjects for changing OpenMC material compositions.
Definition: OpenMCProblemBase.h:486
const Real & scaling() const
Definition: OpenMCProblemBase.h:99
std::string printPoint(const Point &p) const
bool cellIsVoid(const cellInfo &cell_info) const
Definition: OpenMCProblemBase.h:52
void importProperties() const
Import temperature and density from a properties.h5 file.
TallyEstimatorEnum
Type of estimator to use for OpenMC tallies.
Definition: CardinalEnums.h:150
int nTotalParticles() const
Definition: OpenMCProblemBase.h:246
bool cellHasZeroInstances(const cellInfo &cell_info) const
const Real & _scaling
Definition: OpenMCProblemBase.h:455
static constexpr Real _density_conversion_factor
Conversion unit to transfer between kg/m3 and g/cm3.
Definition: OpenMCProblemBase.h:517
void sendTallyNuclidesToOpenMC()
Set the tally nuclides for any tallies being modified via MOOSE.
long unsigned int _n_openmc_cells
Total number of unique OpenMC cell IDs + instances combinations.
Definition: OpenMCProblemBase.h:472
unsigned int numElemsInSubdomain(const SubdomainID &id) const
bool hasScaling() const
Definition: OpenMCProblemBase.h:105
const bool & _verbose
Whether to print diagnostic information about model setup and the transfers.
Definition: OpenMCProblemBase.h:416
bool _reuse_source
Definition: OpenMCProblemBase.h:431
virtual void syncSolutions(ExternalProblem::Direction direction) override
Set the 'mesh changed' adaptivity flag.
void fillElementalAuxVariable(const unsigned int &var_num, const std::vector< unsigned int > &elem_ids, const Real &value)
const openmc::Tally & getKineticsParamTally()
std::vector< OpenMCDomainFilterEditor * > _filter_editor_uos
Userobjects for creating/changing OpenMC filters.
Definition: OpenMCProblemBase.h:489
xt::xtensor< double, 1 > tallySum(openmc::Tally *tally, const unsigned int &score) const
Compute the sum of a tally within each bin.
virtual std::vector< int32_t > getMappedTallyIDs() const =0
std::string printMaterial(const int32_t &index) const
openmc::TallyEstimator tallyEstimator(tally::TallyEstimatorEnum estimator) const
unsigned int globalElemID(const unsigned int &id) const
Definition: OpenMCProblemBase.h:300
Definition: CardinalEnums.h:170
bool _run_on_adaptivity_cycle
Definition: OpenMCProblemBase.h:505
std::string subdomainName(const SubdomainID &id) const
void catchOpenMCError(const int &err, const std::string descriptor) const
virtual void setCellDensity(const Real &density, const cellInfo &cell_info) const
Definition: CardinalEnums.h:140
bool firstSolve() const
Whether this is the first time OpenMC is running.
openmc::RunMode _run_mode
OpenMC run mode.
Definition: OpenMCProblemBase.h:483
const Real * _source_strength
Source strength by which to normalize the OpenMC results, for fixed source mode.
Definition: OpenMCProblemBase.h:422
std::pair< int32_t, int32_t > cellInfo
Definition: OpenMCProblemBase.h:197
std::string estimatorToString(openmc::TallyEstimator estimator) const
void externalSolve() override
Run a k-eigenvalue OpenMC simulation.
const Real * _power
Power by which to normalize the OpenMC results, for k-eigenvalue mode.
Definition: OpenMCProblemBase.h:419
void executeFilterEditors()
Execute all filter editor userobjects.
bool isLocalElem(const Elem *elem) const
std::string enumToTallyScore(const std::string &score) const
double tallySumAcrossBins(std::vector< openmc::Tally * > tally, const unsigned int &score) const
std::string tallyScoreToEnum(const std::string &score) const