WARPXM v1.10.0
Loading...
Searching...
No Matches
5-moment_base.h
Go to the documentation of this file.
1#pragma once
2
3// wxm includes
4#include "warpxm/warpxm_config.h" // for variable macros
5#include "apps/wmapplication.h" // for pSV
8
9// std includes
10#include <cmath>
11
17{
19 real mass = 1.;
20 real density_min = std::numeric_limits<real>::epsilon();
21 real pressure_min = std::numeric_limits<real>::epsilon();
22 bool entropy_fix = true;
23};
24
25namespace wxm
26{
27namespace apps
28{
29namespace five_moment
30{
31
47 const real rho_min = std::numeric_limits<real>::epsilon());
48
70 const real gas_gamma,
71 const real rho_min = std::numeric_limits<real>::epsilon(),
72 const real press_min = std::numeric_limits<real>::epsilon());
73
99 const real gas_gamma,
100 const real A = 1.0,
101 const real rho_min = std::numeric_limits<real>::epsilon(),
102 const real press_min = std::numeric_limits<real>::epsilon());
103
104/* /\** */
105/* * @brief Generate pressure for 5-moment fluid */
106/* * @param pC Constants specific to this fluid */
107/* * @param Q Conserved variables for 5-moment fluid */
108/* * @return fluid pressure */
109/* *\/ */
110/* real pressure(const constants_5moment_t* pC, const real QC[5]); */
111
118void NCtoC(const constants_5moment_t* pC, const real QNC[5], real QC[5]);
119
127 const real QC[5],
128 real QNC[5],
129 const real rho_min = std::numeric_limits<real>::epsilon(),
130 const real press_min = std::numeric_limits<real>::epsilon());
131
135 const real QNC_center[5],
136 const real dQNC[5],
137 const real QC_center[5],
138 real dQC[5]);
139
146void rotateVector(const real v[5], const solverVariables_t* pSV, real Rv[5]);
147
154void antirotateVector(const real Rv[5], const solverVariables_t* pSV, real v[5]);
155
156// -----------------------------------------------------------------------------------
157// Flux functions
158// -----------------------------------------------------------------------------------
159
169 const real QC[5],
170 real flux[5],
171 const real rho_min = std::numeric_limits<real>::epsilon(),
172 const real press_min = std::numeric_limits<real>::epsilon());
173
185 const real QC_l[5],
186 const real QC_r[5],
187 real* s,
188 real amdq[5],
189 real apdq[5],
190 const real rho_min = std::numeric_limits<real>::epsilon(),
191 const real press_min = std::numeric_limits<real>::epsilon());
192
194 const real ql[5],
195 const real qr[5],
196 const real& pl,
197 const real& pr,
198 real& rho,
199 real& u,
200 real& v,
201 real& w,
202 real& enth,
203 real& a,
204 const real rho_min = std::numeric_limits<real>::epsilon());
205
207 const real ql[5],
208 const real qr[5],
209 const real s[3],
210 const real wave[][3],
211 real amdq[5],
212 real apdq[5],
213 const real rho_min = std::numeric_limits<real>::epsilon(),
214 const real press_min = std::numeric_limits<real>::epsilon());
215
227 const real QC_l[5],
228 const real QC_r[5],
229 void (*numerical_flux_scheme)(const constants_5moment_t* pC,
230 const real QC_l[5],
231 const real QC_r[5],
232 real* s,
233 real amdq[5],
234 real apdq[5],
235 const real rho_min,
236 const real press_min),
237 real flux[5],
238 const real rho_min = std::numeric_limits<real>::epsilon(),
239 const real press_min = std::numeric_limits<real>::epsilon());
240
254 const solverVariables_t* pSV,
255 const real QC_l[5],
256 const real QC_r[5],
257 void (*numerical_flux_scheme)(const constants_5moment_t* pC,
258 const real QC_l[5],
259 const real QC_r[5],
260 real* s,
261 real amdq[5],
262 real apdq[5],
263 const real rho_min,
264 const real press_min),
265 real numericalFlux[5],
266 const real rho_min = std::numeric_limits<real>::epsilon(),
267 const real press_min = std::numeric_limits<real>::epsilon());
268
280 const real QC_l[5],
281 const real QC_r[5],
282 real* s,
283 real amdq[5],
284 real apdq[5],
285 const real rho_min = std::numeric_limits<real>::epsilon(),
286 const real press_min = std::numeric_limits<real>::epsilon());
287
289 const real QC_l[5],
290 const real QC_r[5],
291 real* s,
292 real amdq[5],
293 real apdq[5],
294 const real rho_min = std::numeric_limits<real>::epsilon(),
295 const real press_min = std::numeric_limits<real>::epsilon());
296
307 const solverVariables_t* pSV,
308 const real QC_l[5],
309 const real QC_r[5],
310 real numericalFlux[5],
311 const real rho_min = std::numeric_limits<real>::epsilon(),
312 const real press_min = std::numeric_limits<real>::epsilon());
313
323 const solverVariables_t* pSV,
324 const real QC[5],
325 std::vector<std::vector<real>>& internalFlux,
326 const real rho_min = std::numeric_limits<real>::epsilon(),
327 const real press_min = std::numeric_limits<real>::epsilon());
328
330 const real* q,
331 const real* grad_rho,
332 const real* grad_p[3],
333 real pi[3][3]);
334
336 const solverVariables_t* pSV,
337 const real pi[][3],
338 const real h[3],
339 std::vector<std::vector<real>>& flux_tensor);
340
342 const constants_5moment_t* pC,
343 const solverVariables_t* pSV,
344 const real mu,
345 const real k,
346 const real* q,
347 const real u[3],
348 const real* grad_u[3],
349 const real div_u,
350 const real grad_T[3],
351 std::vector<std::vector<real>>& internal_flux,
352 const real rho_min = std::numeric_limits<real>::epsilon());
353
354// dont use this anymore->remove when navier_stokes app updated
357 const solverVariables_t* pSV,
358 const real viscosity,
359 const real thermal_conductivity,
360 const real* q_l,
361 const real* q_r,
362 const real* aux_l,
363 const real* aux_r,
364 real* numerical_flux,
365 const real rho_min = std::numeric_limits<real>::epsilon(),
366 const real press_min = std::numeric_limits<real>::epsilon());
367
369 const constants_5moment_t* pC_a,
370 const constants_5moment_t* pC_b,
371 const real* q_a,
372 const real* q_b,
373 real* source,
374 const real rho_min = std::numeric_limits<real>::epsilon(),
375 const real press_min = std::numeric_limits<real>::epsilon());
376
377
388 const real* q,
389 const real* aux,
390 const real* grad_u,
391 real* grad_T,
392 const real rho_min = std::numeric_limits<real>::epsilon(),
393 const real press_min = std::numeric_limits<real>::epsilon());
394
396 const real* aux,
397 const real rho_min = std::numeric_limits<real>::epsilon());
398
399void calcGradU(const real* q,
400 const real* aux,
401 real* grad_u[3],
402 const real rho_min = std::numeric_limits<real>::epsilon());
403
405 const real* q,
406 const bool is_neutral,
407 const real collision_coefficient,
408 const real minimum_frequency,
409 const real diffusivity_min,
410 const real diffusivity_max,
411 const bool is_const_mu,
412 const real const_mu,
413 const bool is_const_k,
414 const real const_k,
415 real& mu,
416 real& k,
417 const real rho_min = std::numeric_limits<real>::epsilon(),
418 const real press_min = std::numeric_limits<real>::epsilon());
419
448 const real* q,
449 const real* dqdt,
450 real lambda,
451 const real rho_min = std::numeric_limits<real>::epsilon());
452
453// -----------------------------------------------------------------------------------
454// Boundary condition functions
455// -----------------------------------------------------------------------------------
456namespace bc
457{
459 const solverVariables_t* pSV,
460 const real* QC,
461 const real vx_w,
462 const real vy_w,
463 const real vz_w,
464 real* QC_w);
465
467 const solverVariables_t* pSV,
468 const real* QC,
469 real* QC_w);
470
471void freeslipWallCondition(const solverVariables_t* pSV, const real* QC, real* QC_w);
472
474 const solverVariables_t* pSV,
475 const real* QC,
476 // const real vx_w,
477 // const real vy_w,
478 // const real vz_w,
479 real* QC_w);
480
482 const solverVariables_t* pSV,
483 const real* QC,
484 real* QC_w);
485
486void copyoutBoundaryCondition(const real* QC, real* QC_w);
487
489 const solverVariables_t* pSV,
490 const real* QC,
491 real* QC_w);
492
494 const constants_5moment_t* pC,
495 const solverVariables_t* pSV,
496 const real* QC,
497 real* QC_w,
498 const real rho_min = std::numeric_limits<real>::epsilon());
499
501 const solverVariables_t* pSV,
502 real Aa,
503 real Ab,
504 real Za,
505 real Zb,
506 real ztheta_ba,
507 real skin_depth_norm,
508 real* QC_w);
509
511 const solverVariables_t* pSV,
512 real Ai,
513 real Ae,
514 real Zi,
515 real Ze,
516 real ztheta_ba,
517 real skin_depth_norm,
518 real* QC_w);
519} // namespace bc
520} // namespace five_moment
521} // namespace apps
522} // namespace wxm
523
524// Wrappers of functions outside of namespace for backwards compatibility
525// TODO: deprecate usage and replace with functions in namespace
526
real pressure_5moment(const constants_5moment_t *pC, const real QC[5])
Soon to be deprecated.
void freeslipWallCondition_gradients_yu(const constants_5moment_t *pC, const solverVariables_t *pSV, const real *QC, real *QC_w)
void noslipWallCondition_gradients(const constants_5moment_t *pC, const solverVariables_t *pSV, const real *QC, real *QC_w)
void freeslipWallCondition(const solverVariables_t *pSV, const real *QC, real *QC_w)
void noslipWallCondition(const constants_5moment_t *pC, const solverVariables_t *pSV, const real *QC, const real vx_w, const real vy_w, const real vz_w, real *QC_w)
void imhd_to_twofluid_consistent_assumption(const real *QC, const solverVariables_t *pSV, real Ai, real Ae, real Zi, real Ze, real ztheta_ba, real skin_depth_norm, real *QC_w)
void axisBoundaryCondition(const constants_5moment_t *pC, const solverVariables_t *pSV, const real *QC, real *QC_w)
void copyoutBoundaryCondition(const real *QC, real *QC_w)
void axisBoundaryCondition_gradients(const constants_5moment_t *pC, const solverVariables_t *pSV, const real *QC, real *QC_w, const real rho_min=std::numeric_limits< real >::epsilon())
void imhd_to_twofluid_bc(const real *QC, const solverVariables_t *pSV, real Aa, real Ab, real Za, real Zb, real ztheta_ba, real skin_depth_norm, real *QC_w)
void freeslipWallCondition_yu(const constants_5moment_t *pC, const solverVariables_t *pSV, const real *QC, real *QC_w)
void navier_stokes_viscous_flux_tensor(const real *q, const solverVariables_t *pSV, const real pi[][3], const real h[3], std::vector< std::vector< real > > &flux_tensor)
void navier_stokes_anisotropic_pressure_tensor(const real viscosity, const real *q, const real *grad_rho, const real *grad_p[3], real pi[3][3])
real eulerNumericalFlux(const constants_5moment_t *pC, const solverVariables_t *pSV, const real QC_l[5], const real QC_r[5], void(*numerical_flux_scheme)(const constants_5moment_t *pC, const real QC_l[5], const real QC_r[5], real *s, real amdq[5], real apdq[5], const real rho_min, const real press_min), real numericalFlux[5], const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
Calculates the Numerical Flux for the Euler fluid equations using Roe's Method as given by Leveque in...
void eulerRoeAverages(const constants_5moment_t *pC, const real ql[5], const real qr[5], const real &pl, const real &pr, real &rho, real &u, real &v, real &w, real &enth, real &a, const real rho_min=std::numeric_limits< real >::epsilon())
real navier_stokes_numerical_flux(constants_5moment_t *pC, const solverVariables_t *pSV, const real viscosity, const real thermal_conductivity, const real *q_l, const real *q_r, const real *aux_l, const real *aux_r, real *numerical_flux, const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
real getTemperatureFloored(const real *q, const real gas_gamma, const real A=1.0, const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
Get the temperature from Euler (5-moment) variables using floors for pressure and density.
void eulerHLLEFluxSolver(const constants_5moment_t *pC, const real QC_l[5], const real QC_r[5], real *s, real amdq[5], real apdq[5], const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
Calculates the HLLE flux for the Euler fluid equations.
void antirotateVector(const real Rv[5], const solverVariables_t *pSV, real v[5])
Rotates a 5-moment variable set from local frame to world frame.
real eulerNumericalFlux_x(const constants_5moment_t *pC, const real QC_l[5], const real QC_r[5], void(*numerical_flux_scheme)(const constants_5moment_t *pC, const real QC_l[5], const real QC_r[5], real *s, real amdq[5], real apdq[5], const real rho_min, const real press_min), real flux[5], const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
Calculates the Euler Numerical flux given a scheme along the x-axis which is to be used as a numerica...
void calcGradT(const constants_5moment_t *pC, const real *q, const real *aux, const real *grad_u, real *grad_T, const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
Computes temperature gradients from 5 moment conserved variable gradients/values.
void NCtoC(const constants_5moment_t *pC, const real QNC[5], real QC[5])
Converts nonconserved (primitive) variables to conserved variables.
real getRhoFloored(const real *q, const real rho_min=std::numeric_limits< real >::epsilon())
Get the floored mass density.
real positivity_preserving_source_dt(const real *q, const real *dqdt, real lambda, const real rho_min=std::numeric_limits< real >::epsilon())
Computes the maximum allowable dt for a source term to preserve positivity for the positivity-preserv...
void calcGradU(const real *q, const real *aux, real *grad_u[3], const real rho_min=std::numeric_limits< real >::epsilon())
void eulerFlux(const constants_5moment_t *pC, const real QC[5], real flux[5], const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
Flux along x-axis for Euler fluid equations using conserved variables.
void CtoNC(const constants_5moment_t *pC, const real QC[5], real QNC[5], const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
Converts conserved variables to nonconserved (primitive) variables.
real eulerRusanovFlux(const constants_5moment_t *pC, const solverVariables_t *pSV, const real QC_l[5], const real QC_r[5], real numericalFlux[5], const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
Calculates the Rusanov flux for the Euler fluid equations directly.
void navier_stokes_internal_flux(const constants_5moment_t *pC, const solverVariables_t *pSV, const real mu, const real k, const real *q, const real u[3], const real *grad_u[3], const real div_u, const real grad_T[3], std::vector< std::vector< real > > &internal_flux, const real rho_min=std::numeric_limits< real >::epsilon())
void hartenHymanEntropyFix(const constants_5moment_t *pC, const real ql[5], const real qr[5], const real s[3], const real wave[][3], real amdq[5], real apdq[5], const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
void eulerRoeFluxSolver(const constants_5moment_t *pC, const real QC_l[5], const real QC_r[5], real *s, real amdq[5], real apdq[5], const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
Solves the full Roe decomposition for the euler fluid problem using conserved variables - assumes an ...
void get_mu_and_k(const constants_5moment_t *pC, const real *q, const bool is_neutral, const real collision_coefficient, const real minimum_frequency, const real diffusivity_min, const real diffusivity_max, const bool is_const_mu, const real const_mu, const bool is_const_k, const real const_k, real &mu, real &k, const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
real interspeciesCollisions(const real nu_ab, const constants_5moment_t *pC_a, const constants_5moment_t *pC_b, const real *q_a, const real *q_b, real *source, const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
real eulerInternalFlux(const constants_5moment_t *pC, const solverVariables_t *pSV, const real QC[5], std::vector< std::vector< real > > &internalFlux, const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
Calculates the internal euler flux at a given point.
real getPressureFloored(const real *q, const real gas_gamma, const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
Get the pressure from Euler (5-moment) variables using floors for pressure and density.
real calcDivU(const real *q, const real *aux, const real rho_min=std::numeric_limits< real >::epsilon())
void rotateVector(const real v[5], const solverVariables_t *pSV, real Rv[5])
Rotates a 5-moment variable set from world frame to local frame.
void eulerHLLECFluxSolver(const constants_5moment_t *pC, const real QC_l[5], const real QC_r[5], real *s, real amdq[5], real apdq[5], const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
void NCtoCDifferential(const constants_5moment_t *pC, const real QNC_center[5], const real dQNC[5], const real QC_center[5], real dQC[5])
This currently isn't used anywhere.
Base namespace for everything not included in the global namespace.
Definition: field_source.h:8
Structure for holding constants used in the 5moment solvers.
Definition: 5-moment_base.h:17
real gas_gamma
Definition: 5-moment_base.h:18
real density_min
Definition: 5-moment_base.h:20
real mass
Definition: 5-moment_base.h:19
real pressure_min
Definition: 5-moment_base.h:21
bool entropy_fix
Definition: 5-moment_base.h:22
Definition: wmapplication.h:38
#define real
Definition: wmoclunstructuredreconstruction.h:11