Cardinal
OpenMCCellAverageProblem.h
Go to the documentation of this file.
1 /********************************************************************/
2 /* SOFTWARE COPYRIGHT NOTIFICATION */
3 /* Cardinal */
4 /* */
5 /* (c) 2021 UChicago Argonne, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by UChicago Argonne, LLC */
9 /* Under Contract No. DE-AC02-06CH11357 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* Prepared by Battelle Energy Alliance, LLC */
13 /* Under Contract No. DE-AC07-05ID14517 */
14 /* With the U. S. Department of Energy */
15 /* */
16 /* See LICENSE for full restrictions */
17 /********************************************************************/
18 
19 #pragma once
20 
21 #include "OpenMCProblemBase.h"
22 #include "SymmetryPointGenerator.h"
23 
25 #include "TallyBase.h"
26 #include "FilterBase.h"
27 
28 #ifdef ENABLE_DAGMC
29 #include "MoabSkinner.h"
30 #include "DagMC.hpp"
31 #endif
32 
36 
68 {
69 public:
70  OpenMCCellAverageProblem(const InputParameters & params);
71  static InputParameters validParams();
72 
73  virtual void initialSetup() override;
74  virtual void externalSolve() override;
75  virtual void syncSolutions(ExternalProblem::Direction direction) override;
76  virtual bool converged(unsigned int) override { return true; }
77 
85  void read2DBlockParameters(const std::string name,
86  std::vector<std::vector<SubdomainName>> & names,
87  std::vector<SubdomainID> & flattened_ids);
88 
95  void checkBlocksInMesh(const std::string name,
96  const std::vector<SubdomainID> & ids,
97  const std::vector<SubdomainName> & names) const;
98 
100  void setupProblem();
101 
106  virtual void addExternalVariables() override;
107 
113  virtual Real cellVolume(const cellInfo & cell_info) const;
114 
119  virtual const OpenMCVolumeCalculation * volumeCalculation() const { return _volume_calc; }
120 
125  virtual const std::map<cellInfo, std::vector<unsigned int>> & cellToElem() const
126  {
127  return _cell_to_elem;
128  }
129 
135  virtual std::unordered_set<SubdomainID> getCellToElementSub(const cellInfo & info)
136  {
137  return _cell_to_elem_subdomain.at(info);
138  }
139 
144  virtual bool hasPointTransformations() const { return _symmetry != nullptr; }
145 
150  virtual const std::vector<std::string> & getTallyScores() const { return _all_tally_scores; }
151 
157  unsigned int getNumScoringTallies(const std::string & score) const
158  {
159  return _score_count.count(score) > 0 ? _score_count.at(score) : 0;
160  }
161 
167  bool hasScore(const std::string & score)
168  {
169  return std::find(_all_tally_scores.begin(), _all_tally_scores.end(), score) !=
170  _all_tally_scores.end();
171  }
172 
178  const TallyBase * getTally(const std::string & name);
179 
190  std::vector<const MooseVariableFE<Real> *> getTallyScoreVariables(const std::string & score,
191  const std::string & tally_name,
192  THREAD_ID tid,
193  const std::string & output = "",
194  bool skip_func_exp = false);
195 
206  std::vector<const VariableValue *> getTallyScoreVariableValues(const std::string & score,
207  const std::string & tally_name,
208  THREAD_ID tid,
209  const std::string & output = "",
210  bool skip_func_exp = false);
211 
222  std::vector<const VariableValue *>
223  getTallyScoreNeighborVariableValues(const std::string & score,
224  const std::string & tally_name,
225  THREAD_ID tid,
226  const std::string & output = "",
227  bool skip_func_exp = false);
228 
236  bool hasOutput(const std::string & score, const std::string & output) const;
237 
243  virtual Point transformPoint(const Point & pt) const
244  {
245  return this->hasPointTransformations() ? _symmetry->transformPoint(pt) : pt;
246  }
247 
269  virtual void createQRules(QuadratureType type,
270  Order order,
271  Order volume_order,
272  Order face_order,
273  SubdomainID block,
274  bool allow_negative_weights = true) override;
275 
280  typedef std::unordered_map<int32_t, std::vector<int32_t>> containedCells;
281 
287  int32_t elemToCellIndex(const int & elem_id) const { return elemToCellInfo(elem_id).first; }
288 
295  int32_t elemToCellID(const int & elem_id) const { return cellID(elemToCellIndex(elem_id)); }
296 
302  int32_t elemToCellInstance(const int & elem_id) const { return elemToCellInfo(elem_id).second; }
303 
310  cellInfo elemToCellInfo(const int & elem_id) const { return _elem_to_cell[elem_id]; }
311 
320  coupling::CouplingFields cellFeedback(const cellInfo & cell_info) const;
321 
327  bool hasDensityFeedback(const cellInfo & cell_info) const
328  {
329  std::vector<coupling::CouplingFields> phase = {coupling::density,
331  return std::find(phase.begin(), phase.end(), cellFeedback(cell_info)) != phase.end();
332  }
333 
339  bool hasTemperatureFeedback(const cellInfo & cell_info) const
340  {
341  std::vector<coupling::CouplingFields> phase = {coupling::temperature,
343  return std::find(phase.begin(), phase.end(), cellFeedback(cell_info)) != phase.end();
344  }
345 
351  bool hasFilter(const std::string & filter_name) const { return _filters.count(filter_name) > 0; }
352 
358  std::shared_ptr<FilterBase> & getFilter(const std::string & filter_name)
359  {
360  return _filters.at(filter_name);
361  }
362 
367  const std::vector<std::shared_ptr<TallyBase>> & getLocalTallies() const { return _local_tallies; }
368 
374  double cellTemperature(const cellInfo & cell_info) const;
375 
382  double cellDensity(const cellInfo & cell_info, const Elem * elem) const;
383 
388  double cellMappedVolume(const cellInfo & cell_info) const;
389 
391  void reloadDAGMC();
392 
399  void addFilter(const std::string & type,
400  const std::string & name,
401  InputParameters & moose_object_pars);
402 
410  std::shared_ptr<TallyBase>
411  addTally(const std::string & type, const std::string & name, InputParameters & moose_object_pars);
412 
422  Real tallyMultiplier(const std::string & score_name, const Real & local_mean_tally) const;
423 
429  const Real getReferenceDensity(const Elem * elem) const;
430 
436  template <typename T>
437  void checkEmptyVector(const std::vector<T> & vector, const std::string & name) const
438  {
439  if (vector.empty())
440  mooseError(name + " cannot be empty!");
441  }
442 
444 
449  bool hasAdaptivity() const { return _has_adaptivity; }
450 
455  bool hasSkinner() const { return _using_skinner; }
456 
458  static constexpr int32_t UNMAPPED{-1};
459 
461  static constexpr int DIMENSION{3};
462 
464  virtual MooseMesh & getMooseMesh();
465 
467  virtual const MooseMesh & getMooseMesh() const;
468 
473  const bool & useDisplaced() const { return _use_displaced; }
474 
480  int numContainedMaterialCells(const cellInfo & cell_info) const;
481 
487  cellInfo firstContainedMaterialCell(const cellInfo & cell_info) const;
488 
489 protected:
505 
512  virtual void critSearchStep() override;
513 
519  unsigned int getCellLevel(const Point & c) const;
520 
529  void
530  readBlockVariables(const std::string & param,
531  const std::string & default_name,
532  std::map<std::string, std::vector<SubdomainName>> & vars_to_specified_blocks,
533  std::vector<SubdomainID> & specified_blocks);
534 
540  bool cellHasIdenticalFill(const cellInfo & cell_info) const;
541 
551  int containedCellInstanceShift(const cellInfo & cell_info,
552  int32_t cc_idx,
553  int32_t cc_instance_idx_to_shift) const;
554 
561  const containedCells & unshiftedContainedCells(const cellInfo & cell_info) const;
562 
569  bool cellMapsToSubdomain(const cellInfo & cell_info,
570  const std::unordered_set<SubdomainID> & id) const;
571 
575  void updateOpenMCGeometry();
576 
582  std::vector<std::string> getMaterialInEachSubdomain() const;
583 
589  Point transformPointToOpenMC(const Point & pt) const;
590 
600  void
601  printTrisoHelp(const std::chrono::time_point<std::chrono::high_resolution_clock> & start) const;
602 
609  void printAuxVariableIO();
610 
616  std::vector<int32_t> materialsInCells(const containedCells & contained_cells) const;
617 
619  void subdomainsToMaterials();
620 
625  std::set<SubdomainID> coupledSubdomains() const;
626 
632  template <typename T>
633  void gatherCellSum(std::vector<T> & local, std::map<cellInfo, T> & global) const;
634 
641  template <typename T>
642  void gatherCellVector(std::vector<T> & local,
643  std::vector<unsigned int> & n_local,
644  std::map<cellInfo, std::vector<T>> & global);
645 
651  coupling::CouplingFields elemFeedback(const Elem * elem) const;
652 
657  void getTallyTriggerParameters(const InputParameters & params);
658 
664  void readBlockParameters(const std::string name, std::unordered_set<SubdomainID> & blocks);
665 
671  void cacheContainedCells();
672 
679  void setContainedCells(const cellInfo & cell_info,
680  const Point & hint,
681  std::map<cellInfo, containedCells> & map);
682 
691  void checkContainedCellsStructure(const cellInfo & cell_info,
692  containedCells & reference,
693  containedCells & compare) const;
694 
700  void setMinimumVolumeQRules(Order & volume_order, const std::string & type);
701 
703  std::string printNewline() const
704  {
705  if (_verbose)
706  return "\n";
707  else
708  return "";
709  }
710 
712  void storeElementPhase();
713 
718  void getCellMappedPhase();
719 
721  void checkCellMappedPhase();
722 
725 
731 
734 
736  void mapElemsToCells();
737 
743  void validateLocalTallies();
744 
746  void initializeTallies();
747 
752  void resetTallies();
753 
759  void getPointInCell();
760 
768  std::map<cellInfo, Real> computeVolumeWeightedCellInput(
769  const std::map<SubdomainID, std::pair<unsigned int, std::string>> & var_num,
770  const std::vector<coupling::CouplingFields> * phase = nullptr,
771  const std::map<SubdomainID, Real> * scaling = nullptr) const;
772 
777  void sendTemperatureToOpenMC() const;
778 
783  void sendDensityToOpenMC() const;
784 
790  void latticeOuterCheck(const Point & c, int level) const;
791 
797  void latticeOuterError(const Point & c, int level) const;
798 
804  bool findCell(const Point & point);
805 
814  void compareContainedCells(std::map<cellInfo, containedCells> & reference,
815  std::map<cellInfo, containedCells> & compare) const;
816 
821  virtual std::vector<int32_t> getMappedTallyIDs() const override;
822 
824  NumericVector<Number> & _serialized_solution;
825 
830  const bool & _output_cell_mapping;
831 
839 
842 
850 
856  unsigned int _cell_level;
857 
862  const bool & _export_properties;
863 
865  const bool _using_skinner;
866 
873 
906 
914 
923 
929 
935 
942 
944  bool _has_cell_tallies = false;
945 
948 
953  std::map<std::string, std::shared_ptr<FilterBase>> _filters;
954 
956  std::vector<std::shared_ptr<TallyBase>> _local_tallies;
957 
959  std::vector<std::string> _all_tally_scores;
960 
962  std::map<std::string, unsigned int> _score_count;
963 
965  std::vector<std::vector<unsigned int>> _tally_var_ids;
966 
968  std::vector<std::vector<std::vector<unsigned int>>> _tally_ext_var_ids;
969 
971  std::vector<SubdomainID> _density_blocks;
972 
974  std::vector<SubdomainID> _temp_blocks;
975 
977  std::unordered_set<SubdomainID> _identical_cell_fill_blocks;
978 
980  std::vector<cellInfo> _elem_to_cell{};
981 
983  std::map<cellInfo, coupling::CouplingFields> _cell_phase;
984 
987 
990 
993 
996 
1002 
1008 
1014 
1017 
1020 
1023 
1025  std::map<cellInfo, std::vector<unsigned int>> _cell_to_elem;
1026 
1028  std::map<cellInfo, std::vector<unsigned int>> _local_cell_to_elem;
1029 
1031  std::map<cellInfo, std::unordered_set<SubdomainID>> _cell_to_elem_subdomain;
1032 
1034  std::map<SubdomainID, std::set<int32_t>> _subdomain_to_material;
1035 
1040  std::map<cellInfo, Point> _cell_to_point;
1041 
1046  std::map<cellInfo, Real> _cell_to_elem_volume;
1047 
1052  std::map<cellInfo, Real> _cell_volume;
1053 
1058  std::map<cellInfo, containedCells> _cell_to_contained_material_cells;
1059 
1061  std::map<cellInfo, int32_t> _cell_to_n_contained;
1062 
1064  static bool _first_transfer;
1065 
1067  static bool _printed_initial;
1068 
1071 
1073  openmc::Particle _particle;
1074 
1076  unsigned int _n_particles_1;
1077 
1079  std::map<std::string, std::vector<SubdomainName>> _temp_vars_to_blocks;
1080 
1082  std::map<std::string, std::vector<SubdomainName>> _density_vars_to_blocks;
1083 
1086 
1089 
1091  std::map<cellInfo, int> _n_temp;
1092 
1094  std::map<cellInfo, int> _n_rho;
1095 
1097  std::map<cellInfo, int> _n_temp_rho;
1098 
1100  std::map<cellInfo, int> _n_none;
1101 
1103  std::shared_ptr<TallyBase> _source_rate_norm_tally;
1104 
1107 
1108 #ifdef ENABLE_DAGMC
1109  MoabSkinner * _skinner = nullptr;
1111 
1113  std::shared_ptr<moab::DagMC> _dagmc = nullptr;
1114 #endif
1115 
1117  long unsigned int _n_openmc_cells;
1118 
1121 
1124 
1127 
1131 
1133  static constexpr Real EV_TO_JOULE = 1.6022e-19;
1134 
1136  static constexpr Real ZERO_TALLY_THRESHOLD = 1e-12;
1137 
1138 private:
1142  void dufekGudowskiParticleUpdate();
1143 
1145  std::vector<int32_t> _flattened_ids;
1146 
1148  std::vector<int32_t> _flattened_instances;
1149 
1151  containedCells _instance_offsets;
1152 
1154  std::map<cellInfo, int32_t> _n_offset;
1155 
1157  cellInfo _first_identical_cell;
1158 
1160  std::vector<int32_t> _first_identical_cell_materials;
1161 
1163  bool _use_displaced;
1164 
1166  std::map<SubdomainID, std::pair<unsigned int, std::string>> _subdomain_to_temp_vars;
1167 
1169  std::map<SubdomainID, std::pair<unsigned int, std::string>> _subdomain_to_density_vars;
1170 
1172  std::map<SubdomainID, Real> _subdomain_to_ref_density;
1173 
1175  std::map<int32_t, OpenMCCellMaterialFill *> _cell_material_modifiers;
1176 };
std::vector< const VariableValue * > getTallyScoreNeighborVariableValues(const std::string &score, const std::string &tally_name, THREAD_ID tid, const std::string &output="", bool skip_func_exp=false)
TallyTriggerTypeEnum
Type of trigger to apply.
Definition: CardinalEnums.h:190
int _source_rate_score
The score index into "_source_rate_norm_tally".
Definition: OpenMCCellAverageProblem.h:1106
const bool _has_identical_cell_fills
Definition: OpenMCCellAverageProblem.h:905
const trigger::TallyTriggerTypeEnum _k_trigger
Definition: OpenMCCellAverageProblem.h:849
int32_t elemToCellIndex(const int &elem_id) const
Definition: OpenMCCellAverageProblem.h:287
bool findCell(const Point &point)
int _n_moose_none_elems
Number of no-coupling elements in the MOOSE mesh.
Definition: OpenMCCellAverageProblem.h:995
void sendTemperatureToOpenMC() const
const containedCells & unshiftedContainedCells(const cellInfo &cell_info) const
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:1082
static bool _first_transfer
Whether the present transfer is the first transfer.
Definition: OpenMCCellAverageProblem.h:1064
Definition: CardinalEnums.h:234
int _fixed_point_iteration
Definition: OpenMCProblemBase.h:532
const bool _specified_temperature_feedback
Definition: OpenMCCellAverageProblem.h:941
void checkEmptyVector(const std::vector< T > &vector, const std::string &name) const
Definition: OpenMCCellAverageProblem.h:437
bool hasScore(const std::string &score)
Definition: OpenMCCellAverageProblem.h:167
std::unordered_map< int32_t, std::vector< int32_t > > containedCells
Definition: OpenMCCellAverageProblem.h:280
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:1079
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:968
void storeElementPhase()
Loop over the elements in the MOOSE mesh and store the type of feedback applied by each.
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:1028
const relaxation::RelaxationEnum _relaxation
Type of relaxation to apply to the OpenMC tallies.
Definition: OpenMCCellAverageProblem.h:841
std::shared_ptr< TallyBase > _source_rate_norm_tally
The tally to be used for normalizing all other tallies when running an eigenvalue calculation.
Definition: OpenMCCellAverageProblem.h:1103
std::vector< std::vector< unsigned int > > _tally_var_ids
A vector of auxvariable ids added by the [Tallies] block.
Definition: OpenMCCellAverageProblem.h:965
void checkContainedCellsStructure(const cellInfo &cell_info, containedCells &reference, containedCells &compare) const
int _n_moose_density_elems
Number of elements in the MOOSE mesh that exclusively provide density feedback.
Definition: OpenMCCellAverageProblem.h:986
static InputParameters validParams()
int _n_mapped_temp_density_elems
Definition: OpenMCCellAverageProblem.h:1013
Real _uncoupled_volume
Total volume of uncoupled MOOSE mesh elements.
Definition: OpenMCCellAverageProblem.h:1019
std::map< cellInfo, int > _n_rho
Number of density-only feedback elements in each mapped OpenMC cell (global)
Definition: OpenMCCellAverageProblem.h:1094
NumericVector< Number > & _serialized_solution
A reference to the serialized auxvariable solution.
Definition: OpenMCCellAverageProblem.h:824
OpenMCCellAverageProblem(const InputParameters &params)
int _n_moose_temp_density_elems
Number of elements in the MOOSE mesh which provide temperature+density feedback.
Definition: OpenMCCellAverageProblem.h:992
void initializeTallies()
Add OpenMC tallies to facilitate the coupling.
int numContainedMaterialCells(const cellInfo &cell_info) const
void readBlockVariables(const std::string &param, const std::string &default_name, std::map< std::string, std::vector< SubdomainName >> &vars_to_specified_blocks, std::vector< SubdomainID > &specified_blocks)
std::string printNewline() const
For keeping the output neat when using verbose.
Definition: OpenMCCellAverageProblem.h:703
std::map< cellInfo, int > _n_none
Number of none elements in each mapped OpenMC cell (global)
Definition: OpenMCCellAverageProblem.h:1100
std::map< cellInfo, Real > computeVolumeWeightedCellInput(const std::map< SubdomainID, std::pair< unsigned int, std::string >> &var_num, const std::vector< coupling::CouplingFields > *phase=nullptr, const std::map< SubdomainID, Real > *scaling=nullptr) const
bool hasSkinner() const
Definition: OpenMCCellAverageProblem.h:455
std::vector< int32_t > materialsInCells(const containedCells &contained_cells) const
void printTrisoHelp(const std::chrono::time_point< std::chrono::high_resolution_clock > &start) const
virtual void externalSolve() override
double cellTemperature(const cellInfo &cell_info) const
virtual void syncSolutions(ExternalProblem::Direction direction) override
Set the 'mesh changed' adaptivity flag.
std::vector< SubdomainID > _temp_blocks
Blocks in MOOSE mesh that provide temperature feedback.
Definition: OpenMCCellAverageProblem.h:974
bool hasTemperatureFeedback(const cellInfo &cell_info) const
Definition: OpenMCCellAverageProblem.h:339
virtual std::unordered_set< SubdomainID > getCellToElementSub(const cellInfo &info)
Definition: OpenMCCellAverageProblem.h:135
bool hasFilter(const std::string &filter_name) const
Definition: OpenMCCellAverageProblem.h:351
bool hasOutput(const std::string &score, const std::string &output) const
std::vector< const MooseVariableFE< Real > * > getTallyScoreVariables(const std::string &score, const std::string &tally_name, THREAD_ID tid, const std::string &output="", bool skip_func_exp=false)
bool _needs_to_map_cells
Whether any spatial mapping from OpenMC's cells to the mesh is needed.
Definition: OpenMCCellAverageProblem.h:947
Definition: CardinalEnums.h:232
Definition: OpenMCCellAverageProblem.h:67
double cellDensity(const cellInfo &cell_info, const Elem *elem) const
int _n_mapped_density_elems
Definition: OpenMCCellAverageProblem.h:1007
bool hasDensityFeedback(const cellInfo &cell_info) const
Definition: OpenMCCellAverageProblem.h:327
bool _map_density_by_cell
Definition: OpenMCCellAverageProblem.h:928
const bool _has_adaptivity
Whether or not the problem contains mesh adaptivity.
Definition: OpenMCProblemBase.h:567
std::map< cellInfo, int > _n_temp
Number of temperature-only feedback elements in each mapped OpenMC cell (global)
Definition: OpenMCCellAverageProblem.h:1091
void sendDensityToOpenMC() const
virtual const std::vector< std::string > & getTallyScores() const
Definition: OpenMCCellAverageProblem.h:150
const bool & useDisplaced() const
Definition: OpenMCCellAverageProblem.h:473
void initializeElementToCellMapping()
Set up the mapping from MOOSE elements to OpenMC cells.
int _n_mapped_none_elems
Number of no-coupling elements mapped to OpenMC cells.
Definition: OpenMCCellAverageProblem.h:1016
int _n_mapped_temp_elems
Definition: OpenMCCellAverageProblem.h:1001
unsigned int getNumScoringTallies(const std::string &score) const
Definition: OpenMCCellAverageProblem.h:157
void checkCellMappedPhase()
This function is used to ensure that each OpenMC cell only maps to a single phase.
int containedCellInstanceShift(const cellInfo &cell_info, int32_t cc_idx, int32_t cc_instance_idx_to_shift) const
bool _material_cells_only
Whether non-material cells are mapped.
Definition: OpenMCCellAverageProblem.h:1022
Point transformPointToOpenMC(const Point &pt) const
unsigned int _cell_level
Definition: OpenMCCellAverageProblem.h:856
int32_t elemToCellID(const int &elem_id) const
Definition: OpenMCCellAverageProblem.h:295
std::map< cellInfo, containedCells > _cell_to_contained_material_cells
Definition: OpenMCCellAverageProblem.h:1058
long unsigned int _n_openmc_cells
Total number of unique OpenMC cell IDs + instances combinations.
Definition: OpenMCCellAverageProblem.h:1117
void gatherCellSum(std::vector< T > &local, std::map< cellInfo, T > &global) const
bool hasAdaptivity() const
Definition: OpenMCCellAverageProblem.h:449
std::map< cellInfo, int32_t > _cell_to_n_contained
Number of material-type cells contained within a cell.
Definition: OpenMCCellAverageProblem.h:1061
Real tallyMultiplier(const std::string &score_name, const Real &local_mean_tally) const
OpenMCInitialCondition
Where to get the initial temperature and density settings for OpenMC.
Definition: CardinalEnums.h:239
void subdomainsToMaterials()
Loop over the mapped cells, and build a map between subdomains to OpenMC materials.
const bool & _assume_separate_tallies
Definition: OpenMCCellAverageProblem.h:922
const bool & _check_identical_cell_fills
Definition: OpenMCCellAverageProblem.h:913
void readBlockParameters(const std::string name, std::unordered_set< SubdomainID > &blocks)
int fixedPointIteration() const
Definition: OpenMCCellAverageProblem.h:443
const SymmetryPointGenerator * _symmetry
Userobject that maps from a partial-symmetry OpenMC model to a whole-domain [Mesh].
Definition: OpenMCCellAverageProblem.h:1088
const bool & _output_cell_mapping
Definition: OpenMCCellAverageProblem.h:830
Definition: CardinalEnums.h:233
std::set< SubdomainID > coupledSubdomains() const
std::vector< std::string > getMaterialInEachSubdomain() const
std::vector< std::shared_ptr< TallyBase > > _local_tallies
A vector of the tally objects created by the [Problem/Tallies] block.
Definition: OpenMCCellAverageProblem.h:956
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:1025
virtual std::vector< int32_t > getMappedTallyIDs() const override
double cellMappedVolume(const cellInfo &cell_info) const
coupling::CouplingFields cellFeedback(const cellInfo &cell_info) const
std::vector< SubdomainID > _density_blocks
Blocks in MOOSE mesh that provide density feedback.
Definition: OpenMCCellAverageProblem.h:971
int32_t cellID(const int32_t index) const
static constexpr int DIMENSION
Spatial dimension of the Monte Carlo problem.
Definition: OpenMCCellAverageProblem.h:461
RelaxationEnum
Type of relaxation.
Definition: CardinalEnums.h:273
std::vector< cellInfo > _elem_to_cell
Mapping of MOOSE elements to the OpenMC cell they map to (if any)
Definition: OpenMCCellAverageProblem.h:980
const std::vector< std::shared_ptr< TallyBase > > & getLocalTallies() const
Definition: OpenMCCellAverageProblem.h:367
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:1126
openmc::Particle _particle
Dummy particle to reduce number of allocations of particles for cell lookup routines.
Definition: OpenMCCellAverageProblem.h:1073
const Real & scaling() const
Definition: OpenMCProblemBase.h:113
Definition: OpenMCProblemBase.h:58
bool cellHasIdenticalFill(const cellInfo &cell_info) const
Definition: TallyBase.h:35
virtual const OpenMCVolumeCalculation * volumeCalculation() const
Definition: OpenMCCellAverageProblem.h:119
void setContainedCells(const cellInfo &cell_info, const Point &hint, std::map< cellInfo, containedCells > &map)
bool cellMapsToSubdomain(const cellInfo &cell_info, const std::unordered_set< SubdomainID > &id) const
Definition: CardinalEnums.h:72
static bool _printed_initial
Whether the diagnostic tables on initialization have already been printed.
Definition: OpenMCCellAverageProblem.h:1067
std::map< std::string, unsigned int > _score_count
Number of tallies scoring a particular score.
Definition: OpenMCCellAverageProblem.h:962
OpenMCVolumeCalculation * _volume_calc
Optional volume calculation for cells which map to MOOSE.
Definition: OpenMCCellAverageProblem.h:1085
void getTallyTriggerParameters(const InputParameters &params)
bool _has_cell_tallies
Whether any cell tallies exist.
Definition: OpenMCCellAverageProblem.h:944
std::map< cellInfo, Real > _cell_volume
Definition: OpenMCCellAverageProblem.h:1052
Definition: OpenMCVolumeCalculation.h:30
const bool _specified_density_feedback
Definition: OpenMCCellAverageProblem.h:934
virtual bool converged(unsigned int) override
Definition: OpenMCCellAverageProblem.h:76
std::map< cellInfo, int > _n_temp_rho
Number of temperature+density feedback elements in each mapped OpenMC cell (global)
Definition: OpenMCCellAverageProblem.h:1097
void setupProblem()
Initialize the mapping of OpenMC to the MooseMesh and perform additional setup actions.
bool _need_to_reinit_coupling
Definition: OpenMCCellAverageProblem.h:872
virtual bool hasPointTransformations() const
Definition: OpenMCCellAverageProblem.h:144
std::map< cellInfo, Point > _cell_to_point
Definition: OpenMCCellAverageProblem.h:1040
static constexpr Real EV_TO_JOULE
Conversion rate from eV to Joule.
Definition: OpenMCCellAverageProblem.h:1133
virtual void createQRules(QuadratureType type, Order order, Order volume_order, Order face_order, SubdomainID block, bool allow_negative_weights=true) override
const TallyBase * getTally(const std::string &name)
std::shared_ptr< FilterBase > & getFilter(const std::string &filter_name)
Definition: OpenMCCellAverageProblem.h:358
virtual Real cellVolume(const cellInfo &cell_info) const
void reloadDAGMC()
Reconstruct the DAGMC geometry after skinning.
CouplingFields
Type of feedback in Monte Carlo simulation.
Definition: CardinalEnums.h:230
const bool _using_skinner
Whether or not the problem uses a skinner to regenerate the OpenMC geometry.
Definition: OpenMCCellAverageProblem.h:865
unsigned int _n_particles_1
Number of particles simulated in the first iteration in Dufek-Gudowski relaxation.
Definition: OpenMCCellAverageProblem.h:1076
static bool _printed_triso_warning
Whether a warning has already been printed about very long setup times (for TRISOs)
Definition: OpenMCCellAverageProblem.h:1070
void compareContainedCells(std::map< cellInfo, containedCells > &reference, std::map< cellInfo, containedCells > &compare) const
int32_t elemToCellInstance(const int &elem_id) const
Definition: OpenMCCellAverageProblem.h:302
std::unordered_set< SubdomainID > _identical_cell_fill_blocks
Blocks for which the cell fills are identical.
Definition: OpenMCCellAverageProblem.h:977
static constexpr Real ZERO_TALLY_THRESHOLD
Tolerance for setting zero tally.
Definition: OpenMCCellAverageProblem.h:1136
virtual const std::map< cellInfo, std::vector< unsigned int > > & cellToElem() const
Definition: OpenMCCellAverageProblem.h:125
unsigned int getCellLevel(const Point &c) const
std::map< std::string, std::shared_ptr< FilterBase > > _filters
Definition: OpenMCCellAverageProblem.h:953
cellInfo elemToCellInfo(const int &elem_id) const
Definition: OpenMCCellAverageProblem.h:310
const bool & _verbose
Whether to print diagnostic information about model setup and the transfers.
Definition: OpenMCProblemBase.h:482
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:959
void read2DBlockParameters(const std::string name, std::vector< std::vector< SubdomainName >> &names, std::vector< SubdomainID > &flattened_ids)
std::map< cellInfo, coupling::CouplingFields > _cell_phase
Phase of each cell.
Definition: OpenMCCellAverageProblem.h:983
Point transformPoint(const Point &p) const
Definition: SymmetryPointGenerator.C:100
Definition: SymmetryPointGenerator.h:28
virtual Point transformPoint(const Point &pt) const
Definition: OpenMCCellAverageProblem.h:243
void addFilter(const std::string &type, const std::string &name, InputParameters &moose_object_pars)
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 getCellMappedSubdomains()
Loop over all the OpenMC cells and get the element subdomain IDs that map to each cell.
Skins the [Mesh] according to individual bins for temperature, density, and subdomain ID.
Definition: MoabSkinner.h:19
const int32_t _initial_num_openmc_surfaces
Definition: OpenMCCellAverageProblem.h:1130
const bool & _export_properties
Definition: OpenMCCellAverageProblem.h:862
virtual void critSearchStep() override
virtual MooseMesh & getMooseMesh()
Get a modifyable non-const reference to the Moose mesh.
std::map< SubdomainID, std::set< int32_t > > _subdomain_to_material
Mapping of elem subdomains to materials.
Definition: OpenMCCellAverageProblem.h:1034
Definition: CardinalEnums.h:130
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:1031
int32_t _dagmc_universe_id
ID of the OpenMC universe corresponding to the DAGMC universe.
Definition: OpenMCCellAverageProblem.h:1120
virtual void addExternalVariables() override
const coupling::OpenMCInitialCondition _initial_condition
Definition: OpenMCCellAverageProblem.h:838
bool _dagmc_root_universe
Whether the DAGMC universe is the root universe or not.
Definition: OpenMCCellAverageProblem.h:1123
void mapElemsToCells()
Populate maps of MOOSE elements to OpenMC cells.
coupling::CouplingFields elemFeedback(const Elem *elem) const
std::shared_ptr< TallyBase > addTally(const std::string &type, const std::string &name, InputParameters &moose_object_pars)
void setMinimumVolumeQRules(Order &volume_order, const std::string &type)
void latticeOuterError(const Point &c, int level) const
std::map< cellInfo, Real > _cell_to_elem_volume
Definition: OpenMCCellAverageProblem.h:1046
Definition: OpenMCCellMaterialFill.h:26
std::pair< int32_t, int32_t > cellInfo
Definition: OpenMCProblemBase.h:223
void gatherCellVector(std::vector< T > &local, std::vector< unsigned int > &n_local, std::map< cellInfo, std::vector< T >> &global)
std::vector< const VariableValue * > getTallyScoreVariableValues(const std::string &score, const std::string &tally_name, THREAD_ID tid, const std::string &output="", bool skip_func_exp=false)
int _n_moose_temp_elems
Number of elements in the MOOSE mesh that exclusively provide temperature feedback.
Definition: OpenMCCellAverageProblem.h:989
cellInfo firstContainedMaterialCell(const cellInfo &cell_info) const
static constexpr int32_t UNMAPPED
Constant flag to indicate that a cell/element was unmapped.
Definition: OpenMCCellAverageProblem.h:458
const Real getReferenceDensity(const Elem *elem) const
virtual void initialSetup() override
Set up an OpenMC simulation.