Virtual Testbed
Ship dynamics simulator for extreme conditions
cosine_wave.hh
1 #ifndef VTESTBED_CORE_COSINE_WAVE_HH
2 #define VTESTBED_CORE_COSINE_WAVE_HH
3 
4 #include <vtestbed/core/linear_wave.hh>
5 
6 namespace vtb {
7 
8  namespace core {
9 
16  template <class T, int N>
17  class Propagating_cosine_wave: public Linear_wave<T,N> {
18 
19  public:
20  using typename Linear_wave<T,N>::vec;
21 
22  public:
23 
24  Propagating_cosine_wave() = default;
25  ~Propagating_cosine_wave() = default;
27  Propagating_cosine_wave& operator=(const Propagating_cosine_wave&) = default;
28 
29  inline
32 
33  inline
39 
41 
42  inline Grid<T,3>
43  acf_grid() const {
44  throw std::runtime_error("not implemented");
45  }
46 
47  };
48 
55  template <class T, int N>
56  class Standing_cosine_wave: public Linear_wave<T,N> {
57 
58  public:
59  using typename Linear_wave<T,N>::vec;
60 
61  public:
62 
63  Standing_cosine_wave() = default;
64  ~Standing_cosine_wave() = default;
66  Standing_cosine_wave& operator=(const Standing_cosine_wave&) = default;
67 
68  inline
71 
72  inline
78 
80  inline T
81  operator()(const vec& x, T t) const noexcept {
82  using blitz::dot;
83  using std::cos;
84  return this->amplitude()
85  * cos(dot(this->wave_number(), x))
86  * cos(this->angular_frequency()*t);
87  }
88 
90  T
91  velocity_potential(const vec& x, T t, T z);
92 
93  vec
94  max_velocity() const;
95 
96  Grid<T,3>
97  acf_grid() const;
98 
99  };
100 
101  }
102 
103 }
104 
105 #endif // vim:filetype=cpp
Propagating plain wave which has cosine shape.
Definition: cosine_wave.hh:17
T angular_frequency() const noexcept
Get wave angular frequency.
Definition: core/wave.hh:102
const vec & wave_number() const noexcept
Get wave numbers for each dimension.
Definition: core/wave.hh:96
vec length() const noexcept
Get wave length.
Definition: core/wave.hh:108
T direction() const noexcept
Get wave direction in radians.
Definition: core/wave.hh:120
T amplitude() const noexcept
Get wave amplitude.
Definition: core/wave.hh:90
Main namespace.
Definition: convert.hh:9
Standing plain wave which has cosine shape.
Definition: cosine_wave.hh:56
T velocity_potential(const vec &x, T t, T z)
Return velocity potential at point x.
Definition: cosine_wave.cc:6
T operator()(const vec &x, T t) const noexcept
Returns wavy surface elevation at point x.
Definition: cosine_wave.hh:81