[P]arallel [Hi]gh-order [Li]brary for [P]DEs  Latest
Parallel High-Order Library for PDEs through hp-adaptive Discontinuous Galerkin methods
bound_preserving_limiter.cpp
1 #include "bound_preserving_limiter.h"
2 #include "physics/physics_factory.h"
3 
4 namespace PHiLiP {
5 // Constructor
6 template <int dim, typename real>
8  const int nstate_input,
9  const Parameters::AllParameters* const parameters_input)
10  : nstate(nstate_input)
11  , all_parameters(parameters_input) {}
12 
13 
14 template <int dim, int nstate, typename real>
16  const Parameters::AllParameters* const parameters_input)
17  : BoundPreservingLimiter<dim, real>::BoundPreservingLimiter(nstate, parameters_input)
18 {}
19 
20 template <int dim, int nstate, typename real>
22  const std::array<std::vector<real>, nstate>& soln_at_q,
23  const unsigned int n_quad_pts,
24  const std::vector<real>& quad_weights)
25 {
26  std::array<real, nstate> soln_cell_avg;
27  for (unsigned int istate = 0; istate < nstate; ++istate) {
28  soln_cell_avg[istate] = 0;
29  }
30 
31  // Apply integral for solution cell average (dealii quadrature operates from [0,1])
32  for (unsigned int istate = 0; istate < nstate; ++istate) {
33  for (unsigned int iquad = 0; iquad < n_quad_pts; ++iquad) {
34  soln_cell_avg[istate] += quad_weights[iquad]
35  * soln_at_q[istate][iquad];
36  }
37  }
38 
39  return soln_cell_avg;
40 }
41 
49 } // PHiLiP namespace
Base Class for bound preserving limiters templated on state.
const int nstate
Number of states.
Files for the baseline physics.
Definition: ADTypes.hpp:10
BoundPreservingLimiter(const int nstate_input, const Parameters::AllParameters *const parameters_input)
Constructor.
Main parameter class that contains the various other sub-parameter classes.
std::array< real, nstate > get_soln_cell_avg(const std::array< std::vector< real >, nstate > &soln_at_q, const unsigned int n_quad_pts, const std::vector< real > &quad_weights)
Function to obtain the solution cell average.
Base Class for implementation of bound preserving limiters.
BoundPreservingLimiterState(const Parameters::AllParameters *const parameters_input)
Constructor.