Peano
Loading...
Searching...
No Matches
acoustic.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
3from .equation import Equation
4
5
7 def __init__(self, dimensions, rho=1.0, K0=4.0):
8 self.dimensions = dimensions
9 self.num_unknowns = 3 if dimensions == 2 else 4
11 self.rho = rho
12 self.K0 = K0
13 self.is_linear = True
14
15 def eigenvalues(self):
16 return (
17 """
18 const double c = std::sqrt("""
19 + str(self.K0)
20 + "/"
21 + str(self.rho)
22 + """);
23 return c;
24"""
25 )
26
27 def flux(self):
28 return (
29 """
30 constexpr double K0 = """
31 + str(self.K0)
32 + """;
33 constexpr double inv_rho = 1.0 / """
34 + str(self.rho)
35 + """;
36
37 F[0] = K0 * Q[normal+1];
38 F[1] = 0.0;
39 F[2] = 0.0;
40#if DIMENSIONS==3
41 F[3] = 0.0;
42#endif
43
44 F[normal+1] = inv_rho * Q[0];
45"""
46 )
__init__(self, dimensions, rho=1.0, K0=4.0)
Definition acoustic.py:7