Tatooine
doublegyre3d.h
Go to the documentation of this file.
1#ifndef TATOOINE_ANALYTICAL_NUMERICAL_DOUBLEGYRE3D_H
2#define TATOOINE_ANALYTICAL_NUMERICAL_DOUBLEGYRE3D_H
3//==============================================================================
4#include <tatooine/field.h>
5//==============================================================================
7//==============================================================================
8template <floating_point Real>
9struct doublegyre3d : vectorfield<doublegyre3d<Real>, Real, 3> {
15 //============================================================================
17 real_type m_omega = 2 * M_PI / 10;
19 //============================================================================
20 virtual ~doublegyre3d() = default;
21 //============================================================================
22 auto evaluate(pos_type const& p, real_type const t) const -> tensor_type final {
23 real_type const a = m_eps * sin(m_omega * t);
24 real_type const b = 1.0 - 2.0 * a;
25 real_type const f = a * p.x() * p.x() + b * p.x();
26 return {-M_PI * m_A * std::sin(M_PI * f) * std::cos(M_PI * p.y()),
27 M_PI * m_A * std::cos(M_PI * f) * std::sin(M_PI * p.y()) *
28 (2.0 * a * p.x() + b),
29 m_omega / M_PI * p.z() * (1.0 - p.z()) *
30 (p.z() - 0.5 - m_eps * sin(2.0 * m_omega * t))};
31 }
32 //----------------------------------------------------------------------------
33 auto in_domain(pos_type const&, real_type const) const -> bool final {
34 return true;
35 }
36};
37//==============================================================================
38} // namespace tatooine::analytical::numerical
39//==============================================================================
40#endif
Definition: abcflow.h:7
constexpr auto sin(arithmetic auto const x)
Definition: math.h:27
typename parent_type::real_type real_type
Definition: doublegyre3d.h:12
real_type m_omega
Definition: doublegyre3d.h:17
typename parent_type::pos_type pos_type
Definition: doublegyre3d.h:13
real_type m_A
Definition: doublegyre3d.h:18
auto evaluate(pos_type const &p, real_type const t) const -> tensor_type final
Definition: doublegyre3d.h:22
auto in_domain(pos_type const &, real_type const) const -> bool final
Definition: doublegyre3d.h:33
typename parent_type::tensor_type tensor_type
Definition: doublegyre3d.h:14
real_type m_eps
Definition: doublegyre3d.h:16
Definition: field.h:134
Real real_type
Definition: field.h:17
vec< real_type, NumDimensions > pos_type
Definition: field.h:20
Tensor tensor_type
Definition: field.h:18