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"
24 
26 #include "TallyBase.h"
27 #include "FilterBase.h"
28 
29 #ifdef ENABLE_DAGMC
30 #include "MoabSkinner.h"
31 #include "DagMC.hpp"
32 #endif
33 
65 {
66 public:
67  OpenMCCellAverageProblem(const InputParameters & params);
68  static InputParameters validParams();
69 
70  virtual void initialSetup() override;
71  virtual void externalSolve() override;
72  virtual void syncSolutions(ExternalProblem::Direction direction) override;
73  virtual bool converged(unsigned int) override { return true; }
74 
82  void read2DBlockParameters(const std::string name,
83  std::vector<std::vector<SubdomainName>> & names,
84  std::vector<SubdomainID> & flattened_ids);
85 
92  void checkBlocksInMesh(const std::string name,
93  const std::vector<SubdomainID> & ids,
94  const std::vector<SubdomainName> & names) const;
95 
97  void setupProblem();
98 
103  virtual void addExternalVariables() override;
104 
110  virtual Real cellVolume(const cellInfo & cell_info) const;
111 
116  virtual const OpenMCVolumeCalculation * volumeCalculation() const { return _volume_calc; }
117 
122  virtual const std::map<cellInfo, std::vector<unsigned int>> & cellToElem() const
123  {
124  return _cell_to_elem;
125  }
126 
132  virtual std::unordered_set<SubdomainID> getCellToElementSub(const cellInfo & info)
133  {
134  return _cell_to_elem_subdomain.at(info);
135  }
136 
141  virtual bool hasPointTransformations() const { return _symmetry != nullptr; }
142 
147  virtual const std::vector<std::string> & getTallyScores() const { return _all_tally_scores; }
148 
154  virtual Point transformPoint(const Point & pt) const
155  {
156  return this->hasPointTransformations() ? _symmetry->transformPoint(pt) : pt;
157  }
158 
180  virtual void createQRules(QuadratureType type,
181  Order order,
182  Order volume_order,
183  Order face_order,
184  SubdomainID block,
185  bool allow_negative_weights = true) override;
186 
191  typedef std::unordered_map<int32_t, std::vector<int32_t>> containedCells;
192 
198  int32_t elemToCellIndex(const int & elem_id) const { return elemToCellInfo(elem_id).first; }
199 
206  int32_t elemToCellID(const int & elem_id) const { return cellID(elemToCellIndex(elem_id)); }
207 
213  int32_t elemToCellInstance(const int & elem_id) const { return elemToCellInfo(elem_id).second; }
214 
221  cellInfo elemToCellInfo(const int & elem_id) const { return _elem_to_cell[elem_id]; }
222 
230  int32_t cellToMaterialIndex(const cellInfo & cell_info) { return _cell_to_material[cell_info]; }
231 
240  coupling::CouplingFields cellFeedback(const cellInfo & cell_info) const;
241 
247  bool hasDensityFeedback(const cellInfo & cell_info) const
248  {
249  std::vector<coupling::CouplingFields> phase = {coupling::density,
251  return std::find(phase.begin(), phase.end(), cellFeedback(cell_info)) != phase.end();
252  }
253 
259  bool hasTemperatureFeedback(const cellInfo & cell_info) const
260  {
261  std::vector<coupling::CouplingFields> phase = {coupling::temperature,
263  return std::find(phase.begin(), phase.end(), cellFeedback(cell_info)) != phase.end();
264  }
265 
271  bool hasFilter(const std::string & filter_name) const { return _filters.count(filter_name) > 0; }
272 
278  std::shared_ptr<FilterBase> & getFilter(const std::string & filter_name)
279  {
280  return _filters.at(filter_name);
281  }
282 
287  const std::vector<std::shared_ptr<TallyBase>> & getLocalTally() const { return _local_tallies; }
288 
294  double cellTemperature(const cellInfo & cell_info) const;
295 
300  double cellMappedVolume(const cellInfo & cell_info) const;
301 
303  void reloadDAGMC();
304 
311  void addFilter(const std::string & type,
312  const std::string & name,
313  InputParameters & moose_object_pars);
314 
321  void
322  addTally(const std::string & type, const std::string & name, InputParameters & moose_object_pars);
323 
332  Real tallyMultiplier(unsigned int global_score) const;
333 
339  template <typename T>
340  void checkEmptyVector(const std::vector<T> & vector, const std::string & name) const
341  {
342  if (vector.empty())
343  mooseError(name + " cannot be empty!");
344  }
345 
347 
349  static constexpr int32_t UNMAPPED{-1};
350 
352  static constexpr int DIMENSION{3};
353 
354 protected:
360  unsigned int getCellLevel(const Point & c) const;
361 
370  void
371  readBlockVariables(const std::string & param,
372  const std::string & default_name,
373  std::map<std::string, std::vector<SubdomainName>> & vars_to_specified_blocks,
374  std::vector<SubdomainID> & specified_blocks);
375 
381  bool cellHasIdenticalFill(const cellInfo & cell_info) const;
382 
389  containedCells shiftCellInstances(const cellInfo & cell_info) const;
390 
397  bool cellMapsToSubdomain(const cellInfo & cell_info,
398  const std::unordered_set<SubdomainID> & id) const;
399 
405  cellInfo firstContainedMaterialCell(const cellInfo & cell_info) const;
406 
412  containedCells containedMaterialCells(const cellInfo & cell_info) const;
413 
418  virtual void updateMaterials();
419 
425  std::vector<std::string> getMaterialInEachSubdomain() const;
426 
432  Point transformPointToOpenMC(const Point & pt) const;
433 
440  void checkNormalization(const Real & sum, unsigned int global_score) const;
441 
451  void
452  printTrisoHelp(const std::chrono::time_point<std::chrono::high_resolution_clock> & start) const;
453 
460  void printAuxVariableIO();
461 
467  std::vector<int32_t> materialsInCells(const containedCells & contained_cells) const;
468 
470  void subdomainsToMaterials();
471 
476  std::set<SubdomainID> coupledSubdomains() const;
477 
483  template <typename T>
484  void gatherCellSum(std::vector<T> & local, std::map<cellInfo, T> & global) const;
485 
492  template <typename T>
493  void gatherCellVector(std::vector<T> & local, std::vector<unsigned int> & n_local, std::map<cellInfo, std::vector<T>> & global);
494 
500  coupling::CouplingFields elemFeedback(const Elem * elem) const;
501 
506  void getTallyTriggerParameters(const InputParameters & params);
507 
513  void readBlockParameters(const std::string name, std::unordered_set<SubdomainID> & blocks);
514 
520  void cacheContainedCells();
521 
528  void setContainedCells(const cellInfo & cell_info,
529  const Point & hint,
530  std::map<cellInfo, containedCells> & map);
531 
540  void checkContainedCellsStructure(const cellInfo & cell_info,
541  containedCells & reference,
542  containedCells & compare) const;
543 
549  void setMinimumVolumeQRules(Order & volume_order, const std::string & type);
550 
552  std::string printNewline() const
553  {
554  if (_verbose)
555  return "\n";
556  else
557  return "";
558  }
559 
561  void storeElementPhase();
562 
584  void relaxAndNormalizeTally(unsigned int global_score,
585  unsigned int local_score,
586  std::shared_ptr<TallyBase> local_tally);
587 
592  void getCellMappedPhase();
593 
595  void checkCellMappedPhase();
596 
599 
605 
608 
610  void mapElemsToCells();
611 
617  void validateLocalTallies();
618 
620  void initializeTallies();
621 
626  void resetTallies();
627 
629  void getMaterialFills();
630 
636  void getPointInCell();
637 
644  std::map<cellInfo, Real> computeVolumeWeightedCellInput(
645  const std::map<SubdomainID, std::pair<unsigned int, std::string>> & var_num,
646  const std::vector<coupling::CouplingFields> * phase) const;
647 
652  void sendTemperatureToOpenMC() const;
653 
658  void sendDensityToOpenMC() const;
659 
665  Real tallyNormalization(unsigned int global_score) const;
666 
671  void checkTallySum(const unsigned int & score) const;
672 
678  void latticeOuterCheck(const Point & c, int level) const;
679 
685  void latticeOuterError(const Point & c, int level) const;
686 
692  bool findCell(const Point & point);
693 
702  void compareContainedCells(std::map<cellInfo, containedCells> & reference,
703  std::map<cellInfo, containedCells> & compare) const;
704 
705  std::unique_ptr<NumericVector<Number>> _serialized_solution;
706 
711  const bool & _output_cell_mapping;
712 
720 
723 
731 
737  unsigned int _cell_level;
738 
743  const bool & _export_properties;
744 
765 
773 
787  const bool _check_tally_sum;
788 
790  const Real & _relaxation_factor;
791 
824 
832 
841 
847 
853 
860 
862  bool _has_cell_tallies = false;
863 
866 
872 
877  std::map<std::string, std::shared_ptr<FilterBase>> _filters;
878 
880  std::vector<std::shared_ptr<TallyBase>> _local_tallies;
881 
883  std::vector<std::string> _all_tally_scores;
884 
890  std::vector<std::map<std::string, int>> _local_tally_score_map;
891 
893  std::vector<std::vector<unsigned int>> _tally_var_ids;
894 
896  std::vector<std::vector<std::vector<unsigned int>>> _tally_ext_var_ids;
897 
899  std::vector<SubdomainID> _density_blocks;
900 
902  std::vector<SubdomainID> _temp_blocks;
903 
905  std::unordered_set<SubdomainID> _identical_cell_fill_blocks;
906 
908  std::vector<cellInfo> _elem_to_cell{};
909 
911  std::map<cellInfo, coupling::CouplingFields> _cell_phase;
912 
915 
918 
921 
924 
930 
936 
942 
945 
948 
951 
953  std::map<cellInfo, std::vector<unsigned int>> _cell_to_elem;
954 
956  std::map<cellInfo, std::vector<unsigned int>> _local_cell_to_elem;
957 
959  std::map<cellInfo, std::unordered_set<SubdomainID>> _cell_to_elem_subdomain;
960 
962  std::map<SubdomainID, std::set<int32_t>> _subdomain_to_material;
963 
968  std::map<cellInfo, Point> _cell_to_point;
969 
974  std::map<cellInfo, Real> _cell_to_elem_volume;
975 
980  std::map<cellInfo, Real> _cell_volume;
981 
986  std::map<cellInfo, int32_t> _cell_to_material;
987 
992  std::map<cellInfo, containedCells> _cell_to_contained_material_cells;
993 
995  std::map<cellInfo, int32_t> _cell_to_n_contained;
996 
1001  std::vector<openmc::Tally *> _global_tallies;
1002 
1004  std::vector<std::vector<std::string>> _global_tally_scores;
1005 
1007  std::vector<openmc::TallyEstimator> _global_tally_estimators;
1008 
1010  std::vector<Real> _global_sum_tally;
1011 
1013  std::vector<Real> _local_sum_tally;
1014 
1016  std::vector<Real> _local_mean_tally;
1017 
1019  static bool _first_transfer;
1020 
1022  static bool _printed_initial;
1023 
1026 
1028  openmc::Particle _particle;
1029 
1031  unsigned int _n_particles_1;
1032 
1034  std::map<std::string, std::vector<SubdomainName>> _temp_vars_to_blocks;
1035 
1037  std::map<std::string, std::vector<SubdomainName>> _density_vars_to_blocks;
1038 
1041 
1044 
1046  std::map<cellInfo, int> _n_temp;
1047 
1049  std::map<cellInfo, int> _n_rho;
1050 
1052  std::map<cellInfo, int> _n_temp_rho;
1053 
1055  std::map<cellInfo, int> _n_none;
1056 
1058  unsigned int _global_tally_index = 0;
1059 
1061  unsigned int _source_rate_index;
1062 
1063 #ifdef ENABLE_DAGMC
1064  MoabSkinner * _skinner = nullptr;
1066 
1068  std::shared_ptr<moab::DagMC> _dagmc = nullptr;
1069 #endif
1070 
1072  long unsigned int _n_openmc_cells;
1073 
1076 
1078  static constexpr Real EV_TO_JOULE = 1.6022e-19;
1079 
1081  static constexpr Real ZERO_TALLY_THRESHOLD = 1e-12;
1082 
1083 private:
1087  void dufekGudowskiParticleUpdate();
1088 
1090  std::vector<int32_t> _flattened_ids;
1091 
1093  std::vector<int32_t> _flattened_instances;
1094 
1096  containedCells _instance_offsets;
1097 
1099  std::map<cellInfo, int32_t> _n_offset;
1100 
1102  cellInfo _first_identical_cell;
1103 
1105  std::vector<int32_t> _first_identical_cell_materials;
1106 
1108  std::map<SubdomainID, std::pair<unsigned int, std::string>> _subdomain_to_temp_vars;
1109 
1111  std::map<SubdomainID, std::pair<unsigned int, std::string>> _subdomain_to_density_vars;
1112 };
TallyTriggerTypeEnum
Type of trigger to apply.
Definition: CardinalEnums.h:163
void checkNormalization(const Real &sum, unsigned int global_score) const
const bool _has_identical_cell_fills
Definition: OpenMCCellAverageProblem.h:823
const trigger::TallyTriggerTypeEnum _k_trigger
Definition: OpenMCCellAverageProblem.h:730
int32_t elemToCellIndex(const int &elem_id) const
Definition: OpenMCCellAverageProblem.h:198
bool findCell(const Point &point)
int _n_moose_none_elems
Number of no-coupling elements in the MOOSE mesh.
Definition: OpenMCCellAverageProblem.h:923
void sendTemperatureToOpenMC() 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:1037
static bool _first_transfer
Whether the present transfer is the first transfer.
Definition: OpenMCCellAverageProblem.h:1019
Definition: CardinalEnums.h:207
int _fixed_point_iteration
Definition: OpenMCProblemBase.h:426
const bool _specified_temperature_feedback
Definition: OpenMCCellAverageProblem.h:859
void checkEmptyVector(const std::vector< T > &vector, const std::string &name) const
Definition: OpenMCCellAverageProblem.h:340
std::unordered_map< int32_t, std::vector< int32_t > > containedCells
Definition: OpenMCCellAverageProblem.h:191
std::unique_ptr< NumericVector< Number > > _serialized_solution
Definition: OpenMCCellAverageProblem.h:705
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:1034
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:896
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:956
const relaxation::RelaxationEnum _relaxation
Type of relaxation to apply to the OpenMC tallies.
Definition: OpenMCCellAverageProblem.h:722
void relaxAndNormalizeTally(unsigned int global_score, unsigned int local_score, std::shared_ptr< TallyBase > local_tally)
int32_t _dagmc_universe_index
Index in the OpenMC universes corresponding to the DAGMC universe.
Definition: OpenMCCellAverageProblem.h:1075
std::vector< std::vector< unsigned int > > _tally_var_ids
A vector of auxvariable ids added by the [Tallies] block.
Definition: OpenMCCellAverageProblem.h:893
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:914
static InputParameters validParams()
int _n_mapped_temp_density_elems
Definition: OpenMCCellAverageProblem.h:941
Real _uncoupled_volume
Total volume of uncoupled MOOSE mesh elements.
Definition: OpenMCCellAverageProblem.h:947
std::map< cellInfo, int > _n_rho
Number of density-only feedback elements in each mapped OpenMC cell (global)
Definition: OpenMCCellAverageProblem.h:1049
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:920
void initializeTallies()
Add OpenMC tallies to facilitate the coupling.
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:552
std::map< cellInfo, int > _n_none
Number of none elements in each mapped OpenMC cell (global)
Definition: OpenMCCellAverageProblem.h:1055
const bool _needs_global_tally
Definition: OpenMCCellAverageProblem.h:871
containedCells containedMaterialCells(const cellInfo &cell_info) const
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
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:1016
virtual void syncSolutions(ExternalProblem::Direction direction) override
std::vector< SubdomainID > _temp_blocks
Blocks in MOOSE mesh that provide temperature feedback.
Definition: OpenMCCellAverageProblem.h:902
bool hasTemperatureFeedback(const cellInfo &cell_info) const
Definition: OpenMCCellAverageProblem.h:259
virtual std::unordered_set< SubdomainID > getCellToElementSub(const cellInfo &info)
Definition: OpenMCCellAverageProblem.h:132
bool hasFilter(const std::string &filter_name) const
Definition: OpenMCCellAverageProblem.h:271
std::vector< Real > _local_sum_tally
Sum value of the local tally(s), across all bins.
Definition: OpenMCCellAverageProblem.h:1013
bool _needs_to_map_cells
Whether any spatial mapping from OpenMC's cells to the mesh is needed.
Definition: OpenMCCellAverageProblem.h:865
Definition: CardinalEnums.h:205
Tally/filter includes.
Definition: OpenMCCellAverageProblem.h:64
int32_t cellToMaterialIndex(const cellInfo &cell_info)
Definition: OpenMCCellAverageProblem.h:230
int _n_mapped_density_elems
Definition: OpenMCCellAverageProblem.h:935
bool hasDensityFeedback(const cellInfo &cell_info) const
Definition: OpenMCCellAverageProblem.h:247
bool _map_density_by_cell
Definition: OpenMCCellAverageProblem.h:846
std::vector< Real > _global_sum_tally
Sum value of the global tally(s), across all bins.
Definition: OpenMCCellAverageProblem.h:1010
std::map< cellInfo, int > _n_temp
Number of temperature-only feedback elements in each mapped OpenMC cell (global)
Definition: OpenMCCellAverageProblem.h:1046
void sendDensityToOpenMC() const
virtual const std::vector< std::string > & getTallyScores() const
Definition: OpenMCCellAverageProblem.h:147
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:944
int _n_mapped_temp_elems
Definition: OpenMCCellAverageProblem.h:929
void checkCellMappedPhase()
This function is used to ensure that each OpenMC cell only maps to a single phase.
bool _material_cells_only
Whether non-material cells are mapped.
Definition: OpenMCCellAverageProblem.h:950
Point transformPointToOpenMC(const Point &pt) const
unsigned int _cell_level
Definition: OpenMCCellAverageProblem.h:737
containedCells shiftCellInstances(const cellInfo &cell_info) const
int32_t elemToCellID(const int &elem_id) const
Definition: OpenMCCellAverageProblem.h:206
std::map< cellInfo, containedCells > _cell_to_contained_material_cells
Definition: OpenMCCellAverageProblem.h:992
long unsigned int _n_openmc_cells
Total number of unique OpenMC cell IDs + instances combinations.
Definition: OpenMCCellAverageProblem.h:1072
void gatherCellSum(std::vector< T > &local, std::map< cellInfo, T > &global) const
std::map< cellInfo, int32_t > _cell_to_n_contained
Number of material-type cells contained within a cell.
Definition: OpenMCCellAverageProblem.h:995
OpenMCInitialCondition
Where to get the initial temperature and density settings for OpenMC.
Definition: CardinalEnums.h:212
void subdomainsToMaterials()
Loop over the mapped cells, and build a map between subdomains to OpenMC materials.
const bool & _assume_separate_tallies
Definition: OpenMCCellAverageProblem.h:840
std::vector< openmc::TallyEstimator > _global_tally_estimators
Global tally estimators corresponding to '_global_tallies'.
Definition: OpenMCCellAverageProblem.h:1007
const bool & _check_identical_cell_fills
Definition: OpenMCCellAverageProblem.h:831
void readBlockParameters(const std::string name, std::unordered_set< SubdomainID > &blocks)
int fixedPointIteration() const
Definition: OpenMCCellAverageProblem.h:346
const SymmetryPointGenerator * _symmetry
Userobject that maps from a partial-symmetry OpenMC model to a whole-domain [Mesh].
Definition: OpenMCCellAverageProblem.h:1043
unsigned int _source_rate_index
Index in tally_score pointing to the score used for normalizing flux tallies in eigenvalue mode.
Definition: OpenMCCellAverageProblem.h:1061
const bool & _output_cell_mapping
Definition: OpenMCCellAverageProblem.h:711
Definition: CardinalEnums.h:206
void checkTallySum(const unsigned int &score) const
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:880
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:953
double cellMappedVolume(const cellInfo &cell_info) const
std::vector< openmc::Tally * > _global_tallies
Definition: OpenMCCellAverageProblem.h:1001
coupling::CouplingFields cellFeedback(const cellInfo &cell_info) const
std::vector< SubdomainID > _density_blocks
Blocks in MOOSE mesh that provide density feedback.
Definition: OpenMCCellAverageProblem.h:899
int32_t cellID(const int32_t index) const
static constexpr int DIMENSION
Spatial dimension of the Monte Carlo problem.
Definition: OpenMCCellAverageProblem.h:352
RelaxationEnum
Type of relaxation.
Definition: CardinalEnums.h:235
std::map< cellInfo, int32_t > _cell_to_material
Definition: OpenMCCellAverageProblem.h:986
Real tallyMultiplier(unsigned int global_score) const
std::vector< cellInfo > _elem_to_cell
Mapping of MOOSE elements to the OpenMC cell they map to (if any)
Definition: OpenMCCellAverageProblem.h:908
void addTally(const std::string &type, const std::string &name, InputParameters &moose_object_pars)
openmc::Particle _particle
Dummy particle to reduce number of allocations of particles for cell lookup routines.
Definition: OpenMCCellAverageProblem.h:1028
const bool _check_tally_sum
Definition: OpenMCCellAverageProblem.h:787
Definition: OpenMCProblemBase.h:49
bool cellHasIdenticalFill(const cellInfo &cell_info) const
virtual const OpenMCVolumeCalculation * volumeCalculation() const
Definition: OpenMCCellAverageProblem.h:116
const bool _normalize_by_global
Definition: OpenMCCellAverageProblem.h:764
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:66
static bool _printed_initial
Whether the diagnostic tables on initialization have already been printed.
Definition: OpenMCCellAverageProblem.h:1022
OpenMCVolumeCalculation * _volume_calc
Optional volume calculation for cells which map to MOOSE.
Definition: OpenMCCellAverageProblem.h:1040
void getTallyTriggerParameters(const InputParameters &params)
bool _has_cell_tallies
Whether any cell tallies exist.
Definition: OpenMCCellAverageProblem.h:862
std::map< cellInfo, Real > _cell_volume
Definition: OpenMCCellAverageProblem.h:980
Definition: OpenMCVolumeCalculation.h:28
const bool _specified_density_feedback
Definition: OpenMCCellAverageProblem.h:852
virtual bool converged(unsigned int) override
Definition: OpenMCCellAverageProblem.h:73
std::vector< std::map< std::string, int > > _local_tally_score_map
Definition: OpenMCCellAverageProblem.h:890
std::map< cellInfo, int > _n_temp_rho
Number of temperature+density feedback elements in each mapped OpenMC cell (global)
Definition: OpenMCCellAverageProblem.h:1052
void setupProblem()
Initialize the mapping of OpenMC to the MooseMesh and perform additional setup actions.
const bool _need_to_reinit_coupling
Definition: OpenMCCellAverageProblem.h:772
virtual bool hasPointTransformations() const
Definition: OpenMCCellAverageProblem.h:141
std::map< cellInfo, Point > _cell_to_point
Definition: OpenMCCellAverageProblem.h:968
static constexpr Real EV_TO_JOULE
Conversion rate from eV to Joule.
Definition: OpenMCCellAverageProblem.h:1078
virtual void createQRules(QuadratureType type, Order order, Order volume_order, Order face_order, SubdomainID block, bool allow_negative_weights=true) override
std::shared_ptr< FilterBase > & getFilter(const std::string &filter_name)
Definition: OpenMCCellAverageProblem.h:278
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:203
unsigned int _n_particles_1
Number of particles simulated in the first iteration.
Definition: OpenMCCellAverageProblem.h:1031
static bool _printed_triso_warning
Whether a warning has already been printed about very long setup times (for TRISOs)
Definition: OpenMCCellAverageProblem.h:1025
void compareContainedCells(std::map< cellInfo, containedCells > &reference, std::map< cellInfo, containedCells > &compare) const
int32_t elemToCellInstance(const int &elem_id) const
Definition: OpenMCCellAverageProblem.h:213
unsigned int _global_tally_index
Index in OpenMC tallies corresponding to the first global tally added by Cardinal.
Definition: OpenMCCellAverageProblem.h:1058
std::unordered_set< SubdomainID > _identical_cell_fill_blocks
Blocks for which the cell fills are identical.
Definition: OpenMCCellAverageProblem.h:905
static constexpr Real ZERO_TALLY_THRESHOLD
Tolerance for setting zero tally.
Definition: OpenMCCellAverageProblem.h:1081
virtual const std::map< cellInfo, std::vector< unsigned int > > & cellToElem() const
Definition: OpenMCCellAverageProblem.h:122
unsigned int getCellLevel(const Point &c) const
std::map< std::string, std::shared_ptr< FilterBase > > _filters
Definition: OpenMCCellAverageProblem.h:877
cellInfo elemToCellInfo(const int &elem_id) const
Definition: OpenMCCellAverageProblem.h:221
const bool & _verbose
Whether to print diagnostic information about model setup and the transfers.
Definition: OpenMCProblemBase.h:376
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:883
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:911
Point transformPoint(const Point &p) const
Definition: SymmetryPointGenerator.C:99
Definition: SymmetryPointGenerator.h:28
virtual Point transformPoint(const Point &pt) const
Definition: OpenMCCellAverageProblem.h:154
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 bool & _export_properties
Definition: OpenMCCellAverageProblem.h:743
const std::vector< std::shared_ptr< TallyBase > > & getLocalTally() const
Definition: OpenMCCellAverageProblem.h:287
virtual void updateMaterials()
std::map< SubdomainID, std::set< int32_t > > _subdomain_to_material
Mapping of elem subdomains to materials.
Definition: OpenMCCellAverageProblem.h:962
Real tallyNormalization(unsigned int global_score) const
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:959
virtual void addExternalVariables() override
const coupling::OpenMCInitialCondition _initial_condition
Definition: OpenMCCellAverageProblem.h:719
void mapElemsToCells()
Populate maps of MOOSE elements to OpenMC cells.
coupling::CouplingFields elemFeedback(const Elem *elem) const
void setMinimumVolumeQRules(Order &volume_order, const std::string &type)
const Real & _relaxation_factor
Constant relaxation factor.
Definition: OpenMCCellAverageProblem.h:790
void latticeOuterError(const Point &c, int level) const
std::map< cellInfo, Real > _cell_to_elem_volume
Definition: OpenMCCellAverageProblem.h:974
void getMaterialFills()
Find the material filling each cell which receives density feedback.
std::pair< int32_t, int32_t > cellInfo
Definition: OpenMCProblemBase.h:190
void gatherCellVector(std::vector< T > &local, std::vector< unsigned int > &n_local, std::map< cellInfo, std::vector< T >> &global)
int _n_moose_temp_elems
Number of elements in the MOOSE mesh that exclusively provide temperature feedback.
Definition: OpenMCCellAverageProblem.h:917
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:349
std::vector< std::vector< std::string > > _global_tally_scores
Global tally scores corresponding to '_global_tallies'.
Definition: OpenMCCellAverageProblem.h:1004
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 void initialSetup() override