[P]arallel [Hi]gh-order [Li]brary for [P]DEs  Latest
Parallel High-Order Library for PDEs through hp-adaptive Discontinuous Galerkin methods
positivity_preserving_limiter.h
1 #ifndef __POSITIVITY_PRESERVING_LIMITER__
2 #define __POSITIVITY_PRESERVING_LIMITER__
3 
4 #include "bound_preserving_limiter.h"
5 
6 namespace PHiLiP {
8 /**********************************
9 * Zhang, Xiangxiong, and Chi-Wang Shu.
10 * "On positivity-preserving high order discontinuous Galerkin schemes
11 * for compressible Euler equations on rectangular meshes."
12 * Journal of Computational Physics 229.23 (2010): 8918-8934.
13 **********************************/
14 /**********************************
15 * Wang, Cheng, et al.
16 * "Robust high order discontinuous Galerkin schemes for two-dimensional gaseous detonations."
17 * Journal of Computational Physics 231.2 (2012): 653-665.
18 **********************************/
19 template<int dim, int nstate, typename real>
20 class PositivityPreservingLimiter : public BoundPreservingLimiterState <dim, nstate, real>
21 {
22 public:
25  const Parameters::AllParameters* const parameters_input);
26 
28  ~PositivityPreservingLimiter() = default;
29 
32 
34  std::shared_ptr<BoundPreservingLimiterState<dim, nstate, real>> tvbLimiter;
35 
37  std::shared_ptr < Physics::Euler<dim, nstate, double > > euler_physics;
38 
41 
45  void limit(
46  dealii::LinearAlgebra::distributed::Vector<double>& solution,
47  const dealii::DoFHandler<dim>& dof_handler,
48  const dealii::hp::FECollection<dim>& fe_collection,
49  const dealii::hp::QCollection<dim>& volume_quadrature_collection,
50  const unsigned int grid_degree,
51  const unsigned int max_degree,
52  const dealii::hp::FECollection<1> oneD_fe_collection_1state,
53  const dealii::hp::QCollection<1> oneD_quadrature_collection,
54  double dt) override;
55 protected:
56 
60  std::array<real, nstate> get_soln_cell_avg_PPL(
61  const std::array<std::array<std::vector<real>, nstate>, dim>& soln_at_q,
62  const unsigned int n_quad_pts,
63  const std::vector<real>& quad_weights_GLL,
64  const std::vector<real>& quad_weights_GL,
65  double& dt);
66 
69  std::vector<real> get_theta2_Zhang2010(
70  const std::vector< real >& p_lim,
71  const std::array<real, nstate>& soln_cell_avg,
72  const std::array<std::vector<real>, nstate>& soln_at_q,
73  const unsigned int n_quad_pts,
74  const double eps,
75  const double gamma);
76 
80  const std::array<std::vector<real>, nstate>& soln_at_q,
81  const unsigned int n_quad_pts,
82  const double p_avg);
83 
87  const double density_avg,
88  const double density_min,
89  const double pos_eps,
90  const double p_avg);
91 
95  dealii::LinearAlgebra::distributed::Vector<double>& solution,
96  const std::array<std::vector<real>, nstate>& soln_coeff,
97  const unsigned int n_shape_fns,
98  const std::vector<dealii::types::global_dof_index>& current_dofs_indices);
99 
100  // Values required to compute solution cell average in 2D/3D
101  real dx;
102  real dy;
103  real dz;
104 }; // End of PositivityPreservingLimiter Class
105 } // PHiLiP namespace
106 
107 #endif
108 
void limit(dealii::LinearAlgebra::distributed::Vector< double > &solution, const dealii::DoFHandler< dim > &dof_handler, const dealii::hp::FECollection< dim > &fe_collection, const dealii::hp::QCollection< dim > &volume_quadrature_collection, const unsigned int grid_degree, const unsigned int max_degree, const dealii::hp::FECollection< 1 > oneD_fe_collection_1state, const dealii::hp::QCollection< 1 > oneD_quadrature_collection, double dt) override
real get_theta2_Wang2012(const std::array< std::vector< real >, nstate > &soln_at_q, const unsigned int n_quad_pts, const double p_avg)
void write_limited_solution(dealii::LinearAlgebra::distributed::Vector< double > &solution, const std::array< std::vector< real >, nstate > &soln_coeff, const unsigned int n_shape_fns, const std::vector< dealii::types::global_dof_index > &current_dofs_indices)
std::shared_ptr< BoundPreservingLimiterState< dim, nstate, real > > tvbLimiter
Pointer to TVB limiter class (TVB limiter can be applied in conjunction with this limiter) ...
Base Class for bound preserving limiters templated on state.
PositivityPreservingLimiter(const Parameters::AllParameters *const parameters_input)
Constructor.
const int nstate
Number of states.
Files for the baseline physics.
Definition: ADTypes.hpp:10
Main parameter class that contains the various other sub-parameter classes.
std::vector< real > get_theta2_Zhang2010(const std::vector< real > &p_lim, const std::array< real, nstate > &soln_cell_avg, const std::array< std::vector< real >, nstate > &soln_at_q, const unsigned int n_quad_pts, const double eps, const double gamma)
~PositivityPreservingLimiter()=default
Destructor.
Parameters related to the flow solver.
real get_density_scaling_value(const double density_avg, const double density_min, const double pos_eps, const double p_avg)
real dz
Value required to compute solution cell average in 2D/3D, calculated using zmax and zmin parameters...
const Parameters::FlowSolverParam flow_solver_param
Flow solver parameters.
Class for implementation of two forms of the Positivity-Preserving limiter derived from BoundPreservi...
std::array< real, nstate > get_soln_cell_avg_PPL(const std::array< std::array< std::vector< real >, nstate >, dim > &soln_at_q, const unsigned int n_quad_pts, const std::vector< real > &quad_weights_GLL, const std::vector< real > &quad_weights_GL, double &dt)
std::shared_ptr< Physics::Euler< dim, nstate, double > > euler_physics
Euler physics pointer. Used to compute pressure.
real dy
Value required to compute solution cell average in 2D/3D, calculated using ymax and ymin parameters...
real dx
Value required to compute solution cell average in 2D/3D, calculated using xmax and xmin parameters...