Line data Source code
1 : /**********************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ 4 : /* */ 5 : /* Copyright 2017 Battelle Energy Alliance, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /**********************************************************************/ 8 : 9 : #pragma once 10 : 11 : // MOOSE includes 12 : #include "ElementUserObject.h" 13 : #include "MultiIndex.h" 14 : 15 : /** 16 : * Computes PDFs from neutronics calculations that are 17 : * used to sample PKAs that will be passed to BCMC simulations. 18 : */ 19 : class NeutronicsSpectrumSamplerBase : public ElementUserObject 20 : { 21 : public: 22 : static InputParameters validParams(); 23 : 24 : NeutronicsSpectrumSamplerBase(const InputParameters & parameters); 25 : 26 : virtual void execute(); 27 : virtual void initialSetup(); 28 : virtual void initialize(); 29 : virtual void finalize(); 30 : virtual void threadJoin(const UserObject & y); 31 : virtual void meshChanged(); 32 : 33 : /// returns a MultiIndex<Real> PDF at a given point ID 34 : virtual MultiIndex<Real> getPDF(unsigned int point_id) const; 35 : 36 : /// returns a std::vector<unsigned int> of ZAIDs 37 : virtual std::vector<unsigned int> getZAIDs() const; 38 : 39 : /// returns a std::vector<Real> of energies 40 : virtual std::vector<Real> getEnergies() const; 41 : 42 : /// returns the total point and isotope wise recoil rate 43 : virtual Real totalRecoilRate(unsigned int point_id, const std::string & target_isotope) const = 0; 44 : 45 0 : unsigned int getNumberOfPoints() const { return _npoints; } 46 : 47 : bool hasIsotope(std::string target_isotope) const; 48 : 49 : protected: 50 : /// a callback executed right before computeRadiationDamagePDF 51 : virtual void preComputeRadiationDamagePDF(); 52 : 53 : /// computes the PKA for isotope i, group g, and angular indieces p [mu] and q [phi] 54 : virtual Real 55 : computeRadiationDamagePDF(unsigned int i, unsigned int g, unsigned int p, unsigned int q) = 0; 56 : 57 : /// a subsitute to convert isotope names to zaid if RSN is not available 58 : unsigned int localStringToZaid(std::string s) const; 59 : 60 : /// vector of target zaids 61 : const std::vector<std::string> & _target_isotope_names; 62 : 63 : /// the number densities of these isotopes given as variables 64 : std::vector<const VariableValue *> _number_densities; 65 : const std::vector<Real> & _energy_group_boundaries; 66 : 67 : /// number of isotopes 68 : unsigned int _I; 69 : /// number of energy groups 70 : unsigned int _G; 71 : /// order of angular expansion in Legendre Pols 72 : unsigned int _L; 73 : 74 : /// total number of angular bins in the mu direction 75 : unsigned int _nmu; 76 : 77 : // total number of angular bins in the azimuthal direction 78 : unsigned int _nphi; 79 : 80 : /// the points at which PDFs are computed 81 : const std::vector<Point> & _points; 82 : 83 : /// number of points 84 : unsigned int _npoints; 85 : 86 : /// flag indicating of recaching the _qp is necessary 87 : bool _qp_is_cached; 88 : 89 : /// a map from a local existing element to contained points (there can be more than one!) 90 : std::map<const Elem *, std::vector<unsigned int>> _local_elem_to_contained_points; 91 : 92 : /// determines which process owns this point 93 : std::vector<unsigned int> _owner; 94 : 95 : /// the array stores the _qp index for each point 96 : std::vector<unsigned int> _qp_cache; 97 : 98 : /// stores the radiation damage PDF 99 : std::vector<MultiIndex<Real>> _sample_point_data; 100 : 101 : /// the current quadrature point 102 : unsigned int _qp; 103 : 104 : /// the current point 105 : unsigned int _current_point; 106 : 107 : /// vector of ZAIDs 108 : std::vector<unsigned int> _zaids; 109 : };