CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   conjugateHeatFoam, grid spacing and gradient calculation (http://www.cfd-online.com/Forums/openfoam/75764-conjugateheatfoam-grid-spacing-gradient-calculation.html)

benk May 4, 2010 14:15

conjugateHeatFoam, grid spacing and gradient calculation
 
Hi all, I'm using the conjugateHeatFoam solver in 1.5-dev.

Part of my model requires that I calculate the gradient of a field. I noticed that one of my gradient values (close to the interface between two regions), is giving me something a little odd, and so I began to investigate.

It appears to me that the conjuagteHeatFoam solver changes the grid spacing close to an interface for each submesh and I think this results in the wrong calculation of the gradient of a non-coupled field on the submesh.

For example, in my test case, I have 3 regions each 0.3m in length (this is a 1D problem) split into 50 nodes each. So, the node-node grid spacing should be 0.3/50 = 0.006 and then the boundary to node grid spacing should be 0.3/50/2 = 0.003.

BUT, when I do an Info << mesh.deltaCoeffs() << endl; on each mesh I do find that the node-node spacing is 0.006 but the boundary to node grid spacing gives an unexpected result on my submeshes.

For the submeshes, I get the following (unexpected) boundary output from mesh.deltaCoeffs():

For my first submesh:
Code:

    leftWall
    {
        type            calculated;
        value          uniform 333.333;
    }
    rightWall
    {
        type            calculated;
        value          uniform 166.667;
    }
    frontAndBack
    {
        type            empty;
    }

For my second submesh:
Code:

    leftWall
    {
        type            calculated;
        value          uniform 166.667;
    }
    rightWall
    {
        type            calculated;
        value          uniform 333.333;
    }
    frontAndBack
    {
        type            empty;
    }

But for my main mesh, I get the expected output:
Code:

    leftWall
    {
        type            calculated;
        value          uniform 333.333;
    }
    rightWall
    {
        type            calculated;
        value          uniform 333.333;
    }
    frontAndBack
    {
        type            empty;
    }

Is it normal that the mesh spacing is changing from 1/333.333 = 0.003 to 1/166.667 = 0.006 at the boundaries of my submeshes? And could this be the reason for my unexpected gradient value close to the interface?

benk May 5, 2010 16:06

I was able to fix this. In the [at|de]tachPatches.H files, all meshes must be included not just the main mesh.


I believe that these files included in the conjugateHeatFoam solver example are wrong because they only consider the main mesh, not the submeshes. For the majority of cases, it won't make a difference to the solution unless you plan to evaluate the gradient (or use the grid spacing close to the boundary) of a non coupled field on a submesh.


All times are GMT -4. The time now is 01:52.