Peano
Loading...
Searching...
No Matches
navier_stokes_taylor_green_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
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
NavierStokesTaylorGreenVortex
(
Scenario
):
14
"""
15
Originally described in doi.org/10.1098/rspa.1937.0036, the Taylor-Green Vortex
16
is a scenario for the incompressible Navier-Stokes equations essentially describing
17
rotating segments with constant density.
18
19
As the scenario has a known analytical solution it is commonly used as a benchmark.
20
"""
21
22
_dimensions = 2
23
_offset = 0.0
24
_domain_size = 2 * math.pi
25
_periodic_bc =
True
26
_plot_dt = 1.0
27
_end_time = 10.0
28
29
_equation =
NavierStokes
(
30
dimensions=2,
31
use_advection=
False
,
32
use_background_state=
False
,
33
use_gravity=
False
,
34
use_viscosity=
True
,
35
gamma=1.4,
36
cv=1.0,
37
gas_constant=0.4,
38
reference_viscosity=0.1,
39
Pr=0.7,
40
)
41
42
def
__init__
(self):
43
return
44
45
def
analytical_solution
(self):
46
return
(
47
"""
48
constexpr auto gamma = 1.4;
49
constexpr auto q0 = 0.0;
50
constexpr auto referenceViscosity = 0.1;
51
const double Ft = std::exp(-2 * referenceViscosity * t);
52
53
const double rho = 1.0;
54
solution[Shortcuts::rho] = rho;
55
solution[Shortcuts::j+0] = std::sin(x[0]) * std::cos(x[1]) * Ft;
56
solution[Shortcuts::j+1] = -1 * std::cos(x[0]) * std::sin(x[1]) * Ft;
57
58
const double p_0 = 100. / gamma;
59
const double pressure = p_0 + ((rho * Ft * Ft) / 4) *
60
(std::cos(2 * x[0]) + std::cos(2 * x[1]));
61
auto j = &solution[Shortcuts::j];
62
auto Z = 0.0;
63
"""
64
+ self._equation.evaluate_energy()
65
+
"""
66
solution[Shortcuts::E] = E;
67
"""
68
)
69
70
def
initial_conditions
(self):
71
return
(
72
"""
73
double t = 0.;
74
auto solution = Q;
75
"""
76
+ self.
analytical_solution
analytical_solution
()
77
)
equations.navier_stokes.NavierStokes
Definition
navier_stokes.py:9
scenarios.navier_stokes_taylor_green_vortex.NavierStokesTaylorGreenVortex
Originally described in doi.org/10.1098/rspa.1937.0036, the Taylor-Green Vortex is a scenario for the...
Definition
navier_stokes_taylor_green_vortex.py:13
scenarios.navier_stokes_taylor_green_vortex.NavierStokesTaylorGreenVortex.initial_conditions
initial_conditions(self)
Definition
navier_stokes_taylor_green_vortex.py:70
scenarios.navier_stokes_taylor_green_vortex.NavierStokesTaylorGreenVortex.analytical_solution
analytical_solution(self)
Definition
navier_stokes_taylor_green_vortex.py:45
scenarios.navier_stokes_taylor_green_vortex.NavierStokesTaylorGreenVortex.__init__
__init__(self)
Definition
navier_stokes_taylor_green_vortex.py:42
scenarios.scenario.Scenario
Definition
scenario.py:6
scenarios.scenario.Scenario.analytical_solution
analytical_solution(self)
Definition
scenario.py:28
tests
aderdg
scenarios
navier_stokes_taylor_green_vortex.py
Generated on Wed Apr 1 2026 00:01:45 for Peano by
1.10.0