/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    movingWall
    {
        type            codedFixedValue;
        value           uniform (1 0 0);
        name            variedLid;
        code
        #{
            const fvPatch& boundaryPatch = patch();
            const vectorField& Cf = boundaryPatch.Cf();
            vectorField& field = *this;

            dimensionedScalar boxSide
            (
                "boxSide",
                dimLength,
                this->db().lookupObject<IOdictionary>("transportProperties")
            );

            dimensionedScalar boxVel
            (
                "boxVel",
                dimVelocity,
                this->db().lookupObject<IOdictionary>("transportProperties")
            );


            forAll(Cf, faceI)
            {
                const scalar x = Cf[faceI].x()/boxSide.value();
                const scalar bValue = 16.0*boxVel.value()
                  * (sqr(x) - 2.0*pow(x,3.0) + pow(x,4.0));
                field[faceI] = vector(bValue,0,0);
            }
        #};
    }

    fixedWalls
    {
        type            noSlip;
    }

    frontAndBack
    {
        type            empty;
    }
}

// ************************************************************************* //
