/*--------------------------------*- 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       volScalarField;
    location    "0";
    object      epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform 1;

boundaryField
{
    inlet
    {
        type            codedFixedValue;
        value           uniform 0.1; //default value
        name            linearTBC; //name of new BC type
        code
        #{
            const fvPatch& inletPatch = this->patch();
            
            scalarField& vf = *this; 
            forAll(vf, i)
            { 
                scalar z = inletPatch.Cf()[i].y();

                //scalar uStar = 0.511;
                //scalar z0 = 2.25e-4;
                //scalar kappa = 0.4;
                //scalar C1 = -0.17;
                //scalar C2 = 1.62;
                //scalar Cmu = 0.42;
                //vf[i] = uStar/(z +z0)/kappa/sqrt(Cmu);

                scalar ur = 9.3;
                scalar alpha = 0.16;
                scalar Cmu = 0.028;
                scalar zr = 0.47;
                scalar u = ur*pow(z/zr, alpha);
                vf[i] = alpha*u/sqrt(Cmu)/z;
            }
        #};
    }

    top
    {
        type            zeroGradient;
    }
    

    bottom
    {
        type            omegaWallFunction;
        value           $internalField;
    }
    

    outlet
    {
        type            zeroGradient;
    }

    sides
    {
        type            zeroGradient;
    }
}


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