Peano
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
3 from .equation import Equation
4 
5 
7  def __init__(self, dimensions, rho=1.0, K0=4.0):
8  self.dimensionsdimensionsdimensions = dimensions
9  self.num_unknownsnum_unknownsnum_unknowns = 3 if dimensions == 2 else 4
10  self.num_auxiliary_variablesnum_auxiliary_variablesnum_auxiliary_variables = 0
11  self.rhorho = rho
12  self.K0K0 = K0
13  self.is_linearis_linearis_linear = True
14 
15  def eigenvalues(self):
16  return (
17  """
18  const double c = std::sqrt("""
19  + str(self.K0K0)
20  + "/"
21  + str(self.rhorho)
22  + """);
23  return c;
24 """
25  )
26 
27  def flux(self):
28  return (
29  """
30  constexpr double K0 = """
31  + str(self.K0K0)
32  + """;
33  constexpr double inv_rho = 1.0 / """
34  + str(self.rhorho)
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  )
def __init__(self, dimensions, rho=1.0, K0=4.0)
Definition: acoustic.py:7
str
Definition: ccz4.py:55