CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (https://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   leastSquares gradient on tet meshes (https://www.cfd-online.com/Forums/openfoam-bugs/76769-leastsquares-gradient-tet-meshes.html)

deepsterblue June 3, 2010 18:21

leastSquares gradient on tet meshes
 
I've been trying out a few gradient schemes recently on tet-meshes, of which I find the leastSquares scheme to be most accurate. However, I find that the results are quite awkward at boundaries. My test case is quite simple (tet-mesh in a box - see attached), and the driver code is given:

Code:

#include "fvCFD.H"

int main(int argc, char** argv)
{
#  include "setRootCase.H"
#  include "createTime.H"
#  include "createMesh.H"

    volScalarField alpha
    (
        IOobject
        (
            "alpha",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        (mesh.C() & vector(2,3,1))
    );

    // Set values for the field
    volVectorField gradAlpha = fvc::grad(alpha);

    Info << "Writing out the gradient" << endl;

    gradAlpha.write();

    return 0;
}

I would expect grad(alpha) to be a constant vector(2,3,1), which is mostly the case at interior cells, but not so at cells the boundary. Am I doing something wrong?

Attachments:
http://www.ecs.umass.edu/~smenon/tarballs/testGrad.gz
http://www.ecs.umass.edu/~smenon/tarballs/boxTestCase.gz

Thanks in advance.

deepsterblue June 4, 2010 17:23

Well, turns out that this was a false alarm. Bug-fix in revision 1716 of OF-1.5-dev.

Apologies.


All times are GMT -4. The time now is 03:13.