Tatooine
abcflow.h
Go to the documentation of this file.
1#ifndef TATOOINE_ANALYTICAL_NUMERICAL_ABCFLOW_H
2#define TATOOINE_ANALYTICAL_NUMERICAL_ABCFLOW_H
3//==============================================================================
4#include <cmath>
5#include <tatooine/field.h>
6//==============================================================================
8//==============================================================================
12template <typename real_type>
13struct abcflow : vectorfield<abcflow<real_type>, real_type, 3> {
16 using typename parent_type::pos_type;
17 using typename parent_type::tensor_type;
18
19 //============================================================================
20 private:
22
23 //============================================================================
24 public:
25 explicit constexpr abcflow(real_type const a = 1, real_type const b = 1,
26 real_type const c = 1)
27 : m_a{a}, m_b{b}, m_c{c} {}
28 constexpr abcflow(const abcflow& other) = default;
29 constexpr abcflow(abcflow&& other) = default;
30 constexpr abcflow& operator=(const abcflow& other) = default;
31 constexpr abcflow& operator=(abcflow&& other) = default;
32 ~abcflow() override = default;
33
34 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
35 [[nodiscard]] constexpr auto evaluate(pos_type const& x,
36 real_type const /*t*/) const -> tensor_type {
37 return {m_a * gcem::sin(x(2)) + m_c * gcem::cos(x(1)),
38 m_b * gcem::sin(x(0)) + m_a * gcem::cos(x(2)),
39 m_c * gcem::sin(x(1)) + m_b * gcem::cos(x(0))};
40 }
41 [[nodiscard]] constexpr auto in_domain(pos_type const& /*x*/,
42 real_type const /*t*/) const -> bool {
43 return true;
44 }
45};
46
47abcflow()->abcflow<double>;
48
49//==============================================================================
50} // namespace tatooine::analytical::numerical
51//==============================================================================
52
53#if TATOOINE_GINAC_AVAILABLE
54#include "symbolic_field.h"
55//==============================================================================
56namespace tatooine::symbolic {
57//==============================================================================
61template <typename real_type>
62struct abcflow : field<real_type, 3, 3> {
65 using typename parent_type::pos_type;
66 using typename parent_type::tensor_type;
67 using typename parent_type::symtensor_type;
68
69 //============================================================================
70 public:
71 explicit constexpr abcflow(const real_type a = 1, const real_type b = 1,
72 const real_type c = 1) {
73 this->set_expr(vec{a * sin(symbol::x(2)) + c * cos(symbol::x(1)),
74 b * sin(symbol::x(0)) + a * cos(symbol::x(2)),
75 c * sin(symbol::x(1)) + b * cos(symbol::x(0))});
76 }
77 constexpr abcflow(const abcflow& other) = default;
78 constexpr abcflow(abcflow&& other) = default;
79 constexpr abcflow& operator=(const abcflow& other) = default;
80 constexpr abcflow& operator=(abcflow&& other) = default;
81 ~abcflow() override = default;
82};
83
84abcflow()->abcflow<double>;
85
86//==============================================================================
87} // namespace tatooine::symbolic
88//==============================================================================
89#endif
90#endif
Definition: abcflow.h:7
Definition: symbolic.h:8
constexpr auto cos(arithmetic auto const x)
Definition: math.h:28
constexpr auto sin(arithmetic auto const x)
Definition: math.h:27
The Arnold–Beltrami–Childress (ABC) flow is a three-dimensional incompressible velocity field which i...
Definition: abcflow.h:13
constexpr abcflow & operator=(abcflow &&other)=default
real_type m_c
Definition: abcflow.h:21
real_type m_a
Definition: abcflow.h:21
constexpr abcflow & operator=(const abcflow &other)=default
real_type m_b
Definition: abcflow.h:21
constexpr abcflow(const abcflow &other)=default
constexpr auto in_domain(pos_type const &, real_type const) const -> bool
Definition: abcflow.h:41
constexpr abcflow(real_type const a=1, real_type const b=1, real_type const c=1)
Definition: abcflow.h:25
constexpr abcflow(abcflow &&other)=default
constexpr auto evaluate(pos_type const &x, real_type const) const -> tensor_type
Definition: abcflow.h:35
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
The Arnold–Beltrami–Childress (ABC) flow is a three-dimensional incompressible velocity field which i...
Definition: abcflow.h:62
constexpr abcflow(const abcflow &other)=default
constexpr abcflow & operator=(abcflow &&other)=default
~abcflow() override=default
constexpr abcflow & operator=(const abcflow &other)=default
constexpr abcflow(abcflow &&other)=default
constexpr abcflow(const real_type a=1, const real_type b=1, const real_type c=1)
Definition: abcflow.h:71
Definition: symbolic_field.h:16
void set_expr(const symtensor_type &ex)
Definition: symbolic_field.h:31
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