Peano
Loading...
Searching...
No Matches
euler_gaussian_bell.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 .scenario import Scenario
4
5import os
6import sys
7
8sys.path.insert(0, os.path.abspath("../equations"))
9from equations import Euler
10
11
13 """
14 Scenario reproduced from Ioratti, Dumbser & Loubère, https://doi.org/10.1007/s10915-020-01209-w (p. 44)
15 """
16
17 _plot_dt = 0.0
18 _offset = -0.5
19 _domain_size = 1.0
20 _periodic_bc = True
21
22 def __init__(self, iterations=2):
24 self._end_time_end_time = iterations
25 self._equation_equation = Euler(dimensions=2, gamma=1.4)
26
28 return """
29 Q[0] = 0.02*(1.0+std::exp(-0.5*tarch::la::norm2(x)*tarch::la::norm2(x)/0.01));
30
31 Q[1] = 1.0*Q[0];
32 Q[2] = 1.0*Q[0];
33
34 constexpr double gamma = 1.4;
35 constexpr double p = 1.0;
36
37 //Should lead to a constant p over the domain given the initial conditions
38 Q[3] = p/(gamma-1.0) + 0.5*(Q[1]*Q[1]+Q[2]*Q[2]) / Q[0];
39"""
40
42 return """
43 /*
44 The initial condition is transported without deformation in a periodic
45 domain [-.5, +.5], i.e. the value at a given point is the value at the
46 position x - v*t but accounting for periodicity.
47 Therefore we find the point x - v*t, and then shift this by instances
48 of 1.0 until we find the point within the domain.
49 */
50 tarch::la::Vector<Dimensions,double> pos = { (x[0] - t) + (int)(t + .5 - x[0]),
51 (x[1] - t) + (int)(t + .5 - x[1]) };
52
53 solution[0] = 0.02*(1.0+std::exp(-0.5*tarch::la::norm2(pos)*tarch::la::norm2(pos)/0.01));
54
55 solution[1] = 1.0*solution[0];
56 solution[2] = 1.0*solution[0];
57 solution[3] = 0.;
58
59 constexpr double gamma = 1.4;
60 constexpr double p = 1.0;
61
62 //Should lead to a constant p over the domain given the initial conditions
63 solution[3] = p/(gamma-1.0) + 0.5*(solution[1]*solution[1]+solution[2]*solution[2]) / solution[0];
64"""
Scenario reproduced from Ioratti, Dumbser & Loubère, https://doi.org/10.1007/s10915-020-01209-w (p.