74 virtual void syncSolutions(ExternalProblem::Direction direction)
override;
75 virtual bool converged(
unsigned int)
override {
return true; }
85 std::vector<std::vector<SubdomainName>> & names,
86 std::vector<SubdomainID> & flattened_ids);
95 const std::vector<SubdomainID> & ids,
96 const std::vector<SubdomainName> & names)
const;
124 virtual const std::map<cellInfo, std::vector<unsigned int>> &
cellToElem()
const
124 virtual const std::map<cellInfo, std::vector<unsigned int>> &
cellToElem()
const {
…}
229 bool allow_negative_weights =
true)
override;
298 return std::find(phase.begin(), phase.end(),
cellFeedback(cell_info)) != phase.end();
310 return std::find(phase.begin(), phase.end(),
cellFeedback(cell_info)) != phase.end();
318 bool hasFilter(
const std::string & filter_name)
const {
return _filters.count(filter_name) > 0; }
325 std::shared_ptr<FilterBase> &
getFilter(
const std::string & filter_name)
325 std::shared_ptr<FilterBase> &
getFilter(
const std::string & filter_name) {
…}
359 const std::string & name,
360 InputParameters & moose_object_pars);
369 addTally(
const std::string & type,
const std::string & name, InputParameters & moose_object_pars);
386 template <
typename T>
390 mooseError(name +
" cannot be empty!");
425 const std::string & default_name,
426 std::map<std::string, std::vector<SubdomainName>> & vars_to_specified_blocks,
427 std::vector<SubdomainID> & specified_blocks);
451 const std::unordered_set<SubdomainID> &
id)
const;
510 printTrisoHelp(
const std::chrono::time_point<std::chrono::high_resolution_clock> & start)
const;
541 template <
typename T>
542 void gatherCellSum(std::vector<T> & local, std::map<cellInfo, T> & global)
const;
550 template <
typename T>
588 std::map<cellInfo, containedCells> & map);
643 unsigned int local_score,
644 std::shared_ptr<TallyBase> local_tally);
703 const std::map<SubdomainID, std::pair<unsigned int, std::string>> & var_num,
704 const std::vector<coupling::CouplingFields> * phase)
const;
761 std::map<cellInfo, containedCells> & compare)
const;
943 std::map<std::string, std::shared_ptr<FilterBase>>
_filters;
1134 std::shared_ptr<moab::DagMC> _dagmc =
nullptr;
1163 void dufekGudowskiParticleUpdate();
1166 std::vector<int32_t> _flattened_ids;
1169 std::vector<int32_t> _flattened_instances;
1175 std::map<cellInfo, int32_t> _n_offset;
1181 std::vector<int32_t> _first_identical_cell_materials;
1184 std::map<SubdomainID, std::pair<unsigned int, std::string>> _subdomain_to_temp_vars;
1187 std::map<SubdomainID, std::pair<unsigned int, std::string>> _subdomain_to_density_vars;
Skins the [Mesh] according to individual bins for temperature, density, and subdomain ID.
Definition MoabSkinner.h:20
Definition OpenMCCellAverageProblem.h:67
const SymmetryPointGenerator * _symmetry
Userobject that maps from a partial-symmetry OpenMC model to a whole-domain [Mesh].
Definition OpenMCCellAverageProblem.h:1109
const bool _needs_global_tally
Definition OpenMCCellAverageProblem.h:937
const Real & _relaxation_factor
Constant relaxation factor.
Definition OpenMCCellAverageProblem.h:856
void printAuxVariableIO()
void getCellMappedPhase()
void computeCellMappedVolumes()
std::unordered_map< int32_t, std::vector< int32_t > > containedCells
Definition OpenMCCellAverageProblem.h:235
OpenMCCellAverageProblem(const InputParameters ¶ms)
int32_t _dagmc_universe_id
ID of the OpenMC universe corresponding to the DAGMC universe.
Definition OpenMCCellAverageProblem.h:1141
double cellMappedVolume(const cellInfo &cell_info) const
std::vector< SubdomainID > _density_blocks
Blocks in MOOSE mesh that provide density feedback.
Definition OpenMCCellAverageProblem.h:965
int _n_moose_none_elems
Number of no-coupling elements in the MOOSE mesh.
Definition OpenMCCellAverageProblem.h:989
const bool _specified_density_feedback
Definition OpenMCCellAverageProblem.h:918
int _n_mapped_temp_elems
Definition OpenMCCellAverageProblem.h:995
const bool _specified_temperature_feedback
Definition OpenMCCellAverageProblem.h:925
std::map< cellInfo, Real > _cell_to_elem_volume
Definition OpenMCCellAverageProblem.h:1040
static constexpr Real ZERO_TALLY_THRESHOLD
Tolerance for setting zero tally.
Definition OpenMCCellAverageProblem.h:1157
void checkEmptyVector(const std::vector< T > &vector, const std::string &name) const
Definition OpenMCCellAverageProblem.h:387
NumericVector< Number > & _serialized_solution
Definition OpenMCCellAverageProblem.h:763
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)
Real _uncoupled_volume
Total volume of uncoupled MOOSE mesh elements.
Definition OpenMCCellAverageProblem.h:1013
const bool & _check_identical_cell_fills
Definition OpenMCCellAverageProblem.h:897
void setContainedCells(const cellInfo &cell_info, const Point &hint, std::map< cellInfo, containedCells > &map)
std::vector< std::map< std::string, int > > _local_tally_score_map
Definition OpenMCCellAverageProblem.h:956
std::vector< SubdomainID > _temp_blocks
Blocks in MOOSE mesh that provide temperature feedback.
Definition OpenMCCellAverageProblem.h:968
int _n_moose_density_elems
Number of elements in the MOOSE mesh that exclusively provide density feedback.
Definition OpenMCCellAverageProblem.h:980
std::map< cellInfo, coupling::CouplingFields > _cell_phase
Phase of each cell.
Definition OpenMCCellAverageProblem.h:977
void sendTemperatureToOpenMC() const
const std::vector< std::shared_ptr< TallyBase > > & getLocalTally() const
Definition OpenMCCellAverageProblem.h:334
bool _map_density_by_cell
Definition OpenMCCellAverageProblem.h:912
std::vector< const MooseVariableFE< Real > * > getTallyScoreVariables(const std::string &score, THREAD_ID tid)
virtual bool converged(unsigned int) override
Definition OpenMCCellAverageProblem.h:75
std::vector< cellInfo > _elem_to_cell
Mapping of MOOSE elements to the OpenMC cell they map to (if any)
Definition OpenMCCellAverageProblem.h:974
bool hasFilter(const std::string &filter_name) const
Definition OpenMCCellAverageProblem.h:318
int32_t elemToCellID(const int &elem_id) const
Definition OpenMCCellAverageProblem.h:250
std::vector< openmc::TallyEstimator > _global_tally_estimators
Global tally estimators corresponding to '_global_tallies'.
Definition OpenMCCellAverageProblem.h:1073
int _n_moose_temp_density_elems
Number of elements in the MOOSE mesh which provide temperature+density feedback.
Definition OpenMCCellAverageProblem.h:986
unsigned int _global_tally_index
Index in OpenMC tallies corresponding to the first global tally added by Cardinal.
Definition OpenMCCellAverageProblem.h:1124
std::vector< std::vector< unsigned int > > _tally_var_ids
A vector of auxvariable ids added by the [Tallies] block.
Definition OpenMCCellAverageProblem.h:959
std::map< cellInfo, Real > computeVolumeWeightedCellInput(const std::map< SubdomainID, std::pair< unsigned int, std::string > > &var_num, const std::vector< coupling::CouplingFields > *phase) const
bool hasDensityFeedback(const cellInfo &cell_info) const
Definition OpenMCCellAverageProblem.h:294
bool hasScore(const std::string &score)
Definition OpenMCCellAverageProblem.h:156
virtual void initialSetup() override
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:1025
int _n_mapped_temp_density_elems
Definition OpenMCCellAverageProblem.h:1007
void checkCellMappedPhase()
This function is used to ensure that each OpenMC cell only maps to a single phase.
bool hasAdaptivity() const
Definition OpenMCCellAverageProblem.h:399
std::vector< int32_t > materialsInCells(const containedCells &contained_cells) const
void printTrisoHelp(const std::chrono::time_point< std::chrono::high_resolution_clock > &start) const
void validateLocalTallies()
const trigger::TallyTriggerTypeEnum _k_trigger
Definition OpenMCCellAverageProblem.h:794
void setupProblem()
Initialize the mapping of OpenMC to the MooseMesh and perform additional setup actions.
virtual void createQRules(QuadratureType type, Order order, Order volume_order, Order face_order, SubdomainID block, bool allow_negative_weights=true) override
void latticeOuterCheck(const Point &c, int level) const
containedCells shiftCellInstances(const cellInfo &cell_info) const
Real tallyNormalization(unsigned int global_score) const
static constexpr int32_t UNMAPPED
Constant flag to indicate that a cell/element was unmapped.
Definition OpenMCCellAverageProblem.h:402
unsigned int _cell_level
Definition OpenMCCellAverageProblem.h:801
bool findCell(const Point &point)
std::map< cellInfo, int > _n_none
Number of none elements in each mapped OpenMC cell (global)
Definition OpenMCCellAverageProblem.h:1121
bool hasTemperatureFeedback(const cellInfo &cell_info) const
Definition OpenMCCellAverageProblem.h:306
int _n_mapped_none_elems
Number of no-coupling elements mapped to OpenMC cells.
Definition OpenMCCellAverageProblem.h:1010
void getCellMappedSubdomains()
Loop over all the OpenMC cells and get the element subdomain IDs that map to each cell.
std::map< cellInfo, int > _n_temp_rho
Number of temperature+density feedback elements in each mapped OpenMC cell (global)
Definition OpenMCCellAverageProblem.h:1118
std::set< SubdomainID > coupledSubdomains() const
void sendDensityToOpenMC() const
const relaxation::RelaxationEnum _relaxation
Type of relaxation to apply to the OpenMC tallies.
Definition OpenMCCellAverageProblem.h:786
void initializeElementToCellMapping()
Set up the mapping from MOOSE elements to OpenMC cells.
openmc::Particle _particle
Dummy particle to reduce number of allocations of particles for cell lookup routines.
Definition OpenMCCellAverageProblem.h:1094
const bool _has_identical_cell_fills
Definition OpenMCCellAverageProblem.h:889
virtual Real cellVolume(const cellInfo &cell_info) const
void relaxAndNormalizeTally(unsigned int global_score, unsigned int local_score, std::shared_ptr< TallyBase > local_tally)
static constexpr int DIMENSION
Spatial dimension of the Monte Carlo problem.
Definition OpenMCCellAverageProblem.h:405
virtual const OpenMCVolumeCalculation * volumeCalculation() const
Definition OpenMCCellAverageProblem.h:118
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:962
unsigned int _source_rate_index
Index in tally_score pointing to the score used for normalizing flux tallies in eigenvalue mode.
Definition OpenMCCellAverageProblem.h:1127
bool _needs_to_map_cells
Whether any spatial mapping from OpenMC's cells to the mesh is needed.
Definition OpenMCCellAverageProblem.h:931
std::vector< std::string > getMaterialInEachSubdomain() const
static constexpr Real EV_TO_JOULE
Conversion rate from eV to Joule.
Definition OpenMCCellAverageProblem.h:1154
void reloadDAGMC()
Reconstruct the DAGMC geometry after skinning.
int32_t elemToCellIndex(const int &elem_id) const
Definition OpenMCCellAverageProblem.h:242
static bool _printed_triso_warning
Whether a warning has already been printed about very long setup times (for TRISOs)
Definition OpenMCCellAverageProblem.h:1091
bool _has_cell_tallies
Whether any cell tallies exist.
Definition OpenMCCellAverageProblem.h:928
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:1103
coupling::CouplingFields cellFeedback(const cellInfo &cell_info) const
void mapElemsToCells()
Populate maps of MOOSE elements to OpenMC cells.
void addTally(const std::string &type, const std::string &name, InputParameters &moose_object_pars)
void checkContainedCellsStructure(const cellInfo &cell_info, containedCells &reference, containedCells &compare) const
std::string printNewline() const
For keeping the output neat when using verbose.
Definition OpenMCCellAverageProblem.h:610
std::vector< const VariableValue * > getTallyScoreVariableValues(const std::string &score, THREAD_ID tid)
int32_t _cell_using_dagmc_universe_id
ID of the OpenMC cell corresponding to the cell which uses the DAGMC universe as a fill.
Definition OpenMCCellAverageProblem.h:1147
unsigned int _n_particles_1
Number of particles simulated in the first iteration.
Definition OpenMCCellAverageProblem.h:1097
int _n_mapped_density_elems
Definition OpenMCCellAverageProblem.h:1001
std::vector< Real > _global_sum_tally
Sum value of the global tally(s), across all bins.
Definition OpenMCCellAverageProblem.h:1076
unsigned int getCellLevel(const Point &c) const
void addFilter(const std::string &type, const std::string &name, InputParameters &moose_object_pars)
virtual std::unordered_set< SubdomainID > getCellToElementSub(const cellInfo &info)
Definition OpenMCCellAverageProblem.h:134
void cacheContainedCells()
static InputParameters validParams()
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:1082
std::map< SubdomainID, std::set< int32_t > > _subdomain_to_material
Mapping of elem subdomains to materials.
Definition OpenMCCellAverageProblem.h:1028
static bool _first_transfer
Whether the present transfer is the first transfer.
Definition OpenMCCellAverageProblem.h:1085
bool _dagmc_root_universe
Whether the DAGMC universe is the root universe or not.
Definition OpenMCCellAverageProblem.h:1144
std::map< cellInfo, containedCells > _cell_to_contained_material_cells
Definition OpenMCCellAverageProblem.h:1058
bool cellHasIdenticalFill(const cellInfo &cell_info) const
static bool _printed_initial
Whether the diagnostic tables on initialization have already been printed.
Definition OpenMCCellAverageProblem.h:1088
const bool & _export_properties
Definition OpenMCCellAverageProblem.h:807
bool _need_to_reinit_coupling
Definition OpenMCCellAverageProblem.h:838
int32_t cellToMaterialIndex(const cellInfo &cell_info) const
Definition OpenMCCellAverageProblem.h:274
std::map< cellInfo, int > _n_rho
Number of density-only feedback elements in each mapped OpenMC cell (global)
Definition OpenMCCellAverageProblem.h:1115
std::map< cellInfo, Point > _cell_to_point
Definition OpenMCCellAverageProblem.h:1034
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:1100
long unsigned int _n_openmc_cells
Total number of unique OpenMC cell IDs + instances combinations.
Definition OpenMCCellAverageProblem.h:1138
void subdomainsToMaterials()
Loop over the mapped cells, and build a map between subdomains to OpenMC materials.
void gatherCellSum(std::vector< T > &local, std::map< cellInfo, T > &global) const
int _n_moose_temp_elems
Number of elements in the MOOSE mesh that exclusively provide temperature feedback.
Definition OpenMCCellAverageProblem.h:983
void read2DBlockParameters(const std::string name, std::vector< std::vector< SubdomainName > > &names, std::vector< SubdomainID > &flattened_ids)
std::vector< std::vector< std::string > > _global_tally_scores
Global tally scores corresponding to '_global_tallies'.
Definition OpenMCCellAverageProblem.h:1070
void checkBlocksInMesh(const std::string name, const std::vector< SubdomainID > &ids, const std::vector< SubdomainName > &names) const
const coupling::OpenMCInitialCondition _initial_condition
Definition OpenMCCellAverageProblem.h:783
const bool _check_tally_sum
Definition OpenMCCellAverageProblem.h:853
std::map< cellInfo, int > _n_temp
Number of temperature-only feedback elements in each mapped OpenMC cell (global)
Definition OpenMCCellAverageProblem.h:1112
std::vector< std::shared_ptr< TallyBase > > _local_tallies
A vector of the tally objects created by the [Problem/Tallies] block.
Definition OpenMCCellAverageProblem.h:946
Point transformPointToOpenMC(const Point &pt) const
int32_t elemToCellInstance(const int &elem_id) const
Definition OpenMCCellAverageProblem.h:257
void checkTallySum(const unsigned int &score) const
virtual Point transformPoint(const Point &pt) const
Definition OpenMCCellAverageProblem.h:198
void updateOpenMCGeometry()
virtual void addExternalVariables() override
cellInfo firstContainedMaterialCell(const cellInfo &cell_info) const
Real tallyMultiplier(unsigned int global_score) const
std::vector< openmc::Tally * > _global_tallies
Definition OpenMCCellAverageProblem.h:1067
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:949
std::unordered_set< SubdomainID > _identical_cell_fill_blocks
Blocks for which the cell fills are identical.
Definition OpenMCCellAverageProblem.h:971
void readBlockParameters(const std::string name, std::unordered_set< SubdomainID > &blocks)
containedCells containedMaterialCells(const cellInfo &cell_info) const
void setMinimumVolumeQRules(Order &volume_order, const std::string &type)
bool cellMapsToSubdomain(const cellInfo &cell_info, const std::unordered_set< SubdomainID > &id) const
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:1019
coupling::CouplingFields elemFeedback(const Elem *elem) const
std::map< cellInfo, int32_t > _cell_to_n_contained
Number of material-type cells contained within a cell.
Definition OpenMCCellAverageProblem.h:1061
virtual void syncSolutions(ExternalProblem::Direction direction) override
Set the 'mesh changed' adaptivity flag.
virtual void externalSolve() override
cellInfo elemToCellInfo(const int &elem_id) const
Definition OpenMCCellAverageProblem.h:265
double cellTemperature(const cellInfo &cell_info) const
virtual bool hasPointTransformations() const
Definition OpenMCCellAverageProblem.h:143
int fixedPointIteration() const
Definition OpenMCCellAverageProblem.h:393
const int32_t _initial_num_openmc_surfaces
Definition OpenMCCellAverageProblem.h:1151
void initializeTallies()
Add OpenMC tallies to facilitate the coupling.
const bool _normalize_by_global
Definition OpenMCCellAverageProblem.h:828
std::map< cellInfo, int32_t > _cell_to_material
Definition OpenMCCellAverageProblem.h:1052
virtual void updateMaterials()
std::map< cellInfo, Real > _cell_volume
Definition OpenMCCellAverageProblem.h:1046
std::vector< const TallyBase * > getTalliesByScore(const std::string &score)
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:1022
const bool & _output_cell_mapping
Definition OpenMCCellAverageProblem.h:775
const bool & _assume_separate_tallies
Definition OpenMCCellAverageProblem.h:906
virtual const std::map< cellInfo, std::vector< unsigned int > > & cellToElem() const
Definition OpenMCCellAverageProblem.h:124
virtual const std::vector< std::string > & getTallyScores() const
Definition OpenMCCellAverageProblem.h:149
OpenMCVolumeCalculation * _volume_calc
Optional volume calculation for cells which map to MOOSE.
Definition OpenMCCellAverageProblem.h:1106
std::shared_ptr< FilterBase > & getFilter(const std::string &filter_name)
Definition OpenMCCellAverageProblem.h:325
void getTallyTriggerParameters(const InputParameters ¶ms)
std::map< std::string, std::shared_ptr< FilterBase > > _filters
Definition OpenMCCellAverageProblem.h:943
void getMaterialFills()
Find the material filling each cell which receives density feedback.
void latticeOuterError(const Point &c, int level) const
void compareContainedCells(std::map< cellInfo, containedCells > &reference, std::map< cellInfo, containedCells > &compare) const
bool _material_cells_only
Whether non-material cells are mapped.
Definition OpenMCCellAverageProblem.h:1016
const bool _using_skinner
Whether or not the problem uses a skinner to regenerate the OpenMC geometry.
Definition OpenMCCellAverageProblem.h:831
void storeElementPhase()
Loop over the elements in the MOOSE mesh and store the type of feedback applied by each.
std::vector< const VariableValue * > getTallyScoreNeighborVariableValues(const std::string &score, THREAD_ID tid)
void gatherCellVector(std::vector< T > &local, std::vector< unsigned int > &n_local, std::map< cellInfo, std::vector< T > > &global)
std::vector< Real > _local_sum_tally
Sum value of the local tally(s), across all bins.
Definition OpenMCCellAverageProblem.h:1079
void checkNormalization(const Real &sum, unsigned int global_score) const
virtual std::vector< int32_t > getMappedTallyIDs() const override
Definition OpenMCProblemBase.h:53
int _fixed_point_iteration
Definition OpenMCProblemBase.h:454
const bool & _verbose
Whether to print diagnostic information about model setup and the transfers.
Definition OpenMCProblemBase.h:404
int32_t cellID(const int32_t index) const
std::pair< int32_t, int32_t > cellInfo
Definition OpenMCProblemBase.h:197
const bool _has_adaptivity
Whether or not the problem contains mesh adaptivity.
Definition OpenMCProblemBase.h:486
Definition OpenMCVolumeCalculation.h:31
Definition SymmetryPointGenerator.h:29
Point transformPoint(const Point &p) const
Definition SymmetryPointGenerator.C:100
OpenMCInitialCondition
Where to get the initial temperature and density settings for OpenMC.
Definition CardinalEnums.h:221
CouplingFields
Type of feedback in Monte Carlo simulation.
Definition CardinalEnums.h:212
@ density
Definition CardinalEnums.h:214
@ density_and_temperature
Definition CardinalEnums.h:215
@ temperature
Definition CardinalEnums.h:213
Definition CardinalEnums.h:69
RelaxationEnum
Type of relaxation.
Definition CardinalEnums.h:244
TallyTriggerTypeEnum
Type of trigger to apply.
Definition CardinalEnums.h:172