Chi-Tech
lbs_discrete_ordinates_solver.h
Go to the documentation of this file.
1#ifndef CHITECH_LBS_DISCRETE_ORDINATES_SOLVER_H
2#define CHITECH_LBS_DISCRETE_ORDINATES_SOLVER_H
3
5
6namespace lbs
7{
8
9class CBC_ASynchronousCommunicator;
10
11/**Base class for Discrete Ordinates solvers. This class mostly establishes
12 * utilities related to sweeping. From here we can derive a steady-state,
13 * transient, adjoint, and k-eigenvalue solver.*/
15{
16protected:
18
19 typedef std::shared_ptr<chi_math::AngularQuadrature> AngQuadPtr;
20
21 typedef std::pair<UniqueSOGroupings, DirIDToSOMap> SwpOrderGroupingInfo;
22
23 typedef std::shared_ptr<chi_mesh::sweep_management::SPDS> SPDS_ptr;
24 typedef std::vector<SPDS_ptr> SPDS_ptrs;
25
27 typedef std::unique_ptr<FLUDSCommonData> FLUDSCommonDataPtr;
28 typedef std::vector<FLUDSCommonDataPtr> FLUDSCommonDataPtrs;
29
30protected:
31 std::map<AngQuadPtr, SwpOrderGroupingInfo> quadrature_unq_so_grouping_map_;
32 std::map<AngQuadPtr, SPDS_ptrs> quadrature_spds_map_;
33 std::map<AngQuadPtr, FLUDSCommonDataPtrs> quadrature_fluds_commondata_map_;
34
35 std::vector<size_t> verbose_sweep_angles_;
36 const std::string sweep_type_;
37
38public:
41 const chi::InputParameters& params);
42protected:
43 explicit DiscreteOrdinatesSolver(const std::string& text_name);
44
45public:
46 const std::string& SweepType() const {return sweep_type_;}
47 virtual ~DiscreteOrdinatesSolver() override;
48
49 std::pair<size_t, size_t> GetNumPhiIterativeUnknowns() override;
50
51 // 01
52 void Initialize() override;
53
54protected:
55 // 01j
56 void InitializeWGSSolvers() override;
57
58 // Sweep Data
60 static std::pair<UniqueSOGroupings, DirIDToSOMap>
62 const chi_math::AngularQuadrature& quadrature,
63 AngleAggregationType agg_type,
64 lbs::GeometryType lbs_geo_type);
65 void InitFluxDataStructures(LBSGroupset& groupset);
66 void ResetSweepOrderings(LBSGroupset& groupset);
67 virtual std::shared_ptr<SweepChunk> SetSweepChunk(LBSGroupset& groupset);
68
69 // Vector assembly
70public:
71 void ScalePhiVector(PhiSTLOption which_phi, double value) override;
73 Vec x,
74 PhiSTLOption which_phi) override;
75
77 Vec x_src,
78 PhiSTLOption which_phi) override;
79
81 PhiSTLOption from_which_phi,
82 PhiSTLOption to_which_phi) override;
83
84 void SetMultiGSPETScVecFromPrimarySTLvector(const std::vector<int>& gs_ids,
85 Vec x,
86 PhiSTLOption which_phi) override;
87
89 const std::vector<int>& gs_ids, Vec x_src, PhiSTLOption which_phi) override;
90
91 // compute_balance
92public:
93 void ZeroOutflowBalanceVars(LBSGroupset& groupset);
94 void ComputeBalance();
95
96 // compute leakage
97public:
98 std::vector<double> ComputeLeakage(int groupset_id,
99 uint64_t boundary_id) const;
100};
101
102} // namespace lbs
103
104#endif // CHITECH_LBS_DISCRETE_ORDINATES_SOLVER_H
void InitFluxDataStructures(LBSGroupset &groupset)
chi_mesh::sweep_management::FLUDSCommonData FLUDSCommonData
std::pair< size_t, size_t > GetNumPhiIterativeUnknowns() override
const std::string & SweepType() const
std::shared_ptr< chi_mesh::sweep_management::SPDS > SPDS_ptr
void SetGSPETScVecFromPrimarySTLvector(LBSGroupset &groupset, Vec x, PhiSTLOption which_phi) override
std::map< AngQuadPtr, FLUDSCommonDataPtrs > quadrature_fluds_commondata_map_
static std::pair< UniqueSOGroupings, DirIDToSOMap > AssociateSOsAndDirections(const chi_mesh::MeshContinuum &grid, const chi_math::AngularQuadrature &quadrature, AngleAggregationType agg_type, lbs::GeometryType lbs_geo_type)
DiscreteOrdinatesSolver(const chi::InputParameters &params)
std::pair< UniqueSOGroupings, DirIDToSOMap > SwpOrderGroupingInfo
void SetPrimarySTLvectorFromGSPETScVec(LBSGroupset &groupset, Vec x_src, PhiSTLOption which_phi) override
std::unique_ptr< FLUDSCommonData > FLUDSCommonDataPtr
void ResetSweepOrderings(LBSGroupset &groupset)
static chi::InputParameters GetInputParameters()
void ZeroOutflowBalanceVars(LBSGroupset &groupset)
void SetMultiGSPETScVecFromPrimarySTLvector(const std::vector< int > &gs_ids, Vec x, PhiSTLOption which_phi) override
void GSScopedCopyPrimarySTLvectors(LBSGroupset &groupset, PhiSTLOption from_which_phi, PhiSTLOption to_which_phi) override
std::map< AngQuadPtr, SwpOrderGroupingInfo > quadrature_unq_so_grouping_map_
virtual std::shared_ptr< SweepChunk > SetSweepChunk(LBSGroupset &groupset)
void SetPrimarySTLvectorFromMultiGSPETScVecFrom(const std::vector< int > &gs_ids, Vec x_src, PhiSTLOption which_phi) override
std::map< AngQuadPtr, SPDS_ptrs > quadrature_spds_map_
std::vector< double > ComputeLeakage(int groupset_id, uint64_t boundary_id) const
chi_mesh::sweep_management::SweepChunk SweepChunk
std::vector< FLUDSCommonDataPtr > FLUDSCommonDataPtrs
std::shared_ptr< chi_math::AngularQuadrature > AngQuadPtr
void ScalePhiVector(PhiSTLOption which_phi, double value) override
AngleAggregationType
Definition: lbs_structs.h:65
PhiSTLOption
Definition: lbs_structs.h:105
GeometryType
Definition: lbs_structs.h:34
struct _p_Vec * Vec