1 #ifndef VTESTBED_CORE_GERSTNER_HH 2 #define VTESTBED_CORE_GERSTNER_HH 6 #include <vtestbed/core/linear_wave.hh> 7 #include <vtestbed/core/policy.hh> 8 #include <vtestbed/core/ship.hh> 9 #include <vtestbed/core/ship_hull_panel.hh> 10 #include <vtestbed/core/types.hh> 11 #include <vtestbed/core/wave.hh> 12 #include <vtestbed/core/wavy_surface_generator.hh> 13 #include <vtestbed/geometry/types.hh> 30 template <
class T,
int N>
34 using scalar_type = T;
35 using vertex_type = blitz::TinyVector<T,N>;
36 using vertex_field_3d = Array<vertex_type,3>;
37 using scalar_field_3d = Array<T,3>;
50 vertex_field_3d _velocity;
51 scalar_field_3d _potential;
52 grid3 _velocity_grid_zxy;
55 bool _diffraction =
false;
56 bool _radiation =
false;
57 bool _waterline_only =
true;
63 inline T
depth()
const {
return this->_depth; }
64 inline void depth(T rhs) { this->_depth = rhs; }
66 inline const wave_array& waves()
const {
return this->_waves; }
67 inline void waves(wave_array&& rhs) { this->_waves = std::move(rhs); }
68 inline void waves(
const wave_array& rhs) { this->_waves = rhs; }
72 inline bool diffraction()
const {
return this->_diffraction; }
73 inline void diffraction(
bool rhs) { this->_diffraction = rhs; }
77 inline bool radiation()
const {
return this->_radiation; }
78 inline void radiation(
bool rhs) { this->_radiation = rhs; }
83 inline void waterline_only(
bool rhs) { this->_waterline_only = rhs; }
86 inline bool clip()
const {
return this->_clip; }
87 inline void clip(
bool rhs) { this->_clip = rhs; }
99 const panel_array& panels,
100 const grid3& grid_txy,
101 vertex_field_3d& surface
114 const grid4& grid_tzxy,
115 panel_array & wetted_panels
118 inline const vertex_field_3d& velocity()
const {
return this->_velocity; }
119 inline const scalar_field_3d& potential()
const {
return this->_potential; }
120 inline const grid3& velocity_grid()
const {
return this->_velocity_grid_zxy; }
122 Gerstner_solver() =
default;
123 virtual ~Gerstner_solver() =
default;
124 Gerstner_solver(
const Gerstner_solver&) =
default;
125 Gerstner_solver& operator=(
const Gerstner_solver&) =
default;
126 Gerstner_solver(Gerstner_solver&&) =
default;
127 Gerstner_solver& operator=(Gerstner_solver&&) =
default;
131 template <
class T,
int N, Policy P>
133 make_gerstner_solver();
135 template <
class T,
int N>
137 make_gerstner_solver(Policy policy);
142 #endif // vim:filetype=cpp T depth() const
Water depth.
Trochoidal irrotational waves solves named after Gerstner.
Rigid ship with a mass and translational and angular velocity.
virtual void compute_positions(const ship_type &ship, const panel_array &panels, const grid3 &grid_txy, vertex_field_3d &surface)=0
Fluid motion without diffraction/radiation.
A region defined by start and end index and lower and upper bound for each dimension.
Triangular ship hull panel (face).
bool radiation() const
Calculate radiation forces?
bool waterline_only() const
Calculate radiation/diffraction using waterline only?
bool diffraction() const
Calculate diffraction forces?
bool clip() const
Clamp grid to panels?
virtual void compute_forces(const ship_type &ship, const grid4 &grid_tzxy, panel_array &wetted_panels)=0
Compute Froude—Krylov force acting on each panel.