WARPXM v1.10.0
Loading...
Searching...
No Matches
wmapplication.h
Go to the documentation of this file.
1#ifndef WMAPPLICATION_H
2#define WMAPPLICATION_H
3
4// Wx includes
5#include "lib/wxlogstream.h"
6#include "lib/wxcryptset.h"
7#include "warpxm/warpxm_config.h"
8
9#include "app_base.h"
10
11// STD libraries
12#include <iostream>
13#include <vector>
14#include <memory>
15
16enum
17{
32 // WMAPPLICATIONFLAG_BC_GRADIENT_Q
33};
34
35// For now putting SolverVariables_t here. Need to really consider where it
36// belongs and whether it needs to be split up
38{
40 real x[3];
41 real dx[3];
43 real R[3][3];
53 real v[3]; // VELOCITY SPACE FOR KINETICS
54 real dv[3]; // VELOCITY SPACE FOR KINETICSN
55 int num_dims_velocity_space; // VELOCITY SPACE FOR KINETICS
56 real v_norm[3]; // VELOCITY SPACE FOR KINETICS
57 real k[3]; // WAVENUMBER COORDINATE FOR DIFFUSION COEFFICIENT CALCULATION
58};
59
60// Perhaps later SolverVariables_t will be split up into these?
64
68std::vector<int> map_sub_app_indices(const std::vector<int>& parent_idcs,
69 const std::vector<int>& child_idcs);
70
75void map_parent_to_sub_app(const std::vector<int>& map,
76 const real* parent_q,
77 std::vector<real>& child_q);
78
83void map_sub_app_to_parent(const std::vector<int>& map,
84 real* parent_q,
85 const std::vector<real>& child_q);
86
93{
94public:
96
97 typedef std::map<std::string, std::string> replaceMap_t;
98
100
101 virtual ~WmApplication() = default;
102
103 virtual void setup(const WxCryptSet& wxc);
104
105 virtual const std::vector<int>&
107 {
108 return empty;
109 }
110
111 virtual const std::vector<int>&
113 {
114 return empty;
115 }
116
117 const std::vector<std::string>& getBoundaryNames() const
118 {
119 return _onBoundaries;
120 }
121
122 bool isOnBoundary(const std::string& boundaryName) const;
123 bool has(int flag) const;
124
125 // required app functions
126 virtual real numerical_flux(const real* q_l,
127 const real* q_r,
128 const real* aux_l,
129 const real* aux_r,
130 const solverVariables_t* pFV,
131 real* numericalFlux) const
132 {
133 WxExcept wxe("No Numerical Flux function defined\n");
134 throw wxe;
135 }
136
137 virtual real internal_flux(const real* q,
138 const real* aux,
139 const solverVariables_t* pSV,
140 std::vector<std::vector<real>>& internalFlux) const
141 {
142 WxExcept wxe("No Internal Flux function defined\n");
143 throw wxe;
144 }
145
146 virtual real source(const real* q,
147 const real* aux,
148 const elementGeometry_t* pEG,
149 real* source) const
150 {
151 WxExcept wxe("No Source function defined\n");
152 throw wxe;
153 }
154
175 virtual void bc_q(const real* q_in,
176 const real* aux_in,
177 const real* aux_out,
178 const solverVariables_t* pFV,
179 real* q_out) const
180 {
181 WxExcept wxe("No BC Q function defined\n");
182 throw wxe;
183 }
184
185 virtual real bcNumericalFlux(const real* q_l,
186 const real* q_r,
187 const real* aux_l,
188 const real* aux_r,
189 const solverVariables_t* pFV,
190 real* numericalFlux) const
191 {
192 WxExcept wxe("No BC Numerical Flux function defined\n");
193 throw wxe;
194 }
195
196 virtual void conserved_to_primitive(const real* q, const real* aux, real* w) const
197 {
198 WxExcept wxe("No Conserved to Primitive Function defined\n");
199 throw wxe;
200 }
201
202 virtual void primitive_to_conserved(const real* w, const real* aux, real* q) const
203 {
204 WxExcept wxe("No Primitive to Conserved Function defined\n");
205 throw wxe;
206 }
207
208 virtual void evaluate_function(const real* q,
209 const real* aux,
210 const solverVariables_t* pSV,
211 real* result) const
212 {
213 WxExcept wxe("No Evaluate Function defined\n");
214 throw wxe;
215 }
216
217 virtual void bc_q_kinetic(const real* q_in,
218 const real* aux_in,
219 const solverVariables_t* pFV,
220 real* q_out) const
221 {
222 WxExcept wxe("No BC Q Kinetic function defined\n");
223 throw wxe;
224 }
225
226 std::shared_ptr<std::string> app_name()
227 {
228 return std::make_shared<std::string>(_app_name);
229 }
230
231protected:
232 std::string _app_name;
234 std::vector<int> _allowedFlags;
235
236 std::vector<std::string> _onBoundaries;
237
238private:
239 WmApplication& operator=(const WmApplication& var);
240 WmApplication(const WmApplication& var);
241};
242
243#endif
Base Class for physics applications.
Definition: wmapplication.h:93
virtual void bc_q(const real *q_in, const real *aux_in, const real *aux_out, const solverVariables_t *pFV, real *q_out) const
Boundary Condition Application which sets the boundary condition on ghost nodes.
Definition: wmapplication.h:175
virtual real numerical_flux(const real *q_l, const real *q_r, const real *aux_l, const real *aux_r, const solverVariables_t *pFV, real *numericalFlux) const
Definition: wmapplication.h:126
virtual void evaluate_function(const real *q, const real *aux, const solverVariables_t *pSV, real *result) const
Definition: wmapplication.h:208
WxLogStream _debStrm
Definition: wmapplication.h:233
virtual void bc_q_kinetic(const real *q_in, const real *aux_in, const solverVariables_t *pFV, real *q_out) const
Definition: wmapplication.h:217
virtual const std::vector< int > & getAuxiliaryVariableIndexes(int flag=WMAPPLICATIONFLAG_NONE) const
Definition: wmapplication.h:106
bool has(int flag) const
std::vector< int > _allowedFlags
Definition: wmapplication.h:234
virtual void conserved_to_primitive(const real *q, const real *aux, real *w) const
Definition: wmapplication.h:196
std::vector< std::string > _onBoundaries
Definition: wmapplication.h:236
std::string _app_name
Definition: wmapplication.h:232
virtual real internal_flux(const real *q, const real *aux, const solverVariables_t *pSV, std::vector< std::vector< real > > &internalFlux) const
Definition: wmapplication.h:137
const std::vector< std::string > & getBoundaryNames() const
Definition: wmapplication.h:117
virtual real bcNumericalFlux(const real *q_l, const real *q_r, const real *aux_l, const real *aux_r, const solverVariables_t *pFV, real *numericalFlux) const
Definition: wmapplication.h:185
Application_Variable WmApplication_Variable
Definition: wmapplication.h:95
virtual ~WmApplication()=default
virtual void primitive_to_conserved(const real *w, const real *aux, real *q) const
Definition: wmapplication.h:202
virtual real source(const real *q, const real *aux, const elementGeometry_t *pEG, real *source) const
Definition: wmapplication.h:146
std::shared_ptr< std::string > app_name()
Definition: wmapplication.h:226
std::map< std::string, std::string > replaceMap_t
Definition: wmapplication.h:97
virtual const std::vector< int > & getCrossVariableIndexes(int flag=WMAPPLICATIONFLAG_NONE) const
Definition: wmapplication.h:112
bool isOnBoundary(const std::string &boundaryName) const
virtual void setup(const WxCryptSet &wxc)
WxCryptSet extends WxCrypt by providing, in addition to name-value pairs, an set of named WxCryptSets...
Definition: wxcryptset.h:35
Provides interface to streaming iostreams to logs.
Definition: wxlogstream.h:19
Definition: app_base.h:21
Definition: app_base.h:15
static std::vector< int > empty
Definition: app_base.h:35
wxm::lib::Except is the class to use for creating and throwing exceptions.
Definition: wxexcept.h:31
Definition: wmapplication.h:38
real v_norm[3]
Definition: wmapplication.h:56
real x[3]
Definition: wmapplication.h:40
real dv[3]
Definition: wmapplication.h:54
real beta
Definition: wmapplication.h:46
real R[3][3]
Definition: wmapplication.h:43
int num_dims_velocity_space
Definition: wmapplication.h:55
bool is_on_physical_boundary
Definition: wmapplication.h:49
real eta
Definition: wmapplication.h:45
real dx[3]
Definition: wmapplication.h:41
real dxn
Definition: wmapplication.h:42
real beta_times_common_n_dot_n
Definition: wmapplication.h:50
real common_n[3]
Definition: wmapplication.h:51
real time
Definition: wmapplication.h:39
real cfl_max
Definition: wmapplication.h:44
real v[3]
Definition: wmapplication.h:53
int num_dims
Definition: wmapplication.h:48
int spatial_order
Definition: wmapplication.h:52
real k[3]
Definition: wmapplication.h:57
int faceIndex
Definition: wmapplication.h:47
@ WMAPPLICATIONFLAG_EVALUATE_FUNCTION
Definition: wmapplication.h:30
@ WMAPPLICATIONFLAG_INTERNALDIFFUSION
Definition: wmapplication.h:25
@ WMAPPLICATIONFLAG_INTERNALFLUX
Definition: wmapplication.h:22
@ WMAPPLICATIONFLAG_KINETIC_BC_Q
Definition: wmapplication.h:31
@ WMAPPLICATIONFLAG_BC_XQ
Definition: wmapplication.h:27
@ WMAPPLICATIONFLAG_NUMERICALDIFFUSION
Definition: wmapplication.h:23
@ WMAPPLICATIONFLAG_BC_NUMERICALDIFFUSION
Definition: wmapplication.h:24
@ WMAPPLICATIONFLAG_NUMERICALFLUX
Definition: wmapplication.h:19
@ WMAPPLICATIONFLAG_SOURCE
Definition: wmapplication.h:26
@ WMAPPLICATIONFLAG_CONSERVED_PRIMITIVE_CONVERSION
Definition: wmapplication.h:29
@ WMAPPLICATIONFLAG_BC_Q
Definition: wmapplication.h:28
@ WMAPPLICATIONFLAG_BC_NUMERICALFLUX
Definition: wmapplication.h:20
@ WMAPPLICATIONFLAG_NONE
Definition: wmapplication.h:18
@ WMAPPLICATIONFLAG_GRADIENT_BC
Definition: wmapplication.h:21
void map_parent_to_sub_app(const std::vector< int > &map, const real *parent_q, std::vector< real > &child_q)
Reads data from parent_q and writes into child_q.
solverVariables_t elementGeometry_t
Definition: wmapplication.h:62
void map_sub_app_to_parent(const std::vector< int > &map, real *parent_q, const std::vector< real > &child_q)
Adds data from child_q into parent_q.
solverVariables_t solver_variables_t
Definition: wmapplication.h:63
solverVariables_t fluxVariables_t
Definition: wmapplication.h:61
std::vector< int > map_sub_app_indices(const std::vector< int > &parent_idcs, const std::vector< int > &child_idcs)
Constructs the map for converting between parent vars and child vars.
#define real
Definition: wmoclunstructuredreconstruction.h:11