WARPXM v1.10.0
Loading...
Searching...
No Matches
wmpearsonIVfunctions.h
Go to the documentation of this file.
1#ifndef WMPEARSONIVFUNCTIONS_H
2#define WMPEARSONIVFUNCTIONS_H
3
5{
6enum
7{
8 ixx = 4,
9 ixy = 5,
10 ixz = 6,
11 iyy = 7,
12 iyz = 8,
13 izz = 9
14};
15
16template<typename real> inline void PrimitiveToConserved(const real* qnc, real* q)
17{
18 // Convert non-conserved (density, velocity, pressure, heat flux) to conserved
19 // variables (density, momentum, energy, conserved heat flux) Density
20 q[0] = qnc[0];
21
22 // Velocity
23 q[1] = qnc[1] * qnc[0];
24 q[2] = qnc[2] * qnc[0];
25 q[3] = qnc[3] * qnc[0];
26
27 // Energy
28 q[ixx] = qnc[ixx] + qnc[1] * q[1];
29 q[ixy] = qnc[ixy] + qnc[1] * q[2];
30 q[ixz] = qnc[ixz] + qnc[1] * q[3];
31 q[iyy] = qnc[iyy] + qnc[2] * q[2];
32 q[iyz] = qnc[iyz] + qnc[2] * q[3];
33 q[izz] = qnc[izz] + qnc[3] * q[3];
34
35 // (Conserved) Heat flux
36 const real ejj = q[ixx] + q[iyy] + q[izz];
37 q[10] = 2. * (qnc[10] + qnc[ixx] * qnc[1] + qnc[ixy] * qnc[2] + qnc[ixz] * qnc[3]) +
38 ejj * qnc[1];
39 q[11] = 2. * (qnc[11] + qnc[ixy] * qnc[1] + qnc[iyy] * qnc[2] + qnc[iyz] * qnc[3]) +
40 ejj * qnc[2];
41 q[12] = 2. * (qnc[12] + qnc[ixz] * qnc[1] + qnc[iyz] * qnc[2] + qnc[izz] * qnc[3]) +
42 ejj * qnc[3];
43}
44
45template<typename real>
46inline void InitializeIsotropic(const real density,
47 const real velocity[3],
48 const real pressure,
49 real q[13])
50{
51 // Initializes 13 conserved moments from density, velocity and pressure
52 real qnc[13] = {0};
53 // Density
54 qnc[0] = density;
55
56 // Velocity
57 qnc[1] = velocity[0];
58 qnc[2] = velocity[1];
59 qnc[3] = velocity[2];
60
61 // Pressure
62 qnc[ixx] = pressure;
63 qnc[ixy] = 0.0;
64 qnc[ixz] = 0.0;
65 qnc[iyy] = pressure;
66 qnc[iyz] = 0.0;
67 qnc[izz] = pressure;
68
69 // Heat flux
70 qnc[10] = 0.0;
71 qnc[11] = 0.0;
72 qnc[12] = 0.0;
73
74 // Convert to conserved quantities
76}
77
78} // namespace WmPearsonIVFunctions
79
80#endif // WMPEARSONIVFUNCTIONS_H
Definition: wmpearsonIVfunctions.h:5
void InitializeIsotropic(const real density, const real velocity[3], const real pressure, real q[13])
Definition: wmpearsonIVfunctions.h:46
@ izz
Definition: wmpearsonIVfunctions.h:13
@ ixy
Definition: wmpearsonIVfunctions.h:9
@ ixz
Definition: wmpearsonIVfunctions.h:10
@ iyz
Definition: wmpearsonIVfunctions.h:12
@ ixx
Definition: wmpearsonIVfunctions.h:8
@ iyy
Definition: wmpearsonIVfunctions.h:11
void PrimitiveToConserved(const real *qnc, real *q)
Definition: wmpearsonIVfunctions.h:16
#define real
Definition: wmoclunstructuredreconstruction.h:11