Description
Hi everyone,
A quick question about how to set the boundary conditions. I modified the code from WaveTank.cu to simulate waves in a basin and it worked well with regular waves. Now that I want to modify the file to generate irregular waves, I find a there is a problem I can not fix.
I figure out the way to calculate the time series of the paddle stroke s(t) following previous studies and the webpage of DualSPHysics (https://github.com/DualSPHysics/DualSPHysics/wiki/3.-SPH-formulation#39-wave-generation) and write the time series into a file. The problem is that I do not know how to read the data as paddle motions in the code... If you know how to do it, please feel free to drop a reply.
PS. the potentially related lines should be as below:
%%%
// The stroke value is given at free surface level H
float stroke = 0.2;
// m_mbamplitude is the maximal angular value for paddle angle
// Paddle angle is in [-m_mbamplitude, m_mbamplitude]
paddle_amplitude = atan(stroke/(2.0*(H - paddle_origin.z)));
cout << "\npaddle_amplitude (radians): " << paddle_amplitude << "\n";
paddle_omega = 2.0M_PI/0.8; // period T = 0.8 s
%%%
void
WaveTank::moving_bodies_callback(const uint index, Object object, const double t0, const double t1,
const float3& force, const float3& torque, const KinematicData& initial_kdata,
KinematicData& kdata, double3& dx, EulerParameters& dr)
{
dx= make_double3(0.0);
kdata.lvel=make_double3(0.0f, 0.0f, 0.0f);
if (t1> paddle_tstart && t1 < paddle_tend){
kdata.avel = make_double3(0.0, paddle_amplitudepaddle_omegasin(paddle_omega*(t1-paddle_tstart)),0.0);
EulerParameters dqdt = 0.5*EulerParameters(kdata.avel)*kdata.orientation;
dr = EulerParameters::Identity() + (t1-t0)dqdtkdata.orientation.Inverse();
dr.Normalize();
kdata.orientation = kdata.orientation + (t1 - t0)*dqdt;
kdata.orientation.Normalize();
}
else {
kdata.avel = make_double3(0.0,0.0,0.0);
kdata.orientation = kdata.orientation;
dr.Identity();
}
}
All comments and suggestions welcomed!
Thanks!