WARPXM v1.10.0
Loading...
Searching...
No Matches
ndg_mhd_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"
11
12namespace wxm
13{
14namespace dfem
15{
16namespace variable_adjuster
17{
18namespace limiter
19{
20namespace positivity_enforcing
21{
34{
35public:
37 std::vector<real>& B_x_bar,
38 std::vector<real>& B_y_bar,
39 std::vector<real>& B_z_bar,
43 int num_pp_quad_nodes,
44 int num_lagrange_nodes,
45 int ndims)
46 : euler_helper(euler_helper),
47 _B_x_bar(B_x_bar),
48 _B_y_bar(B_y_bar),
49 _B_z_bar(B_z_bar),
50 _B_x(B_x),
51 _B_y(B_y),
52 _B_z(B_z)
53 {
54 _B_x_pp_quad_node_values = std::vector<real>(num_pp_quad_nodes);
55 _B_y_pp_quad_node_values = std::vector<real>(num_pp_quad_nodes);
56 _B_z_pp_quad_node_values = std::vector<real>(num_pp_quad_nodes);
57
58 _B_x_array = static_cast<wxm::dfem::array::patch_array_t*>(B_x);
59 _B_y_array = static_cast<wxm::dfem::array::patch_array_t*>(B_y);
60 _B_z_array = static_cast<wxm::dfem::array::patch_array_t*>(B_z);
61 }
62
67 real rho_ux,
68 real rho_uy,
69 real rho_uz,
70 real E,
71 real B_x,
72 real B_y,
73 real B_z,
74 int ndims);
75
81 WxRange& _element_range,
82 int ndims);
83
97 int element_start,
98 bool include_gaussian_quad_nodes,
99 bool include_interior_lgl_nodes);
100
106
111
112 real calculateThetaE(int element_index, real internal_energy_bar, real eps_p);
113
118 void scaleByThetaRhoAndThetaE(int element_index, real theta_rho, real theta_e);
119
120private:
121 EulerLimiterHelper euler_helper;
122
123 std::vector<real>& _B_x_bar;
124 std::vector<real>& _B_y_bar;
125 std::vector<real>& _B_z_bar;
126
127 std::vector<real> _B_x_pp_quad_node_values;
128 std::vector<real> _B_y_pp_quad_node_values;
129 std::vector<real> _B_z_pp_quad_node_values;
130
134
138};
139
152{
153public:
155
160 virtual void setup(const WxCryptSet& wxc) override;
161
165 void solve(real time, variables_type& input) override;
166
167protected:
169
170 std::unique_ptr<WmUDGGeometry> _dg_geometry;
171
174
177
185
197
199
200 std::vector<real> _rho_bar;
201 std::vector<real> _rho_ux_bar;
202 std::vector<real> _rho_uy_bar;
203 std::vector<real> _rho_uz_bar;
204 std::vector<real> _e_bar;
205 std::vector<real> _B_x_bar;
206 std::vector<real> _B_y_bar;
207 std::vector<real> _B_z_bar;
208
209private:
210};
211
212} // namespace positivity_enforcing
213} // namespace limiter
214} // namespace variable_adjuster
215} // namespace dfem
216} // 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
Helper class for the NDGMHDPositivityPreservingLimiter.
Definition: ndg_mhd_positivity_enforcing_limiter.h:34
real calculateThetaE(int element_index, real internal_energy_bar, real eps_p)
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,...
real internalEnergyOfCellAverage(int element_index)
Compute the internal energy of the cell average, e_bar - |rho_u_bar|^2 / (2*rho_bar) - |B_bar|^2/2.
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,...
static real internal_energy(real rho, real rho_ux, real rho_uy, real rho_uz, real E, real B_x, real B_y, real B_z, int ndims)
Compute the internal energy, E - |rho_u|^2/(2*rho) - |B|^2/2.
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 ...
real calculateAndScalePPQuadNodesByThetaRho(int element_index, real eps_rho)
Perform the scaling by theta_rho.
MHDLimiterHelper(EulerLimiterHelper euler_helper, std::vector< real > &B_x_bar, std::vector< real > &B_y_bar, std::vector< real > &B_z_bar, wxm::array::patch_array_t *B_x, wxm::array::patch_array_t *B_y, wxm::array::patch_array_t *B_z, int num_pp_quad_nodes, int num_lagrange_nodes, int ndims)
Definition: ndg_mhd_positivity_enforcing_limiter.h:36
Simple scaling limiter which enforces positivity of density and pressure while preserving cell averag...
Definition: ndg_mhd_positivity_enforcing_limiter.h:152
real _eps_rho
The minimum allowable value of density.
Definition: ndg_mhd_positivity_enforcing_limiter.h:173
bool _include_gaussian_quad_nodes
Whether the basis's GQ nodes should be included in the set of positivity nodes.
Definition: ndg_mhd_positivity_enforcing_limiter.h:184
std::vector< real > _rho_uy_bar
Definition: ndg_mhd_positivity_enforcing_limiter.h:202
void solve(real time, variables_type &input) override
Applies the limiter to input by modifying it in place.
std::vector< real > _rho_ux_bar
Definition: ndg_mhd_positivity_enforcing_limiter.h:201
std::vector< real > _B_z_bar
Definition: ndg_mhd_positivity_enforcing_limiter.h:207
WxRange _element_range
Definition: ndg_mhd_positivity_enforcing_limiter.h:198
std::vector< real > _e_bar
Definition: ndg_mhd_positivity_enforcing_limiter.h:204
WmBasisArraySet _basis_set
Definition: ndg_mhd_positivity_enforcing_limiter.h:168
std::vector< real > _B_x_bar
Definition: ndg_mhd_positivity_enforcing_limiter.h:205
virtual void setup(const WxCryptSet &wxc) override
Setup the spatial solver using the cryptset.
bool _include_interior_lgl_nodes
Whether the basis's interior LGL nodes should be included in the set of positivity nodes.
Definition: ndg_mhd_positivity_enforcing_limiter.h:196
std::vector< real > _rho_uz_bar
Definition: ndg_mhd_positivity_enforcing_limiter.h:203
real _eps_p
The minimum allowable value of density.
Definition: ndg_mhd_positivity_enforcing_limiter.h:176
std::vector< real > _rho_bar
Definition: ndg_mhd_positivity_enforcing_limiter.h:200
std::unique_ptr< WmUDGGeometry > _dg_geometry
Definition: ndg_mhd_positivity_enforcing_limiter.h:170
std::vector< real > _B_y_bar
Definition: ndg_mhd_positivity_enforcing_limiter.h:206
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