Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set up the paddle motions for irregular waves? #63

Open
SurelyD opened this issue Mar 23, 2020 · 0 comments
Open

How to set up the paddle motions for irregular waves? #63

SurelyD opened this issue Mar 23, 2020 · 0 comments

Comments

@SurelyD
Copy link

SurelyD commented Mar 23, 2020

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant