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

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

internalField   uniform ( 10 0 0);

boundaryField
{
    inlet
    {
        type            codedFixedValue;
        value           uniform (0 0 0); //default value
        name            linearTBC3; //name of new BC type
        code
        #{
            const fvPatch& inletPatch = this->patch();
            
            vectorField& vf = *this; 
            forAll(vf, i)
            { 
                scalar z = inletPatch.Cf()[i].y();
                scalar uStar = 0.511;
                scalar z0 = 2.25e-4;
                scalar kappa = 0.42;
                vf[i].x() = uStar/kappa*log((z + z0)/z0);
                vf[i].y() = 0.0; 
                vf[i].z() = 0.0; 

                //scalar ur = 9.3;
                //scalar alpha = 0.16;
                //scalar zr = 0.47;
                //vf[i].x() = ur*pow(z/zr, alpha);
                //vf[i].y() = 0.0; 
                //vf[i].z() = 0.0; 
            }
        #};
    }

    top
    {
        type            slip;
    }

    bottom
    {
        type            noSlip;
    }

    outlet
    {
        type            zeroGradient;
    }

    sides
    {
        type            slip;
    }
}

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