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;
175 xt::xtensor<double, 1>
tallySum(openmc::Tally *
tally,
const unsigned int & score)
const;
228 const xt::xtensor<double, 1> & sum_sq,
const int & n_realizations)
const;
253 int32_t
cellID(
const int32_t index)
const;
390 const std::vector<unsigned int> & elem_ids,
399 return openmc::settings::path_output +
"initial_source_" +
Definition CardinalProblem.h:27
Definition OpenMCDomainFilterEditor.h:33
Definition OpenMCNuclideDensities.h:29
Definition OpenMCProblemBase.h:53
const bool _specified_scaling
Whether a mesh scaling was specified by the user.
Definition OpenMCProblemBase.h:422
double tallySumAcrossBins(std::vector< openmc::Tally * > tally, const unsigned int &score) const
void executeFilterEditors()
Execute all filter editor userobjects.
OpenMCProblemBase(const InputParameters ¶ms)
void importProperties() const
Import temperature and density from a properties.h5 file.
static InputParameters validParams()
const Real & _scaling
Definition OpenMCProblemBase.h:443
virtual void syncSolutions(ExternalProblem::Direction direction) override
Set the 'mesh changed' adaptivity flag.
openmc::TriggerMetric triggerMetric(trigger::TallyTriggerTypeEnum trigger) const
unsigned int _total_n_particles
Total number of particles simulated.
Definition OpenMCProblemBase.h:457
long unsigned int _n_openmc_cells
Total number of unique OpenMC cell IDs + instances combinations.
Definition OpenMCProblemBase.h:460
virtual void setCellTemperature(const int32_t &id, const int32_t &instance, const Real &T, const cellInfo &cell_info) const
bool materialFill(const cellInfo &cell_info, int32_t &material_index) const
void checkOpenMCUserObjectIDs() const
Ensure that the IDs of OpenMC objects in UserObjects don't clash.
void getOpenMCUserObjects()
Find all userobjects which are changing OpenMC data structures.
void externalSolve() override
Run a k-eigenvalue OpenMC simulation.
bool firstSolve() const
Whether this is the first time OpenMC is running.
virtual bool adaptMesh() override
int _fixed_point_iteration
Definition OpenMCProblemBase.h:454
std::string subdomainName(const SubdomainID &id) const
static constexpr Real _density_conversion_factor
Conversion unit to transfer between kg/m3 and g/cm3.
Definition OpenMCProblemBase.h:496
bool cellIsVoid(const cellInfo &cell_info) const
bool isLocalElem(const Elem *elem) const
void sendTallyNuclidesToOpenMC()
Set the tally nuclides for any tallies being modified via MOOSE.
void catchOpenMCError(const int &err, const std::string descriptor) const
std::vector< OpenMCNuclideDensities * > _nuclide_densities_uos
Userobjects for changing OpenMC material compositions.
Definition OpenMCProblemBase.h:474
std::string printPoint(const Point &p) const
unsigned int numElemsInSubdomain(const SubdomainID &id) const
const bool & _verbose
Whether to print diagnostic information about model setup and the transfers.
Definition OpenMCProblemBase.h:404
xt::xtensor< double, 1 > tallySum(openmc::Tally *tally, const unsigned int &score) const
Compute the sum of a tally within each bin.
int32_t cellID(const int32_t index) const
xt::xtensor< double, 1 > relativeError(const xt::xtensor< double, 1 > &sum, const xt::xtensor< double, 1 > &sum_sq, const int &n_realizations) const
double tallyMeanAcrossBins(std::vector< openmc::Tally * > tally, const unsigned int &score) const
openmc::TriggerMetric triggerMetric(std::string trigger) const
bool _run_on_adaptivity_cycle
Definition OpenMCProblemBase.h:493
std::pair< int32_t, int32_t > cellInfo
Definition OpenMCProblemBase.h:197
void checkTallyEditorIDs() const
Ensure that any tally editors don't apply to Cardinal-mapped tallies.
const Real & scaling() const
Definition OpenMCProblemBase.h:99
std::string materialName(const int32_t index) const
virtual void geometryType(bool &has_csg_universe, bool &has_dag_universe) const
const bool _has_adaptivity
Whether or not the problem contains mesh adaptivity.
Definition OpenMCProblemBase.h:486
const Real * _source_strength
Source strength by which to normalize the OpenMC results, for fixed source mode.
Definition OpenMCProblemBase.h:410
std::vector< OpenMCDomainFilterEditor * > _filter_editor_uos
Userobjects for creating/changing OpenMC filters.
Definition OpenMCProblemBase.h:477
virtual void setCellDensity(const Real &density, const cellInfo &cell_info) const
bool _reuse_source
Definition OpenMCProblemBase.h:419
bool isReactionRateScore(const std::string &score) const
virtual std::vector< int32_t > cellFill(const cellInfo &cell_info, int &fill_type) const
std::string estimatorToString(openmc::TallyEstimator estimator) const
bool isHeatingScore(const std::string &score) const
std::string tallyScoreToEnum(const std::string &score) const
const Real * _power
Power by which to normalize the OpenMC results, for k-eigenvalue mode.
Definition OpenMCProblemBase.h:407
unsigned int addExternalVariable(const std::string &name, const std::vector< SubdomainName > *block=nullptr)
virtual ~OpenMCProblemBase() override
std::string printMaterial(const int32_t &index) const
const bool & _skip_statepoint
Whether to skip writing statepoints from OpenMC.
Definition OpenMCProblemBase.h:446
int nTotalParticles() const
Definition OpenMCProblemBase.h:246
void sendNuclideDensitiesToOpenMC()
Set the nuclide densities for any materials being modified via MOOSE.
void executeTallyEditors()
Execute all tally editor userobjects.
virtual std::vector< int32_t > getMappedTallyIDs() const =0
int _n_cell_digits
Definition OpenMCProblemBase.h:468
int32_t materialID(const int32_t index) const
unsigned int globalElemID(const unsigned int &id) const
Definition OpenMCProblemBase.h:300
std::vector< unsigned int > _local_to_global_elem
Mapping from local element indices to global element indices for this rank.
Definition OpenMCProblemBase.h:483
const Real & densityConversionFactor() const
Definition OpenMCProblemBase.h:234
void writeSourceBank(const std::string &filename)
std::string sourceBankFileName() const
Definition OpenMCProblemBase.h:397
std::string enumToTallyScore(const std::string &score) const
bool cellHasZeroInstances(const cellInfo &cell_info) const
static constexpr int MATERIAL_VOID
ID used by OpenMC to indicate that a material fill is VOID.
Definition OpenMCProblemBase.h:499
openmc::RunMode _run_mode
OpenMC run mode.
Definition OpenMCProblemBase.h:471
void fillElementalAuxVariable(const unsigned int &var_num, const std::vector< unsigned int > &elem_ids, const Real &value)
bool hasScaling() const
Definition OpenMCProblemBase.h:105
virtual std::string printCell(const cellInfo &cell_info, const bool brief=false) const
long unsigned int numCells() const
std::vector< OpenMCTallyEditor * > _tally_editor_uos
Userobjects for creating/changing OpenMC tallies.
Definition OpenMCProblemBase.h:480
openmc::TallyEstimator tallyEstimator(tally::TallyEstimatorEnum estimator) const
Definition OpenMCTallyEditor.h:31
Definition CardinalEnums.h:138
TallyEstimatorEnum
Type of estimator to use for OpenMC tallies.
Definition CardinalEnums.h:149
Definition CardinalEnums.h:169
TallyTriggerTypeEnum
Type of trigger to apply.
Definition CardinalEnums.h:172