WARPXM v1.10.0
Loading...
Searching...
No Matches
ndg_kinetic.h
Go to the documentation of this file.
1#ifndef dfem_spatial_solver_ndg_kinetic_h
2#define dfem_spatial_solver_ndg_kinetic_h
3
4// WARPXM includes
6#include "dfem/tools/tools.h"
7#include "ndg.h" // for req_buffer_size
10
11namespace wxm
12{
13namespace dfem
14{
15namespace solver
16{
17namespace dg
18{
19
26{
27public:
32
37 void setup(const WxCryptSet& wxc) override;
38
42 const std::shared_ptr<TimestepConstraint>
43 solve(const real time, const variables_type& input, variables_type& output) override;
44
48 const WxRange& element_interior_range() const override
49 {
50 return _element_flux._interior;
51 }
52
56 const WxRange& element_periphery_range() const override
57 {
58 return _element_flux._periphery;
59 }
60
65 const WxRange& element_full_range() const override
66 {
67 return _element_flux._full;
68 }
69
70protected:
75 size_t get_num_dof() const override
76 {
77 size_t dof =
78 _phase_space_dg_geometry->getPhaseSpaceBasisArraySet()->getNumTotalNodes();
79 for (int dim = 0; dim < _phase_space_dg_geometry->getVspaceNdims(); dim++)
80 {
81 dof *= _phase_space_dg_geometry->getVspaceNelems()[dim];
82 }
83
84 return dof;
85 }
86
93 void zero_fluxes() override;
94
95
96
110 const std::shared_ptr<TimestepConstraint>
112 const std::vector<wxm::array::patch_array_t*>& input,
113 const int physical_element_index,
114 const int velocity_space_element_indexes[3],
115 const std::vector<std::vector<real>>& J_inv_lm,
116 solverVariables_t* element_pSV, // not const!
117 std::vector<std::vector<real>>& internal_flux_ij,
118 std::vector<std::vector<real>>& allocation,
119 std::vector<real>& theta_ilk,
120 std::vector<real>& F_mik,
121 std::vector<real>& q,
122 std::vector<real>& aux) const;
123
124 // real calcElementInternalFlux(const std::vector<wxm::array::patch_array_t*>& input,
125 // const int physical_element_index,
126 // const int velocity_space_element_indexes[3],
127 // const std::vector<real>& A_jkm,
128 // solverVariables_t* element_pSV, // not const!
129 // std::vector<std::vector<real>>& internal_flux_ij,
130 // std::vector<std::vector<real>>& allocation,
131 // std::vector<std::vector<real>>& F_mi,
132 // std::vector<real>& q,
133 // std::vector<real>& aux) const;
134
147 const std::shared_ptr<TimestepConstraint>
148 calcElementSourceTerm(const std::vector<wxm::array::patch_array_t*>& input,
149 const int physical_element_index,
150 const int velocity_space_element_indexes[3],
151 solverVariables_t* element_pSV, // not const!
152 std::vector<std::vector<real>>& source_term_ij,
153 std::vector<real>& source_allocation,
154 std::vector<real>& q,
155 std::vector<real>& aux) const;
156
173 const std::shared_ptr<TimestepConstraint>
175 const std::vector<wxm::array::patch_array_t*>& input,
176 const int physical_element_index,
177 const int velocity_space_element_indexes[3],
178 const std::vector<std::vector<real>>& inverse_jacobian_phase_space,
179 solverVariables_t* face_pSV, // not const!
180 std::vector<std::vector<real>>& numerical_flux_ij,
181 std::vector<real>& allocation,
182 std::vector<real>& F_ik,
183 std::vector<real>& q_in,
184 std::vector<real>& q_out,
185 std::vector<real>& aux_in,
186 std::vector<real>& aux_out,
187 std::vector<real>& a) const;
188
189 // real calcElementNumericalFlux(
190 // const std::vector<wxm::array::patch_array_t*>& input,
191 // const int physical_element_index,
192 // const int velocity_space_element_indexes[3],
193 // const std::vector<std::vector<real>>& inverse_jacobian_phase_space,
194 // solverVariables_t* face_pSV, // not const!
195 // std::vector<std::vector<real>>& numerical_flux_ij,
196 // std::vector<real>& allocation,
197 // std::vector<real>& F_i,
198 // std::vector<real>& q_in,
199 // std::vector<real>& q_out,
200 // std::vector<real>& aux_in,
201 // std::vector<real>& aux_out,
202 // std::vector<real>& a) const;
203
204private:
205 // Temporal solver
206 real _cfl;
207
208 // flux booleans
209 bool _has_fluxes;
210 bool _has_sources;
211
212 // penalty eta and beta
213 real _penalty_eta;
214 real _penalty_beta;
215
216
220 std::vector<std::vector<size_t>> _app_to_rhs_idcs_num_flux;
221
225 std::vector<std::vector<size_t>> _app_to_rhs_idcs_int_flux;
226
230 std::vector<std::vector<size_t>> _app_to_rhs_idcs_source;
231
232 wxm::dfem::tools::scope_t _element_flux;
233
234 // velocity space range
235 std::unique_ptr<WxRange> _velocity_space_element_range;
236 std::unique_ptr<WxRange> _velocity_space_interior_element_range;
237
238 // Phase space geometry
239 std::shared_ptr<geometry::phase_space::PhaseSpaceDGGeometry> _phase_space_dg_geometry;
240
241 // phase space element type
242 std::unique_ptr<geometry::phase_space_element::PhaseSpaceElement>
243 _phase_space_element;
244
246 NDGKinetic& operator=(const NDGKinetic& var) = delete;
247
249 NDGKinetic(const NDGKinetic& var) = delete;
250};
251} // namespace dg
252} // namespace solver
253} // namespace dfem
254} // namespace wxm
255
256#endif
WxCryptSet extends WxCrypt by providing, in addition to name-value pairs, an set of named WxCryptSets...
Definition: wxcryptset.h:35
WxRange represents a hyper-rectangular domain of an n-dimensional space of integers.
Definition: wxrange.h:23
The NDGKinetic class is used for solving the discontinuous Galerkin method for kinetic problems.
Definition: ndg_kinetic.h:26
const std::shared_ptr< TimestepConstraint > solve(const real time, const variables_type &input, variables_type &output) override
Computes the RHS.
const WxRange & element_periphery_range() const override
Get a range of elements associated with the interior.
Definition: ndg_kinetic.h:56
const WxRange & element_interior_range() const override
Get a range of elements associated with the interior.
Definition: ndg_kinetic.h:48
const std::shared_ptr< TimestepConstraint > calcElementNumericalFluxCSRFormat(const std::vector< wxm::array::patch_array_t * > &input, const int physical_element_index, const int velocity_space_element_indexes[3], const std::vector< std::vector< real > > &inverse_jacobian_phase_space, solverVariables_t *face_pSV, std::vector< std::vector< real > > &numerical_flux_ij, std::vector< real > &allocation, std::vector< real > &F_ik, std::vector< real > &q_in, std::vector< real > &q_out, std::vector< real > &aux_in, std::vector< real > &aux_out, std::vector< real > &a) const
Calculates numerical_flux_ij = -sum over faces (G^-1_face Xi_jk^face tilde{F}_ik^face) where tilde{F}...
const std::shared_ptr< TimestepConstraint > calcElementInternalFluxCSRFormat(const std::vector< wxm::array::patch_array_t * > &input, const int physical_element_index, const int velocity_space_element_indexes[3], const std::vector< std::vector< real > > &J_inv_lm, solverVariables_t *element_pSV, std::vector< std::vector< real > > &internal_flux_ij, std::vector< std::vector< real > > &allocation, std::vector< real > &theta_ilk, std::vector< real > &F_mik, std::vector< real > &q, std::vector< real > &aux) const
Calculates internal_flux_ij = A_mjk F_imk for a particular phase space element.
const WxRange & element_full_range() const override
Get a range of elements associated with the entire patch (periphery+interior)
Definition: ndg_kinetic.h:65
size_t get_num_dof() const override
This will give the number of nodes in each "super element" (dof = num nodes)
Definition: ndg_kinetic.h:75
void zero_fluxes() override
Must be implemented as required by spatial solver parent however in this solver I am not storing inte...
void setup(const WxCryptSet &wxc) override
setup sets up the DG solver
const std::shared_ptr< TimestepConstraint > calcElementSourceTerm(const std::vector< wxm::array::patch_array_t * > &input, const int physical_element_index, const int velocity_space_element_indexes[3], solverVariables_t *element_pSV, std::vector< std::vector< real > > &source_term_ij, std::vector< real > &source_allocation, std::vector< real > &q, std::vector< real > &aux) const
Calculates source_ij for a particular phase space element.
The WmSpatialSolver class is a base class for spatial sovers.
Definition: spatial_solver.h:32
wxm::temporal_solver::variables_type variables_type
Definition: spatial_solver.h:46
Definition: tools.h:22
WxRange _interior
Definition: tools.h:40
WxRange _periphery
Definition: tools.h:41
WxRange _full
Definition: tools.h:42
warpy dg
Definition: diffusion.py:157
Base namespace for everything not included in the global namespace.
Definition: field_source.h:8
Definition: wmapplication.h:38
#define real
Definition: wmoclunstructuredreconstruction.h:11