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
3
from
.scenario
import
Scenario
4
5
import
os, sys
6
7
sys.path.insert(0, os.path.abspath(
"../equations"
))
8
from
equations
import
NavierStokes
9
10
import
math
11
12
13
class
NavierStokesABCFlow
(
Scenario
):
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
42
def
analytical_solution
(self):
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
71
def
initial_conditions
(self):
72
return
(
73
"""
74
double t = 0.;
75
auto solution = Q;
76
"""
77
+ self.
analytical_solution
analytical_solution
()
78
)
equations.navier_stokes.NavierStokes
Definition
navier_stokes.py:9
scenarios.navier_stokes_abc_flow.NavierStokesABCFlow
Arnold-Beltrami-Childress flow, described e.g.
Definition
navier_stokes_abc_flow.py:13
scenarios.navier_stokes_abc_flow.NavierStokesABCFlow.initial_conditions
initial_conditions(self)
Definition
navier_stokes_abc_flow.py:71
scenarios.navier_stokes_abc_flow.NavierStokesABCFlow.analytical_solution
analytical_solution(self)
Definition
navier_stokes_abc_flow.py:42
scenarios.navier_stokes_abc_flow.NavierStokesABCFlow.__init__
__init__(self)
Definition
navier_stokes_abc_flow.py:39
scenarios.scenario.Scenario
Definition
scenario.py:6
scenarios.scenario.Scenario.analytical_solution
analytical_solution(self)
Definition
scenario.py:28
tests
aderdg
scenarios
navier_stokes_abc_flow.py
Generated on Wed Apr 1 2026 00:01:45 for Peano by
1.10.0