CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   moving mesh bc to define the movement of the points through their coordinates (https://www.cfd-online.com/Forums/openfoam-programming-development/153983-moving-mesh-bc-define-movement-points-through-their-coordinates.html)

ALU June 8, 2015 06:11

moving mesh bc to define the movement of the points through their coordinates
 
Hi!

For a dynamic mesh I need a boundary condition where I can define the movement of every point of the patch through its point coordinates (for example the z-value).

I would like to use the codedFixedValue boundary condition, but in the code example is only shown how to make time-varying functions.

Any help is appreciated!

ALU June 15, 2015 06:13

swak4Foam
 
I'm now trying to use groovyBC to define the movement of the patch points.

Code:

    top
    {   
        type groovyBC;
        valueExpression "vector(toPoint(0),toPoint(0),pts().x)";
        value uniform (0 0 0);
    }

The points on the boundary are moving correctly as defined, but the internal field is not moving.

It works perfectly if I define the list of the points motion myself

Code:

    top
    {   
        type fixedValue;
        value nonuniform List<vector>
(
(    0    0    0    )
(    0    0    5    )
(    0    0    5    )
(    0    0    0    )
(    0    0    5    )
...
)
    }

but I would prefer either to use "codedFixedValue" or "groovyBC" for more flexibility.

ALU June 15, 2015 10:52

I finally got it working using codedFixedValue:

Code:

    top
    {
        type            codedFixedValue;
        value          uniform (0 0 0);
        redirectType    myFixedValue;  // name of generated bc

        code
        #{
            const pointPatch& p = this->patch();
            pointField p0 = p.localPoints();
            vectorField myMotion = p0;
            forAll(p0, i)
            {
                myMotion[i] = vector(0,0,1)*p0[i].x();
            }

            operator==
            (
                myMotion
            );
        #};       
    }



All times are GMT -4. The time now is 10:35.