Peano
Loading...
Searching...
No Matches
euler_isotropic_vortex.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. 43)
15 """
16
17 _plot_dt = 0.0
18 _offset = -5.0
19 _domain_size = 10.0
20 _end_time = 10.0
21 _periodic_bc = True
22
23 def __init__(self, velocity=1.0):
25 self._equation_equation = Euler(dimensions=2, gamma=1.4)
26 self._velocity = velocity
27
29 return (
30 """
31 static constexpr double epsilon = 5.0;
32 static constexpr double pi = std::numbers::pi;
33 static constexpr double i_pi = 1./pi;
34 static constexpr double eos_gamma = 1.4;
35
36 const double r = tarch::la::norm2(x);
37 const double du = 0.5 * epsilon / pi * exp(0.5 * (1. - r * r)) * (- x[1]);
38 const double dv = 0.5 * epsilon / pi * exp(0.5 * (1. - r * r)) * (x[0]);
39 const double dTemp = -(eos_gamma - 1.) * epsilon*epsilon / 8. / eos_gamma / pi / pi *
40 exp(1. - r * r);
41 const double drho = pow(1. + dTemp, 1. / (eos_gamma - 1.)) - 1.;
42 const double dp = pow(1. + dTemp, eos_gamma / (eos_gamma - 1.)) - 1.;
43
44 constexpr double rho_inf = 1.;
45 constexpr double p_inf = 1.;
46 constexpr double u_inf = """
47 + str(self._velocity)
48 + """;
49 constexpr double v_inf = """
50 + str(self._velocity)
51 + """;
52
53 Q[0] = rho_inf + drho; // fluid density
54 Q[1] = Q[0] * (u_inf + du); // momentum
55 Q[2] = Q[0] * (v_inf + dv);
56 // total energy = internal energy + kinetic energy
57 Q[3] = (p_inf + dp) / (eos_gamma-1) + 0.5*Q[0] * ((u_inf+du)*(u_inf+du)+(v_inf+dv)*(v_inf+dv));
58"""
59 )
60
62 return (
63 """
64 /*
65 The initial condition is transported without deformation in a periodic
66 domain [-5., +5.], i.e. the value at a given point is the value at the
67 position x - v*t but accounting for periodicity.
68 Therefore we find the point x - v*t, and then shift this by instances
69 of 10.0 until we find the point within the domain.
70 */
71 constexpr double rho_inf = 1.;
72 constexpr double p_inf = 1.;
73 constexpr double u_inf = """
74 + str(self._velocity)
75 + """;
76 constexpr double v_inf = """
77 + str(self._velocity)
78 + """;
79
80 const double t_capped = t - (int) t / 10;
81 tarch::la::Vector<Dimensions,double> pos = { (x[0] - u_inf*t_capped) < -5.0 ? (x[0] - u_inf*t_capped) + 10. : (x[0] - u_inf*t_capped),
82 (x[1] - v_inf*t_capped) < -5.0 ? (x[1] - v_inf*t_capped) + 10. : (x[1] - v_inf*t_capped) };
83
84 static constexpr double epsilon = 5.0;
85 static constexpr double pi = std::numbers::pi;
86 static constexpr double i_pi = 1./pi;
87 static constexpr double eos_gamma = 1.4;
88
89 const double r = tarch::la::norm2(pos);
90 const double du = 0.5 * epsilon / pi * exp(0.5 * (1. - r * r)) * (- pos[1]);
91 const double dv = 0.5 * epsilon / pi * exp(0.5 * (1. - r * r)) * (pos[0]);
92 const double dTemp = -(eos_gamma - 1.) * epsilon*epsilon / 8. / eos_gamma / pi / pi *
93 exp(1. - r * r);
94 const double drho = pow(1. + dTemp, 1. / (eos_gamma - 1.)) - 1.;
95 const double dp = pow(1. + dTemp, eos_gamma / (eos_gamma - 1.)) - 1.;
96
97 solution[0] = rho_inf + drho; // fluid density
98 solution[1] = solution[0] * (u_inf + du); // momentum
99 solution[2] = solution[0] * (v_inf + dv);
100 // total energy = internal energy + kinetic energy
101 solution[3] = (p_inf + dp) / (eos_gamma-1) + 0.5*solution[0] * ((u_inf+du)*(u_inf+du)+(v_inf+dv)*(v_inf+dv));
102"""
103 )
Scenario reproduced from Ioratti, Dumbser & Loubère, https://doi.org/10.1007/s10915-020-01209-w (p.