Peano
Loading...
Searching...
No Matches
navier_stokes_abc_flow.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, sys
6
7sys.path.insert(0, os.path.abspath("../equations"))
8from equations import NavierStokes
9
10import math
11
12
14 """
15 Arnold-Beltrami-Childress flow, described e.g. in doi.org/10.1016/j.jcp.2016.05.009
16 Somewhat analogous to Taylor-Green vortex, but in 3D.
17 """
18
19 _dimensions = 3
20 _offset = -math.pi
21 _domain_size = 2 * math.pi
22 _periodic_bc = True
23 _plot_dt = 0.01
24 _end_time = 0.1
25
26 _equation = NavierStokes(
27 dimensions=3,
28 use_advection=False,
29 use_background_state=False,
30 use_gravity=False,
31 use_viscosity=True,
32 gamma=1.4,
33 cv=1.0,
34 gas_constant=0.4,
35 reference_viscosity=0.01,
36 Pr=0.7,
37 )
38
39 def __init__(self):
40 return
41
43 return (
44 """
45 constexpr auto gamma = 1.4;
46 constexpr auto q0 = 0.0;
47 constexpr auto referenceViscosity = 0.01;
48
49 const auto c = 100 / gamma;
50 const auto Ft = std::exp(-1 * referenceViscosity * t);
51 const auto pressure = c -
52 (std::sin(x[1]) * std::cos(x[0]) + std::sin(x[0]) * std::cos(x[2]) +
53 std::sin(x[2]) * std::cos(x[1])) *
54 Ft * Ft;
55
56 const double rho = 1.0;
57 solution[Shortcuts::rho] = rho;
58 solution[Shortcuts::j+0] = (std::sin(x[2]) + std::cos(x[1])) * Ft;
59 solution[Shortcuts::j+1] = (std::sin(x[0]) + std::cos(x[2])) * Ft;
60 solution[Shortcuts::j+2] = (std::sin(x[1]) + std::cos(x[0])) * Ft;
61
62 auto j = &solution[Shortcuts::j];
63 auto Z = 0.0;
64 """
65 + self._equation.evaluate_energy()
66 + """
67 solution[Shortcuts::E] = E;
68"""
69 )
70
72 return (
73 """
74 double t = 0.;
75 auto solution = Q;
76"""
78 )
Arnold-Beltrami-Childress flow, described e.g.