Virtual Testbed
Ship dynamics simulator for extreme conditions
wave_pressure.hh
1 #ifndef VTESTBED_CORE_WAVE_PRESSURE_HH
2 #define VTESTBED_CORE_WAVE_PRESSURE_HH
3 
4 #include <vtestbed/core/grid.hh>
5 #include <vtestbed/core/math.hh>
6 #include <vtestbed/core/policy.hh>
7 #include <vtestbed/core/ship_hull_panel.hh>
8 #include <vtestbed/core/types.hh>
9 
10 namespace vtb {
11 
12  namespace core {
13 
22  template <class T>
24 
25  public:
28  using grid3 = Grid<T,3>;
29  using grid4 = Grid<T,4>;
30  using array3 = Array<T,3>;
31  using array4 = Array<T,4>;
32  using vec3 = Vector3<T>;
33 
34  private:
36  T _density{1030};
38  T _g{base::constants<T>::g()};
39  bool _clip = true;
40 
41  public:
42 
43  virtual ~Wave_pressure_solver() = default;
44 
80  virtual void
81  solve(
82  const Grid<T,3>& wavy_surface_grid,
83  Array<T,3> wavy_surface,
84  const Grid<T,4>& velocity_potential_grid,
85  Array<T,4> velocity_potential,
86  panel_array& panels
87  ) = 0;
88 
90  inline T density() const noexcept { return this->_density; }
91  inline void density(T rhs) noexcept { this->_density = rhs; }
93  inline T g() const noexcept { return this->_g; }
94  inline void g(T rhs) noexcept { this->_g = rhs; }
95  inline void clip(bool b) { this->_clip = b; }
97  inline bool clip() const { return this->_clip; }
98 
99  };
100 
101  template <class T, Policy P>
103  make_wave_pressure_solver();
104 
105  }
106 
107 }
108 
109 #endif // vim:filetype=cpp
static constexpr const T g()
Gravitational acceleration.
Definition: constants.hh:15
T g() const noexcept
Gravitational acceleration.
Base class for all wave pressure solvers.
Triangular ship hull panel (face).
Main namespace.
Definition: convert.hh:9
bool clip() const
Clamp grid to panels?
virtual void solve(const Grid< T, 3 > &wavy_surface_grid, Array< T, 3 > wavy_surface, const Grid< T, 4 > &velocity_potential_grid, Array< T, 4 > velocity_potential, panel_array &panels)=0
Compute pressure force applied to the centre of each ship hull panel.
T density() const noexcept
Fluid density.