Exemplo n.º 1
0
Foam::tmp<Foam::vectorField> Foam::waveSuperposition::velocity
(
    const scalar t,
    const vectorField& xyz
) const
{
    vectorField result(xyz.size(), vector::zero);

    forAll(waveModels_, wavei)
    {
        const vector2D d(cos(waveAngles_[wavei]), sin(waveAngles_[wavei]));
        const vector2DField xz
        (
            zip
            (
                d & zip(xyz.component(0), xyz.component(1)),
                tmp<scalarField>(xyz.component(2))
            )
        );
        const vector2DField uw
        (
            waveModels_[wavei].velocity(t, xz)
        );
        result += zip
        (
            d.x()*uw.component(0),
            d.y()*uw.component(0),
            uw.component(1)
        );
    }

    tmp<scalarField> s = scale(zip(xyz.component(0), xyz.component(1)));

    return s*result;
}
Exemplo n.º 2
0
Foam::tmp<Foam::vector2DField> Foam::waveModels::solitary::velocity
(
    const scalar t,
    const scalar u,
    const vector2DField& xz
) const
{
    const scalar A = alpha(t);
    const scalarField Z(max(scalar(0), 1 - mag(xz.component(1)/depth())));
    const scalarField P(Pi(t, u, xz.component(0)));

    return
        celerity(t)
       *zip
        (
            A/4
           *(
                (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)))
           *(
                (2 + A - A*sqr(Z))*P
              + (- 7*A + 3*A*sqr(Z))*sqr(P)
            )
        );
}
Exemplo n.º 3
0
Foam::tmp<Foam::scalarField> Foam::waveSuperposition::scale
(
    const vector2DField& xy
) const
{
    tmp<scalarField> tResult(new scalarField(xy.size(), 1));
    scalarField& result = tResult.ref();

    if (scale_.valid())
    {
        const scalarField x(xy.component(0));
        forAll(result, i)
        {
            result[i] *= scale_->value(x[i]);
        }
    }