Tatooine
doublegyre.h
Go to the documentation of this file.
1#ifndef TATOOINE_ANALYTICAL_SYMBOLIC_DOUBLEGYRE_H
2#define TATOOINE_ANALYTICAL_SYMBOLIC_DOUBLEGYRE_H
3//==============================================================================
4#include <tatooine/available_libraries.h>
5#if TATOOINE_GINAC_AVAILABLE
7//==============================================================================
9//==============================================================================
10template <typename Real>
11struct doublegyre : vectorfield<doublegyre<Real>, Real, 2> {
14 using parent_type::t;
15 using parent_type::x;
16 using typename parent_type::pos_type;
17 using typename parent_type::symtensor_type;
18 using typename parent_type::tensor_type;
19
20 explicit doublegyre(const GiNaC::ex& eps = GiNaC::numeric{1, 4},
21 const GiNaC::ex& omega = 2 * GiNaC::Pi *
22 GiNaC::numeric{1, 10},
23 const GiNaC::ex& A = GiNaC::numeric{1, 10}) {
24 using GiNaC::Pi;
25 auto a = eps * sin(omega * t());
26 auto b = 1 - 2 * a;
27 auto f = a * pow(x(0), 2) + b * x(0);
28 this->set_expr(vec<GiNaC::ex, 2>{
29 -Pi * A * sin(Pi * f) * cos(Pi * x(1)),
30 Pi * A * cos(Pi * f) * sin(Pi * x(1)) * f.diff(x(0))});
31 }
32
33 //----------------------------------------------------------------------------
34 constexpr auto in_domain(const pos_type& x, Real) const -> bool {
35 return x(0) >= 0 && x(0) <= 2 && x(1) >= 0 && x(1) <= 1;
36 }
37};
39//==============================================================================
40} // namespace tatooine::analytical::symbolic
41//==============================================================================
42namespace tatooine {
43//==============================================================================
44template <typename Real>
45struct is_field<symbolic::doublegyre<Real>> : std::true_type {};
46//==============================================================================
47} // namespace tatooine
48//==============================================================================
49#endif
50#endif
Definition: field.h:231
Definition: abcflow.h:8
static auto constexpr t
Definition: index.h:24
Definition: algorithm.h:6
constexpr auto cos(arithmetic auto const x)
Definition: math.h:28
constexpr auto pow(arithmetic auto const x)
Definition: math.h:30
constexpr auto sin(arithmetic auto const x)
Definition: math.h:27
constexpr auto in_domain(const pos_type &x, Real) const -> bool
Definition: doublegyre.h:34
doublegyre(const GiNaC::ex &eps=GiNaC::numeric{1, 4}, const GiNaC::ex &omega=2 *GiNaC::Pi *GiNaC::numeric{1, 10}, const GiNaC::ex &A=GiNaC::numeric{1, 10})
Definition: doublegyre.h:20
Definition: field.h:134
vec< real_type, NumDimensions > pos_type
Definition: field.h:20
Tensor tensor_type
Definition: field.h:18
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