WARPXM v1.10.0
Loading...
Searching...
No Matches
ndg_euler_positivity_enforcing_limiter.h
Go to the documentation of this file.
1#pragma once
2
3#include "array/array.h"
8#include "dfem/dfem_kernels.h"
9#include "wxm_boost/math/constants/constants.hpp"
10
11namespace wxm
12{
13namespace dfem
14{
15namespace variable_adjuster
16{
17namespace limiter
18{
19namespace positivity_enforcing
20{
33{
34public:
35 EulerLimiterHelper(std::vector<real>& rho_bar,
36 std::vector<real>& rho_ux_bar,
37 std::vector<real>& rho_uy_bar,
38 std::vector<real>& rho_uz_bar,
39 std::vector<real>& e_bar,
45 int num_pp_quad_nodes,
47 int ndims)
48 : ndims(ndims),
50 _rho_bar(rho_bar),
51 _rho_ux_bar(rho_ux_bar),
52 _rho_uy_bar(rho_uy_bar),
53 _rho_uz_bar(rho_uz_bar),
54 _e_bar(e_bar),
55 _rho(rho),
56 _rho_ux(rho_ux),
57 _rho_uy(rho_uy),
58 _rho_uz(rho_uz),
59 _e(e)
60 {
61 _rho_pp_quad_node_values = std::vector<real>(num_pp_quad_nodes);
62 _rho_ux_pp_quad_node_values = std::vector<real>(num_pp_quad_nodes);
63 _rho_uy_pp_quad_node_values = std::vector<real>(num_pp_quad_nodes);
64 _rho_uz_pp_quad_node_values = std::vector<real>(num_pp_quad_nodes);
65 _e_pp_quad_node_values = std::vector<real>(num_pp_quad_nodes);
66
68 _rho_ux_array = static_cast<wxm::dfem::array::patch_array_t*>(rho_ux);
69 _rho_uy_array = static_cast<wxm::dfem::array::patch_array_t*>(rho_uy);
70 _rho_uz_array = static_cast<wxm::dfem::array::patch_array_t*>(rho_uz);
72 }
73
77 static real
78 internal_energy(real rho, real rho_ux, real rho_uy, real rho_uz, real E, int ndims);
79
85 WxRange& _element_range,
86 int ndims);
87
101 int element_start,
102 bool include_gaussian_quad_nodes,
103 bool include_interior_lgl_nodes);
104
110
115
116 real calculateThetaE(int element_index, real internal_energy_bar, real eps_p);
117
122 void scaleByThetaRhoAndThetaE(int element_index, real theta_rho, real theta_e);
123
124public:
125 int ndims;
127
128 std::vector<real>& _rho_bar;
129 std::vector<real>& _rho_ux_bar;
130 std::vector<real>& _rho_uy_bar;
131 std::vector<real>& _rho_uz_bar;
132 std::vector<real>& _e_bar;
133
134 std::vector<real> _rho_pp_quad_node_values;
138 std::vector<real> _e_pp_quad_node_values;
139
145
151
152 static real calculate_theta_rho(std::vector<real>& rho, real rho_bar, real eps_rho);
153};
154
167{
168public:
170
175 virtual void setup(const WxCryptSet& wxc) override;
176
180 void solve(real time, variables_type& input) override;
181
182protected:
184
185 std::unique_ptr<WmUDGGeometry> _dg_geometry;
186
189
192
200
212
214
215 std::vector<real> _rho_bar;
216 std::vector<real> _rho_ux_bar;
217 std::vector<real> _rho_uy_bar;
218 std::vector<real> _rho_uz_bar;
219 std::vector<real> _e_bar;
220
221private:
222};
223
224} // namespace positivity_enforcing
225} // namespace limiter
226} // namespace variable_adjuster
227} // namespace dfem
228} // namespace wxm
Definition: wmbasisarrayset.h:13
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
Definition: array.h:190
The patch_array_t class defines a dataset associated with a patch of the domain This class will be us...
Definition: patch_array.h:31
Helper class for the NDGEulerPositivityPreservingLimiter.
Definition: ndg_euler_positivity_enforcing_limiter.h:33
std::vector< real > & _rho_ux_bar
Definition: ndg_euler_positivity_enforcing_limiter.h:129
int ndims
Definition: ndg_euler_positivity_enforcing_limiter.h:125
std::vector< real > _rho_uy_pp_quad_node_values
Definition: ndg_euler_positivity_enforcing_limiter.h:136
void scaleByThetaRhoAndThetaE(int element_index, real theta_rho, real theta_e)
Complete the scaling by theta_rho and theta_e, overwriting the given element's data in _rho_array,...
std::vector< real > _e_pp_quad_node_values
Definition: ndg_euler_positivity_enforcing_limiter.h:138
void take_elementwise_averages(WmBasisArraySet &basis_set, WxRange &_element_range, int ndims)
Take elementwise averages over the given element range, and write them to the _bar suffixed instance ...
wxm::dfem::array::patch_array_t * _e_array
Definition: ndg_euler_positivity_enforcing_limiter.h:150
wxm::dfem::array::patch_array_t * _rho_ux_array
Definition: ndg_euler_positivity_enforcing_limiter.h:147
real calculateThetaE(int element_index, real internal_energy_bar, real eps_p)
std::vector< real > & _rho_uy_bar
Definition: ndg_euler_positivity_enforcing_limiter.h:130
void convertElementLagrangeToPPQuadNodes(WmBasisArraySet &basis_set, int element_start, bool include_gaussian_quad_nodes, bool include_interior_lgl_nodes)
Perform the conversion of Lagrange nodal to Positivity-preserving quadrature nodal values,...
wxm::dfem::array::patch_array_t * _rho_uy_array
Definition: ndg_euler_positivity_enforcing_limiter.h:148
EulerLimiterHelper(std::vector< real > &rho_bar, std::vector< real > &rho_ux_bar, std::vector< real > &rho_uy_bar, std::vector< real > &rho_uz_bar, std::vector< real > &e_bar, wxm::array::patch_array_t *rho, wxm::array::patch_array_t *rho_ux, wxm::array::patch_array_t *rho_uy, wxm::array::patch_array_t *rho_uz, wxm::array::patch_array_t *e, int num_pp_quad_nodes, int num_lagrange_nodes, int ndims)
Definition: ndg_euler_positivity_enforcing_limiter.h:35
real calculateAndScalePPQuadNodesByThetaRho(int element_index, real eps_rho)
Perform the scaling by theta_rho.
std::vector< real > & _rho_bar
Definition: ndg_euler_positivity_enforcing_limiter.h:128
wxm::array::patch_array_t * _rho_uz
Definition: ndg_euler_positivity_enforcing_limiter.h:143
int num_lagrange_nodes
Definition: ndg_euler_positivity_enforcing_limiter.h:126
std::vector< real > _rho_uz_pp_quad_node_values
Definition: ndg_euler_positivity_enforcing_limiter.h:137
wxm::array::patch_array_t * _rho_ux
Definition: ndg_euler_positivity_enforcing_limiter.h:141
real internalEnergyOfCellAverage(int element_index)
Compute the internal energy of the cell average, e_bar - |rho_u_bar|^2 / (2*rho_bar).
wxm::dfem::array::patch_array_t * _rho_uz_array
Definition: ndg_euler_positivity_enforcing_limiter.h:149
wxm::array::patch_array_t * _rho
Definition: ndg_euler_positivity_enforcing_limiter.h:140
std::vector< real > & _e_bar
Definition: ndg_euler_positivity_enforcing_limiter.h:132
static real calculate_theta_rho(std::vector< real > &rho, real rho_bar, real eps_rho)
wxm::array::patch_array_t * _rho_uy
Definition: ndg_euler_positivity_enforcing_limiter.h:142
wxm::dfem::array::patch_array_t * _rho_array
Definition: ndg_euler_positivity_enforcing_limiter.h:146
std::vector< real > _rho_ux_pp_quad_node_values
Definition: ndg_euler_positivity_enforcing_limiter.h:135
std::vector< real > & _rho_uz_bar
Definition: ndg_euler_positivity_enforcing_limiter.h:131
static real internal_energy(real rho, real rho_ux, real rho_uy, real rho_uz, real E, int ndims)
Compute the internal energy, E - |rho_u|^2/(2*rho)
std::vector< real > _rho_pp_quad_node_values
Definition: ndg_euler_positivity_enforcing_limiter.h:134
wxm::array::patch_array_t * _e
Definition: ndg_euler_positivity_enforcing_limiter.h:144
Simple scaling limiter which enforces positivity of density and pressure while preserving cell averag...
Definition: ndg_euler_positivity_enforcing_limiter.h:167
std::vector< real > _e_bar
Definition: ndg_euler_positivity_enforcing_limiter.h:219
std::vector< real > _rho_ux_bar
Definition: ndg_euler_positivity_enforcing_limiter.h:216
std::unique_ptr< WmUDGGeometry > _dg_geometry
Definition: ndg_euler_positivity_enforcing_limiter.h:185
void solve(real time, variables_type &input) override
Applies the limiter to input by modifying it in place.
bool _include_interior_lgl_nodes
Whether the basis's interior LGL nodes should be included in the set of positivity nodes.
Definition: ndg_euler_positivity_enforcing_limiter.h:211
std::vector< real > _rho_uy_bar
Definition: ndg_euler_positivity_enforcing_limiter.h:217
std::vector< real > _rho_uz_bar
Definition: ndg_euler_positivity_enforcing_limiter.h:218
bool _include_gaussian_quad_nodes
Whether the basis's GQ nodes should be included in the set of positivity nodes.
Definition: ndg_euler_positivity_enforcing_limiter.h:199
virtual void setup(const WxCryptSet &wxc) override
Setup the spatial solver using the cryptset.
real _eps_p
The minimum allowable value of internal energy, i.e.
Definition: ndg_euler_positivity_enforcing_limiter.h:191
WmBasisArraySet _basis_set
Definition: ndg_euler_positivity_enforcing_limiter.h:183
std::vector< real > _rho_bar
Definition: ndg_euler_positivity_enforcing_limiter.h:215
WxRange _element_range
Definition: ndg_euler_positivity_enforcing_limiter.h:213
real _eps_rho
The minimum allowable value of density.
Definition: ndg_euler_positivity_enforcing_limiter.h:188
The WmVariableAdjuster class is a base class for variable adjusters.
Definition: variable_adjuster.h:31
wxm::temporal_solver::variables_type variables_type
Definition: variable_adjuster.h:41
Base namespace for everything not included in the global namespace.
Definition: field_source.h:8
#define real
Definition: wmoclunstructuredreconstruction.h:11