@@ -82,6 +82,7 @@ Eigen::Vector3d GetWaterVelocity(const Eigen::Vector3d& position,
8282 water_velocity[2 ] = omega * amplitude * std::sinh (wavenumber * (z_pos + water_depth)) /
8383 std::sinh (wavenumber * water_depth) * sin (wavenumber * x_pos - omega * time + phase);
8484 }
85+
8586 return water_velocity;
8687}
8788
@@ -200,6 +201,15 @@ RegularWave::RegularWave(unsigned int num_b) {
200201}
201202
202203void RegularWave::Initialize () {
204+ wavenumber_ = ComputeWaveNumber (regular_wave_omega_, water_depth_, g_);
205+ }
206+
207+ void RegularWave::AddH5Data (std::vector<HydroData::RegularWaveInfo>& reg_h5_data,
208+ HydroData::SimulationParameters& sim_data) {
209+ wave_info_ = reg_h5_data;
210+ water_depth_ = sim_data.water_depth ;
211+ g_ = sim_data.g ;
212+
203213 // set up regular waves here, call other helper functions as necessary
204214 int total_dofs = 6 * num_bodies_;
205215 excitation_force_mag_.resize (total_dofs);
@@ -216,15 +226,6 @@ void RegularWave::Initialize() {
216226 excitation_force_phase_[body_offset + rowEx] = GetExcitationPhaseInterp (b, rowEx, 0 , freq_index_des);
217227 }
218228 }
219-
220- wavenumber_ = ComputeWaveNumber (regular_wave_omega_, water_depth_, g_);
221- }
222-
223- void RegularWave::AddH5Data (std::vector<HydroData::RegularWaveInfo>& reg_h5_data,
224- HydroData::SimulationParameters& sim_data) {
225- wave_info_ = reg_h5_data;
226- water_depth_ = sim_data.water_depth ;
227- g_ = sim_data.g ;
228229}
229230
230231Eigen::Vector3d RegularWave::GetVelocity (const Eigen::Vector3d& position, double time) {
0 commit comments