/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.4.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volVectorField;
    location    "0";
    object      Ub;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform  ( 0 0 0);

boundaryField
{
    cylinder
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }
    inlet
    {
        type            codedFixedValue;
        value           uniform (0 0 0);
        
        name    inlet;

        codeInclude
        #{
            #include "fvCFD.H"
        #};

        codeOptions
        #{
            -I$(LIB_SRC)/finiteVolume/lnInclude \
            -I$(LIB_SRC)/meshTools/lnInclude
        #};
        codeLibs
        #{
            -lfiniteVolume \
            -lmeshTools
        #};
        code
        #{
            const fvPatch& boundaryPatch = patch();
            const vectorField& Cf = boundaryPatch.Cf();
            vectorField& field = *this;
            scalar t = this->db().time().value();
            forAll(Cf, faceI)
            {
               if (Cf[faceI].y() >= -0.025)
               {
                  if (t <= 4.0)
                  {   
                     field[faceI] = (0.1 + 0.9*(t/4.0))
                                     *vector
                                      (
                                         0.04318/0.41
                                         *log(30*(Cf[faceI].y()+0.025)
                                              /9e-4),
                                         0,
                                         0
                                       );
                  }
                  else
                  {
                     field[faceI] = vector
                                    (
                                       0.04318/0.41
                                       *log(30*(Cf[faceI].y()+0.025)
                                            /9e-4),
                                       0,
                                       0
                                    );
                  }
               }
               else
               {
                  field[faceI] = vector(0,0,0);
               }
            }
        #};      
    }
    outlet
    {
        type            inletOutlet;
        inletValue      uniform (0 0 0);
        value           uniform (0 0 0);
    }
    lateralfront
    {
        type            empty;
    }
    lateralback
    {
        type            empty;
    }
    bottom    
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }
    surface
    {
        type            symmetryPlane;
    }
}


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