Loading [MathJax]/extensions/tex2jax.js
Tatooine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages Concepts
modified_doublegyre.h
Go to the documentation of this file.
1#ifndef TATOOINE_ANALYTICAL_SYMBOLIC_MODIFIED_DOUBLEGYRE_H
2#define TATOOINE_ANALYTICAL_SYMBOLIC_MODIFIED_DOUBLEGYRE_H
3//==============================================================================
4#include <tatooine/available_libraries.h>
5#if TATOOINE_GINAC_AVAILABLE
7//==============================================================================
9//==============================================================================
10template <typename Real>
11struct modified_doublegyre : field<Real, 2, 2> {
14 using typename parent_type::pos_type;
15 using typename parent_type::tensor_type;
16 using typename parent_type::symtensor_type;
17 using parent_type::t;
18 using parent_type::x;
19
20 static GiNaC::numeric c() { return -0.2040811331; }
21 static GiNaC::numeric d() { return 9.964223388; }
22
23 //============================================================================
25 using GiNaC::Pi;
26 GiNaC::numeric epsilon{1, 4};
27 GiNaC::numeric A{1, 10};
28 auto omega = 2 * Pi * GiNaC::numeric{1, 10};
29 auto a = epsilon * sin(omega * (t() + timeoffset()));
30 auto b = 1 - 2 * a;
31 auto f = a * x(0) * x(0) + b * x(0);
32 auto df = 2 * a * x(0) + b;
33
34 this->set_expr(vec{-Pi * A * sin(Pi * f) * cos(Pi * x(1)),
35 Pi * A * cos(Pi * f) * sin(Pi * x(1)) * df});
36 }
37
38 //----------------------------------------------------------------------------
39 static auto timeoffset() {
40 using GiNaC::Pi;
41 auto r = Pi * GiNaC::numeric{1, 5} * t() + d();
42
43 auto q = (4 * Pi * c() * sin(r) - 4 * asin(2 * c() * cos(r))) /
44 (Pi * (1 - c() * c() * sin(r) * sin(r)));
45
46 return 5 / Pi * asin(q) - t();
47 }
48 //----------------------------------------------------------------------------
49 static auto timeoffset(Real time) {
50 auto ex = timeoffset();
51 return evtod<Real>(ex, t() == time);
52 }
53
54 //----------------------------------------------------------------------------
55 constexpr bool in_domain(const pos_type& x, Real) const {
56 return x(0) >= 0 && x(0) <= 2 && x(1) >= 0 && x(1) <= 1;
57 }
58
59 //----------------------------------------------------------------------------
60 static GiNaC::ex bifurcationline() {
61 using GiNaC::Pi;
62 return c() * sin(Pi / 5 * t() + d()) + 1;
63 }
64
65 //----------------------------------------------------------------------------
66 static auto bifurcationline(Real time) {
67 auto ex = bifurcationline();
68 return evtod<Real>(ex, t() == time);
69 }
70
71 //----------------------------------------------------------------------------
72 static auto bifurcationline(const linspace<Real>& domain) {
73 auto bifu_ex = bifurcationline();
74 parameterized_line<Real, 2> curve;
75 for (auto time : domain) {
76 curve.push_back({evtod<Real>(bifu_ex, t() == time), 0}, time);
77 }
78 return curve;
79 }
80
81 //----------------------------------------------------------------------------
82 static auto bifurcationline_spacetime(const linspace<Real>& domain) {
83 auto bifu_ex = bifurcationline();
84 parameterized_line<Real, 3> curve;
85 for (auto time : domain) {
86 curve.push_back({evtod<Real>(bifu_ex, t() == time), 0, time}, time);
87 }
88 return curve;
89 }
90};
91
92//==============================================================================
94//==============================================================================
95} // namespace tatooine::analytical
96//==============================================================================
97#endif
98#endif
Definition: abcflow.h:8
static auto constexpr t
Definition: index.h:24
constexpr auto cos(arithmetic auto const x)
Definition: math.h:28
constexpr auto sin(arithmetic auto const x)
Definition: math.h:27
Definition: modified_doublegyre.h:11
static GiNaC::numeric d()
Definition: modified_doublegyre.h:21
static GiNaC::ex bifurcationline()
Definition: modified_doublegyre.h:60
static auto bifurcationline_spacetime(const linspace< Real > &domain)
Definition: modified_doublegyre.h:82
static GiNaC::numeric c()
Definition: modified_doublegyre.h:20
modified_doublegyre()
Definition: modified_doublegyre.h:24
static auto timeoffset(Real time)
Definition: modified_doublegyre.h:49
static auto bifurcationline(const linspace< Real > &domain)
Definition: modified_doublegyre.h:72
static auto timeoffset()
Definition: modified_doublegyre.h:39
constexpr bool in_domain(const pos_type &x, Real) const
Definition: modified_doublegyre.h:55
static auto bifurcationline(Real time)
Definition: modified_doublegyre.h:66
Definition: field.h:134
vec< real_type, NumDimensions > pos_type
Definition: field.h:20
Tensor tensor_type
Definition: field.h:18
Definition: linspace.h:26
tensor< GiNaC::ex, TensorDims... > symtensor_type
Definition: symbolic_field.h:22
Definition: vec.h:12
auto constexpr x() const -> auto const &requires(N >=1)
Definition: vec.h:102