3from .scenario
import Scenario
8sys.path.insert(0, os.path.abspath(
"../equations"))
9from equations
import Euler
14 Scenario reproduced from Ioratti, Dumbser & Loubère, https://doi.org/10.1007/s10915-020-01209-w (p. 43)
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;
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 *
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.;
44 constexpr double rho_inf = 1.;
45 constexpr double p_inf = 1.;
46 constexpr double u_inf = """
49 constexpr double v_inf = """
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));
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.
71 constexpr double rho_inf = 1.;
72 constexpr double p_inf = 1.;
73 constexpr double u_inf = """
76 constexpr double v_inf = """
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) };
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;
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 *
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.;
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));
Scenario reproduced from Ioratti, Dumbser & Loubère, https://doi.org/10.1007/s10915-020-01209-w (p.
__init__(self, velocity=1.0)
analytical_solution(self)