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
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 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
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
71 return (
72 """
73 double t = 0.;
74 auto solution = Q;
75"""
77 )
Originally described in doi.org/10.1098/rspa.1937.0036, the Taylor-Green Vortex is a scenario for the...