waves: Minor fixes to wave model velocity functions

This commit is contained in:
Will Bainbridge
2018-11-28 16:32:10 +00:00
parent 49d60b8520
commit b20e55ab5b
3 changed files with 7 additions and 5 deletions

View File

@ -82,16 +82,16 @@ Foam::tmp<Foam::vector2DField> Foam::waveModels::Airy::vi
const scalarField z(xz.component(1));
const scalarField phi(angle(t, u, x));
const scalarField kz(- k()*z);
const scalarField kz(k()*z);
if (deep())
{
return i*exp(- mag(kz))*zip(cos(i*phi), sin(i*phi));
return i*exp(kz)*zip(cos(i*phi), sin(i*phi));
}
else
{
const scalar kd = k()*depth();
const scalarField kdz(max(scalar(0), kd - mag(kz)));
const scalarField kdz(max(scalar(0), kd + kz));
return i*zip(cosh(i*kdz)*cos(i*phi), sinh(i*kdz)*sin(i*phi))/sinh(kd);
}
}

View File

@ -132,7 +132,7 @@ Foam::tmp<Foam::vector2DField> Foam::waveModels::solitary::velocity
) const
{
const scalar A = alpha(t);
const scalarField Z(max(scalar(0), 1 - mag(xz.component(1)/depth())));
const scalarField Z(max(scalar(0), 1 + xz.component(1)/depth()));
const scalarField P(Pi(t, u, xz.component(0)));
return
@ -144,7 +144,7 @@ Foam::tmp<Foam::vector2DField> Foam::waveModels::solitary::velocity
(4 + 2*A - 6*A*sqr(Z))*P
+ (- 7*A + 9*A*sqr(Z))*sqr(P)
),
- A*Z*depth()*k(t)*tanh(parameter(t, u, xz.component(0)))
A*Z*depth()*k(t)*tanh(parameter(t, u, xz.component(0)))
*(
(2 + A - A*sqr(Z))*P
+ (- 7*A + 3*A*sqr(Z))*sqr(P)

View File

@ -315,6 +315,8 @@ Foam::tmp<Foam::vectorField> Foam::waveSuperposition::UGas
xyz.replace(2, height(t, p));
}
xyz.replace(2, - xyz.component(2));
return UMean(t) + (velocity(t, xyz) & axes);
}