Peano
Loading...
Searching...
No Matches
euler.py
Go to the documentation of this file.
1
# This file is part of the ExaHyPE2 project. For conditions of distribution and
2
# use, please see the copyright notice at www.peano-framework.org
3
from
.equation
import
Equation
4
5
6
class
Euler
(
Equation
):
7
def
__init__
(self, dimensions, gamma=1.4):
8
self.
dimensions
= dimensions
9
self.
num_unknowns
= 4
if
dimensions == 2
else
5
10
self.
num_auxiliary_variables
= 0
11
self.
gamma
= gamma
12
13
def
eigenvalues
(self):
14
return
(
15
"""
16
const double irho = 1.0 / Q[0];
17
constexpr double Gamma = """
18
+ str(self.
gamma
)
19
+
""";
20
const double p = (Gamma - 1.0) * (Q[4] - 0.5 * irho * (Q[1]*Q[1]+Q[2]*Q[2]+Q[3]*Q[3]));
21
22
const double c = std::sqrt(Gamma * p * irho);
23
const double u = Q[normal + 1] * irho;
24
25
return std::fmax(std::abs(u-c), std::abs(u+c));
26
"""
27
if
self.
dimensions
== 3
28
else
"""
29
const double irho = 1.0 / Q[0];
30
constexpr double Gamma = """
31
+ str(self.
gamma
)
32
+
""";
33
const double p = (Gamma - 1.0) * (Q[3] - 0.5 * irho * (Q[1]*Q[1]+Q[2]*Q[2]));
34
35
const double c = std::sqrt(Gamma * p * irho);
36
const double u = Q[normal + 1] * irho;
37
38
return std::fmax(std::abs(u-c), std::abs(u+c));
39
"""
40
)
41
42
def
flux
(self):
43
return
(
44
"""
45
const double irho = 1.0 / Q[0];
46
constexpr double Gamma = """
47
+ str(self.
gamma
)
48
+
""";
49
const double p = (Gamma - 1.0) * (Q[4] - 0.5 * irho * (Q[1]*Q[1]+Q[2]*Q[2]+Q[3]*Q[3]));
50
51
F[0] = Q[normal + 1];
52
F[1] = Q[normal + 1] * Q[1] * irho;
53
F[2] = Q[normal + 1] * Q[2] * irho;
54
F[3] = Q[normal + 1] * Q[3] * irho;
55
F[4] = Q[normal + 1] * irho * (Q[4] + p);
56
57
F[normal + 1] += p;
58
"""
59
if
self.
dimensions
== 3
60
else
"""
61
const double irho = 1.0 / Q[0];
62
constexpr double Gamma = """
63
+ str(self.
gamma
)
64
+
""";
65
const double p = (Gamma - 1.0) * (Q[3] - 0.5 * irho * (Q[1]*Q[1]+Q[2]*Q[2]));
66
67
F[0] = Q[normal + 1];
68
F[1] = Q[normal + 1] * Q[1] * irho;
69
F[2] = Q[normal + 1] * Q[2] * irho;
70
F[3] = Q[normal + 1] * irho * (Q[3] + p);
71
72
F[normal + 1] += p;
73
"""
74
)
equations.equation.Equation
Definition
equation.py:6
equations.equation.Equation.num_auxiliary_variables
int num_auxiliary_variables
Definition
equation.py:9
equations.equation.Equation.flux
flux()
Definition
equation.py:17
equations.equation.Equation.dimensions
int dimensions
Definition
equation.py:7
equations.equation.Equation.num_unknowns
int num_unknowns
Definition
equation.py:8
equations.equation.Equation.eigenvalues
eigenvalues()
Definition
equation.py:13
equations.euler.Euler
Definition
euler.py:6
equations.euler.Euler.gamma
gamma
Definition
euler.py:11
equations.euler.Euler.__init__
__init__(self, dimensions, gamma=1.4)
Definition
euler.py:7
tests
exahype2
aderdg
equations
euler.py
Generated on
for Peano by
1.14.0