Go to the documentation of this file.
28 #include "openmc/tallies/filter_mesh.h"
73 virtual void syncSolutions(ExternalProblem::Direction direction)
override;
74 virtual bool converged(
unsigned int)
override {
return true; }
84 std::vector<std::vector<SubdomainName>> & names,
85 std::vector<SubdomainID> & flattened_ids);
94 const std::vector<SubdomainID> & ids,
95 const std::vector<SubdomainName> & names)
const;
123 virtual const std::map<cellInfo, std::vector<unsigned int>> &
cellToElem()
const
186 bool allow_negative_weights =
true)
override;
252 return std::find(phase.begin(), phase.end(),
cellFeedback(cell_info)) != phase.end();
264 return std::find(phase.begin(), phase.end(),
cellFeedback(cell_info)) != phase.end();
297 const std::string & name,
298 InputParameters & moose_object_pars);
336 const std::string & default_name,
337 std::map<std::string, std::vector<SubdomainName>> & vars_to_specified_blocks,
338 std::vector<SubdomainID> & specified_blocks);
362 const std::unordered_set<SubdomainID> &
id)
const;
416 printTrisoHelp(
const std::chrono::time_point<std::chrono::high_resolution_clock> & start)
const;
447 template <
typename T>
448 void gatherCellSum(std::vector<T> & local, std::map<cellInfo, T> & global)
const;
456 template <
typename T>
457 void gatherCellVector(std::vector<T> & local, std::vector<unsigned int> & n_local, std::map<
cellInfo, std::vector<T>> & global);
477 void readBlockParameters(
const std::string name, std::unordered_set<SubdomainID> & blocks);
494 std::map<cellInfo, containedCells> & map);
529 template <
typename T>
530 void checkEmptyVector(
const std::vector<T> & vector,
const std::string & name)
const;
557 unsigned int local_score,
558 std::shared_ptr<TallyBase> local_tally);
617 const std::map<SubdomainID, std::pair<unsigned int, std::string>> & var_num,
618 const std::vector<coupling::CouplingFields> * phase)
const;
675 std::map<cellInfo, containedCells> & compare)
const;
1037 std::shared_ptr<moab::DagMC> _dagmc =
nullptr;
1056 void dufekGudowskiParticleUpdate();
1059 std::vector<int32_t> _flattened_ids;
1062 std::vector<int32_t> _flattened_instances;
1068 std::map<cellInfo, int32_t> _n_offset;
1074 std::vector<int32_t> _first_identical_cell_materials;
1077 std::map<SubdomainID, std::pair<unsigned int, std::string>> _subdomain_to_temp_vars;
1080 std::map<SubdomainID, std::pair<unsigned int, std::string>> _subdomain_to_density_vars;
void validateLocalTallies()
std::map< cellInfo, std::vector< unsigned int > > _cell_to_elem
Mapping of OpenMC cell indices to a vector of MOOSE element IDs.
Definition: OpenMCCellAverageProblem.h:922
int _n_mapped_none_elems
Number of no-coupling elements mapped to OpenMC cells.
Definition: OpenMCCellAverageProblem.h:913
static constexpr int32_t UNMAPPED
Constant flag to indicate that a cell/element was unmapped.
Definition: OpenMCCellAverageProblem.h:313
bool hasDensityFeedback(const cellInfo &cell_info) const
Definition: OpenMCCellAverageProblem.h:248
RelaxationEnum
Type of relaxation.
Definition: CardinalEnums.h:206
void setupProblem()
Initialize the mapping of OpenMC to the MooseMesh and perform additional setup actions.
void setContainedCells(const cellInfo &cell_info, const Point &hint, std::map< cellInfo, containedCells > &map)
const bool _need_to_reinit_coupling
Definition: OpenMCCellAverageProblem.h:744
int32_t elemToCellID(const int &elem_id) const
Definition: OpenMCCellAverageProblem.h:207
static bool _printed_triso_warning
Whether a warning has already been printed about very long setup times (for TRISOs)
Definition: OpenMCCellAverageProblem.h:994
void gatherCellSum(std::vector< T > &local, std::map< cellInfo, T > &global) const
virtual void createQRules(QuadratureType type, Order order, Order volume_order, Order face_order, SubdomainID block, bool allow_negative_weights=true) override
unsigned int _cell_level
Definition: OpenMCCellAverageProblem.h:709
std::map< cellInfo, int > _n_temp
Number of temperature-only feedback elements in each mapped OpenMC cell (global)
Definition: OpenMCCellAverageProblem.h:1015
std::vector< std::vector< unsigned int > > _tally_var_ids
A vector of auxvariable ids added by the [Tallies] block.
Definition: OpenMCCellAverageProblem.h:859
const bool _has_identical_cell_fills
Definition: OpenMCCellAverageProblem.h:795
void checkTallySum(const unsigned int &score) const
std::set< SubdomainID > coupledSubdomains() const
static constexpr int DIMENSION
Spatial dimension of the Monte Carlo problem.
Definition: OpenMCCellAverageProblem.h:316
bool _contains_cell_tally
Whether the problem contains a cell tally or not.
Definition: OpenMCCellAverageProblem.h:865
void readBlockParameters(const std::string name, std::unordered_set< SubdomainID > &blocks)
int fixedPointIteration() const
Definition: OpenMCCellAverageProblem.h:310
cellInfo elemToCellInfo(const int &elem_id) const
Definition: OpenMCCellAverageProblem.h:222
std::map< cellInfo, int32_t > _cell_to_material
Definition: OpenMCCellAverageProblem.h:955
int32_t elemToCellInstance(const int &elem_id) const
Definition: OpenMCCellAverageProblem.h:214
int32_t cellID(const int32_t index) const
TallyTriggerTypeEnum
Type of trigger to apply.
Definition: CardinalEnums.h:162
std::vector< std::string > _all_tally_scores
A list of all of the scores contained by the local tallies added in the [Tallies] block.
Definition: OpenMCCellAverageProblem.h:849
std::vector< SubdomainID > _temp_blocks
Blocks in MOOSE mesh that provide temperature feedback.
Definition: OpenMCCellAverageProblem.h:871
const bool & _assume_separate_tallies
Definition: OpenMCCellAverageProblem.h:812
const bool & _check_identical_cell_fills
Definition: OpenMCCellAverageProblem.h:803
virtual std::unordered_set< SubdomainID > getCellToElementSub(const cellInfo &info)
Definition: OpenMCCellAverageProblem.h:133
std::vector< Real > _local_sum_tally
Sum value of the local tally(s), across all bins.
Definition: OpenMCCellAverageProblem.h:982
const bool _normalize_by_global
Definition: OpenMCCellAverageProblem.h:736
@ density
Definition: CardinalEnums.h:177
void sendDensityToOpenMC() const
void checkContainedCellsStructure(const cellInfo &cell_info, containedCells &reference, containedCells &compare) const
void checkBlocksInMesh(const std::string name, const std::vector< SubdomainID > &ids, const std::vector< SubdomainName > &names) const
void latticeOuterCheck(const Point &c, int level) const
void setMinimumVolumeQRules(Order &volume_order, const std::string &type)
int _n_mapped_temp_density_elems
Definition: OpenMCCellAverageProblem.h:910
void read2DBlockParameters(const std::string name, std::vector< std::vector< SubdomainName >> &names, std::vector< SubdomainID > &flattened_ids)
unsigned int _n_particles_1
Number of particles simulated in the first iteration.
Definition: OpenMCCellAverageProblem.h:1000
@ density_and_temperature
Definition: CardinalEnums.h:178
Definition: OpenMCVolumeCalculation.h:28
Skins the [Mesh] according to individual bins for temperature, density, and subdomain ID.
Definition: MoabSkinner.h:19
std::pair< int32_t, int32_t > cellInfo
Definition: OpenMCProblemBase.h:184
void reloadDAGMC()
Reconstruct the DAGMC geometry after skinning.
void cacheContainedCells()
void latticeOuterError(const Point &c, int level) const
const bool & _verbose
Whether to print diagnostic information about model setup and the transfers.
Definition: OpenMCProblemBase.h:370
bool cellHasIdenticalFill(const cellInfo &cell_info) const
bool _has_cell_tallies
Whether any cell tallies exist.
Definition: OpenMCCellAverageProblem.h:834
void gatherCellVector(std::vector< T > &local, std::vector< unsigned int > &n_local, std::map< cellInfo, std::vector< T >> &global)
virtual void updateMaterials()
@ temperature
Definition: CardinalEnums.h:176
Tally includes.
Definition: OpenMCCellAverageProblem.h:65
std::map< cellInfo, int32_t > _cell_to_n_contained
Number of material-type cells contained within a cell.
Definition: OpenMCCellAverageProblem.h:964
std::vector< std::map< std::string, int > > _local_tally_score_map
Definition: OpenMCCellAverageProblem.h:856
unsigned int _global_tally_index
Index in OpenMC tallies corresponding to the first global tally added by Cardinal.
Definition: OpenMCCellAverageProblem.h:1027
std::unordered_set< SubdomainID > _identical_cell_fill_blocks
Blocks for which the cell fills are identical.
Definition: OpenMCCellAverageProblem.h:874
std::vector< std::vector< std::string > > _global_tally_scores
Global tally scores corresponding to '_global_tallies'.
Definition: OpenMCCellAverageProblem.h:973
virtual const std::map< cellInfo, std::vector< unsigned int > > & cellToElem() const
Definition: OpenMCCellAverageProblem.h:123
std::map< cellInfo, Real > computeVolumeWeightedCellInput(const std::map< SubdomainID, std::pair< unsigned int, std::string >> &var_num, const std::vector< coupling::CouplingFields > *phase) const
virtual Real cellVolume(const cellInfo &cell_info) const
std::unordered_map< int32_t, std::vector< int32_t > > containedCells
Definition: OpenMCCellAverageProblem.h:192
std::map< cellInfo, int > _n_temp_rho
Number of temperature+density feedback elements in each mapped OpenMC cell (global)
Definition: OpenMCCellAverageProblem.h:1021
std::map< cellInfo, std::vector< unsigned int > > _local_cell_to_elem
Mapping of OpenMC cell indices to a vector of MOOSE element IDs, on each local rank.
Definition: OpenMCCellAverageProblem.h:925
void relaxAndNormalizeTally(unsigned int global_score, unsigned int local_score, std::shared_ptr< TallyBase > local_tally)
void initializeTallies()
Add OpenMC tallies to facilitate the coupling.
static constexpr Real ZERO_TALLY_THRESHOLD
Tolerance for setting zero tally.
Definition: OpenMCCellAverageProblem.h:1050
containedCells containedMaterialCells(const cellInfo &cell_info) const
double cellMappedVolume(const cellInfo &cell_info) const
int _n_moose_density_elems
Number of elements in the MOOSE mesh that exclusively provide density feedback.
Definition: OpenMCCellAverageProblem.h:883
void sendTemperatureToOpenMC() const
const bool & _export_properties
Definition: OpenMCCellAverageProblem.h:715
void mapElemsToCells()
Populate maps of MOOSE elements to OpenMC cells.
Point transformPoint(const Point &p) const
Definition: SymmetryPointGenerator.C:99
Real tallyNormalization(unsigned int global_score) const
void readBlockVariables(const std::string ¶m, const std::string &default_name, std::map< std::string, std::vector< SubdomainName >> &vars_to_specified_blocks, std::vector< SubdomainID > &specified_blocks)
Definition: OpenMCProblemBase.h:49
std::map< cellInfo, Real > _cell_to_elem_volume
Definition: OpenMCCellAverageProblem.h:943
void addTallyObject(const std::string &type, const std::string &name, InputParameters &moose_object_pars)
std::vector< int32_t > materialsInCells(const containedCells &contained_cells) const
int _n_moose_temp_density_elems
Number of elements in the MOOSE mesh which provide temperature+density feedback.
Definition: OpenMCCellAverageProblem.h:889
int _n_moose_temp_elems
Number of elements in the MOOSE mesh that exclusively provide temperature feedback.
Definition: OpenMCCellAverageProblem.h:886
virtual Point transformPoint(const Point &pt) const
Definition: OpenMCCellAverageProblem.h:155
cellInfo firstContainedMaterialCell(const cellInfo &cell_info) const
const coupling::OpenMCInitialCondition _initial_condition
Definition: OpenMCCellAverageProblem.h:691
coupling::CouplingFields elemFeedback(const Elem *elem) const
Real tallyMultiplier(unsigned int global_score) const
const std::vector< std::shared_ptr< TallyBase > > & getLocalTally() const
Definition: OpenMCCellAverageProblem.h:271
const bool _specified_temperature_feedback
Definition: OpenMCCellAverageProblem.h:831
virtual bool converged(unsigned int) override
Definition: OpenMCCellAverageProblem.h:74
openmc::Particle _particle
Dummy particle to reduce number of allocations of particles for cell lookup routines.
Definition: OpenMCCellAverageProblem.h:997
void checkEmptyVector(const std::vector< T > &vector, const std::string &name) const
int _fixed_point_iteration
Definition: OpenMCProblemBase.h:420
void checkNormalization(const Real &sum, unsigned int global_score) const
int _n_mapped_density_elems
Definition: OpenMCCellAverageProblem.h:904
std::map< SubdomainID, std::set< int32_t > > _subdomain_to_material
Mapping of elem subdomains to materials.
Definition: OpenMCCellAverageProblem.h:931
Real _uncoupled_volume
Total volume of uncoupled MOOSE mesh elements.
Definition: OpenMCCellAverageProblem.h:916
std::vector< SubdomainID > _density_blocks
Blocks in MOOSE mesh that provide density feedback.
Definition: OpenMCCellAverageProblem.h:868
static constexpr Real EV_TO_JOULE
Conversion rate from eV to Joule.
Definition: OpenMCCellAverageProblem.h:1047
bool findCell(const Point &point)
virtual void syncSolutions(ExternalProblem::Direction direction) override
bool _map_density_by_cell
Definition: OpenMCCellAverageProblem.h:818
std::vector< cellInfo > _elem_to_cell
Mapping of MOOSE elements to the OpenMC cell they map to (if any)
Definition: OpenMCCellAverageProblem.h:877
std::map< cellInfo, int > _n_none
Number of none elements in each mapped OpenMC cell (global)
Definition: OpenMCCellAverageProblem.h:1024
std::map< cellInfo, containedCells > _cell_to_contained_material_cells
Definition: OpenMCCellAverageProblem.h:961
int _n_mapped_temp_elems
Definition: OpenMCCellAverageProblem.h:898
CouplingFields
Type of feedback in Monte Carlo simulation.
Definition: CardinalEnums.h:174
int32_t cellToMaterialIndex(const cellInfo &cell_info)
Definition: OpenMCCellAverageProblem.h:231
void getMaterialFills()
Find the material filling each cell which receives density feedback.
const relaxation::RelaxationEnum _relaxation
Type of relaxation to apply to the OpenMC tallies.
Definition: OpenMCCellAverageProblem.h:694
std::map< cellInfo, coupling::CouplingFields > _cell_phase
Phase of each cell.
Definition: OpenMCCellAverageProblem.h:880
std::map< cellInfo, int > _n_rho
Number of density-only feedback elements in each mapped OpenMC cell (global)
Definition: OpenMCCellAverageProblem.h:1018
bool _needs_to_map_cells
Whether any spatial mapping from OpenMC's cells to the mesh is needed.
Definition: OpenMCCellAverageProblem.h:837
OpenMCInitialCondition
Where to get the initial temperature and density settings for OpenMC.
Definition: CardinalEnums.h:183
bool _material_cells_only
Whether non-material cells are mapped.
Definition: OpenMCCellAverageProblem.h:919
virtual void initialSetup() override
std::unique_ptr< NumericVector< Number > > _serialized_solution
Definition: OpenMCCellAverageProblem.h:677
int32_t _dagmc_universe_index
Index in the OpenMC universes corresponding to the DAGMC universe.
Definition: OpenMCCellAverageProblem.h:1044
std::vector< std::vector< std::vector< unsigned int > > > _tally_ext_var_ids
A vector of external (output-based) auxvariable ids added by the [Tallies] block.
Definition: OpenMCCellAverageProblem.h:862
std::string printNewline() const
For keeping the output neat when using verbose.
Definition: OpenMCCellAverageProblem.h:516
static bool _printed_initial
Whether the diagnostic tables on initialization have already been printed.
Definition: OpenMCCellAverageProblem.h:991
const trigger::TallyTriggerTypeEnum _k_trigger
Definition: OpenMCCellAverageProblem.h:702
containedCells shiftCellInstances(const cellInfo &cell_info) const
const bool & _output_cell_mapping
Definition: OpenMCCellAverageProblem.h:683
OpenMCVolumeCalculation * _volume_calc
Optional volume calculation for cells which map to MOOSE.
Definition: OpenMCCellAverageProblem.h:1009
static bool _first_transfer
Whether the present transfer is the first transfer.
Definition: OpenMCCellAverageProblem.h:988
std::vector< std::shared_ptr< TallyBase > > _local_tallies
A vector of the tally objects created by the [Tallies] block.
Definition: OpenMCCellAverageProblem.h:846
void computeCellMappedVolumes()
Definition: CardinalEnums.h:65
virtual const std::vector< std::string > & getTallyScores() const
Definition: OpenMCCellAverageProblem.h:148
static InputParameters validParams()
void storeElementPhase()
Loop over the elements in the MOOSE mesh and store the type of feedback applied by each.
std::vector< openmc::Tally * > _global_tallies
Definition: OpenMCCellAverageProblem.h:970
coupling::CouplingFields cellFeedback(const cellInfo &cell_info) const
unsigned int _source_rate_index
Index in tally_score pointing to the score used for normalizing flux tallies in eigenvalue mode.
Definition: OpenMCCellAverageProblem.h:1030
int32_t elemToCellIndex(const int &elem_id) const
Definition: OpenMCCellAverageProblem.h:199
void compareContainedCells(std::map< cellInfo, containedCells > &reference, std::map< cellInfo, containedCells > &compare) const
std::vector< std::string > getMaterialInEachSubdomain() const
std::vector< openmc::TallyEstimator > _global_tally_estimators
Global tally estimators corresponding to '_global_tallies'.
Definition: OpenMCCellAverageProblem.h:976
std::map< std::string, std::vector< SubdomainName > > _temp_vars_to_blocks
Mapping from temperature variable name to the subdomains on which to read it from.
Definition: OpenMCCellAverageProblem.h:1003
void checkCellMappedPhase()
This function is used to ensure that each OpenMC cell only maps to a single phase.
void printTrisoHelp(const std::chrono::time_point< std::chrono::high_resolution_clock > &start) const
double cellTemperature(const cellInfo &cell_info) const
virtual const OpenMCVolumeCalculation * volumeCalculation() const
Definition: OpenMCCellAverageProblem.h:117
OpenMCCellAverageProblem(const InputParameters ¶ms)
std::vector< Real > _global_sum_tally
Sum value of the global tally(s), across all bins.
Definition: OpenMCCellAverageProblem.h:979
bool cellMapsToSubdomain(const cellInfo &cell_info, const std::unordered_set< SubdomainID > &id) const
const bool _check_tally_sum
Definition: OpenMCCellAverageProblem.h:759
std::map< cellInfo, Real > _cell_volume
Definition: OpenMCCellAverageProblem.h:949
virtual void externalSolve() override
void getCellMappedPhase()
std::vector< Real > _local_mean_tally
Mean value of the local tally(s), across all bins; only used for fixed source mode.
Definition: OpenMCCellAverageProblem.h:985
const SymmetryPointGenerator * _symmetry
Userobject that maps from a partial-symmetry OpenMC model to a whole-domain [Mesh].
Definition: OpenMCCellAverageProblem.h:1012
void printAuxVariableIO()
long unsigned int _n_openmc_cells
Total number of unique OpenMC cell IDs + instances combinations.
Definition: OpenMCCellAverageProblem.h:1041
const bool _needs_global_tally
Definition: OpenMCCellAverageProblem.h:843
bool hasTemperatureFeedback(const cellInfo &cell_info) const
Definition: OpenMCCellAverageProblem.h:260
void initializeElementToCellMapping()
Set up the mapping from MOOSE elements to OpenMC cells.
Definition: SymmetryPointGenerator.h:28
std::map< cellInfo, Point > _cell_to_point
Definition: OpenMCCellAverageProblem.h:937
void getCellMappedSubdomains()
Loop over all the OpenMC cells and get the element subdomain IDs that map to each cell.
int _n_moose_none_elems
Number of no-coupling elements in the MOOSE mesh.
Definition: OpenMCCellAverageProblem.h:892
std::map< std::string, std::vector< SubdomainName > > _density_vars_to_blocks
Mapping from density variable name to the subdomains on which to read it from.
Definition: OpenMCCellAverageProblem.h:1006
Point transformPointToOpenMC(const Point &pt) const
const Real & _relaxation_factor
Constant relaxation factor.
Definition: OpenMCCellAverageProblem.h:762
virtual bool hasPointTransformations() const
Definition: OpenMCCellAverageProblem.h:142
const bool _specified_density_feedback
Definition: OpenMCCellAverageProblem.h:824
std::map< cellInfo, std::unordered_set< SubdomainID > > _cell_to_elem_subdomain
Mapping of OpenMC cell indices to the subdomain IDs each maps to.
Definition: OpenMCCellAverageProblem.h:928
virtual void addExternalVariables() override
void subdomainsToMaterials()
Loop over the mapped cells, and build a map between subdomains to OpenMC materials.
void getTallyTriggerParameters(const InputParameters ¶ms)
unsigned int getCellLevel(const Point &c) const