groovyBC

1 Example with loopup tables

    inlet
    {
        type            groovyBC;
        value           ( 0 0 0 );
    lookuptables (
            {
            name timeLookup;
            outOfBounds repeat;
            file "$FOAM_CASE/constant/vel";
            }
            {
            name profileLookup;
            outOfBounds clamp;
            fileName "$FOAM_CASE/constant/profile";
            }
    );
    valueExpression "-1.0*normal()*timeLookup(time())*profileLookup(pos().y)";
    }

* Lookuptable vel

(
    (   0.00125     0.086542066     )
    (   0.0025      0.086556491     )
    (   0.00375     0.086567049     )
    (   0.005       0.086572713     )
    (   0.00625     0.086572744     )
    (   0.0075      0.086566739     )
    (   0.00875     0.086554542     )
    (   0.01        0.086536359     )
)

that is tuples with time in the first and speed in the second tuple.

2 Example for a generic cosine waveform

    INLET
    {
        type            groovyBC;
        value           uniform ( 0 0 0 );
        variables (

                //  Set x and y values for parabola
                "minX=min(pts().x);"
                "maxX=max(pts().x);"
                "minY=min(pts().y);"
                "maxY=max(pts().y);"

                //  Assume a roughly circular cross section
                "middleX=0.5*(minX+maxX);"
                "middleY=0.5*(minY+maxY);"

                //  Set the maximum (time) average (space) velocity
                "Vavg=0.65;"

                //  The velocity profile is a parabola:
                "xcor=pos().x-middleX;"
                "ycor=pos().y-middleY;"
                "radius=pow(pow(xcor,2)+pow(ycor,2),0.5);"
                "RadMax=max(radius);"
                "parabola=2.0*(1-pow((radius)/(RadMax),2));"

                //  Set velocity to zero if outside of parabola
                "profile=parabola>0.0 ? parabola : 0.0;"

                //  The temporal behaviour follows a cosine for 1/divisions of the period
                //  and goes down to Vbase for the remainder of the period
                "period=1.0;"                           // the period time in seconds
                "divisions=3.0;"                        // 3 for 1/3 pulse time, 2 for 1/2 period pulse (systole)
                "periodTime=(time()+period)%period;"    // modulo operation to convert time to time within period 0 to 1
                "PI=3.14159265;"                        // well, pi
                "Vbase=0.01;"                           // the base line velocity (diastolic phase)
                "factor=periodTime<(1.0/divisions*period) && periodTime>0 ? Vbase+(0.5*(1-cos(PI*periodTime*2.0*divisions))) : 0.0;"
                // cosine function for the first division, zero for the rest
                );
        // calculate the velocity vector profile
        valueExpression "-1.0*normal()*(Vbase+(Vavg-Vbase)*factor)*profile";
    }

3 Example for a physiological waveform based on Pedrizzetti1996

    CCA
    {
        type            groovyBC;
        value           uniform ( 0 0 0 );
        variables (

                //  Set x and y values for parabola
                "minX=min(pts().x);"
                "maxX=max(pts().x);"
                "minY=min(pts().y);"
                "maxY=max(pts().y);"

                //  Assume a roughly circular cross section
                "middleX=0.5*(minX+maxX);"
                "middleY=0.5*(minY+maxY);"

                //  The velocity profile is a parabola:
                "xcor=pos().x-middleX;"
                "ycor=pos().y-middleY;"
                "radius=pow(pow(xcor,2)+pow(ycor,2),0.5);"
                "RadMax=max(radius);"
                "parabola=2.0*(1-pow((radius)/(RadMax),2));"

                //  Set velocity to zero if outside of parabola
                "profile=parabola>0.0 ? parabola : 0.0;"

                //Average speed following Pedrizzetti1996

                //Parameters
                "C0=0.4355;"
                "C2=0.05;"
                "C4=-0.13;"
                "C6=-0.1;"
                "C8=-0.01;"

                "S2=0.25;"
                "S4=0.13;"
                "S6=-0.02;"
                "S8=-0.03;"

                "PI=3.14159265;"

                "speed=C0+C2*cos(2*PI*time())+S2*sin(2*PI*time())+C4*cos(4*PI*time())+S4*sin(4*PI*time())+C6*cos(6*PI*time())+S6*sin(6*PI*time())+C8*cos(8*PI*time())+S8*sin(8*PI*time());"
        );

            valueExpression "-1.0*normal()*speed*profile";
    }
}

Bibliography

  • [Pedrizzetti1996] Pedrizzetti, Unsteady Tube Flow over an Expansion, Journal of Fluid Mechanics, 310, 89-111 (1996). doi.

Author: Torsten Schenkel

Created: 2021-01-07 Thu 18:44