https://linen.dev logo
I spent quite a while trying out different approac...
# programming
m
I spent quite a while trying out different approaches for the parabolic inlet boundary condition, and finally found that the coded boundary condition is the right tool for this—at least in my case. Have a look:
Copy code
inlet
    {
        type            codedFixedValue;
        value           uniform (0 0 0);
        name            parabolicProfile;
        code
        #{
            const fvPatch& boundaryPatch = patch();
            vectorField& field = *this;
            scalar H = 0.41; // Total height
            scalar Umax = 1.5; // Re = 100

            forAll(field, i)
            {
                scalar y = boundaryPatch.Cf()[i].y(); // Get y-coordinate of face center
                scalar yShifted = y + 0.2;  // Shift y to start from 0
                field[i] = vector( 4 * Umax * (yShifted * (H - yShifted) / (H * H)), 0, 0);
            }
        #};
    }