CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Question about gradient scheme (https://www.cfd-online.com/Forums/openfoam/128617-question-about-gradient-scheme.html)

tayo January 16, 2014 22:07

Question about gradient scheme
 
Hello,
I'm puzzled about the way openfoam computes the gradient scheme. I have a temperature field, T that varies between 358 - 400K and I simply take the gradient using fvc::grad(T), with Gauss linear scheme. With a mesh size is approx. 0.3 mm, some of the results for the gradient are printed below:

Code:

const volScalarField& T = alpha1_.db().lookupObject<volScalarField>("T");
volVectorField gradT = fvc::grad(T);
Info << "gradT =" << gradT << endl;
(-164633 -164633 0)
(0 -164633 0)
(0 -164633 -2.98156e-10)
(0 -164633 -2.98156e-10)
(0 0 2.98156e-10)
(0 0 1.49078e-10)
(164633 -164633 0)
(0 0 0)
(0 0 0)
(164633 0 0)
(0 0 0)
 :  :  :
 :  :  :

Some of my basic questions are:
1.) Why does it print out negative numbers?
2.) How does it get gradient values of (0 0 0) when the T values vary between 358 - 400K.
3.) Why is the z- gradient values so low (2.98156e-10) considering the small mesh size?
Kindly help explain what's happening here. Thanks

alexeym January 17, 2014 02:06

Quite usual questions:

1. What type of BCs do you use?
2. Can you post checkMesh output?
3. Can you post your fvSchemes?
4. Can you post your case files?

akidess January 17, 2014 03:58

Post plots of T and gradT from paraview as well.

tayo January 18, 2014 11:57

3 Attachment(s)
Thanks for the response. Below is my boundary condition
Temp.: fixedGradient on wall, fixedValue inlet, zeroGradient outlet
Pressure: zeroGradient inlet and wall, fixedValue outlet
Velocity: no slip wall, fixedValue inlet, zeroGradient outlet

Here is my fvScheme:
Code:

ddtSchemes
{
    default        Euler;
}
gradSchemes
{
    default        Gauss linear;
}
gradSchemes
{
    default        Gauss linear;
}
divSchemes
{
    div(rho*phi,U)  Gauss limitedLinearV 1;
    div(phi,T)  Gauss upwind;
    div(phi,p_rgh)  Gauss upwind;
    div(phi,alpha)  Gauss vanLeer01;
    div(phirb,alpha) Gauss interfaceCompression;
: : :
}

The checkMesh also seems ok:
Code:

Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:          93636
    faces:            267729
    internal faces:  254991
    cells:            87120
    boundary patches: 3
    point zones:      0
    face zones:      0
    cell zones:      1

Overall number of cells of each type:
    hexahedra:    87120
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:    0

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces ...
    Patch              Faces    Points  Surface topology                 
    inlet              2640    2754    ok (non-closed singly connected) 
    outlet              2640    2754    ok (non-closed singly connected) 
    heatWall            7458    7684    ok (non-closed singly connected) 

Checking geometry...
    Overall domain bounding box (0 0 0) (0.02 0.01 0.01)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (3.88444e-16 1.23164e-16 -3.56799e-15) OK.
    Max cell openness = 8.82326e-17 OK.
    Max aspect ratio = 1.33333 OK.
    Minumum face area = 7.5e-08. Maximum face area = 1.0101e-07.  Face area magnitudes OK.
    Min volume = 2.27273e-11. Max volume = 2.52525e-11.  Total volume = 2e-06.  Cell volumes OK.
    Mesh non-orthogonality Max: 0 average: 0
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 0.000109995 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

Time = 0.0005

Mesh stats
    points:          95614
    faces:            272670
    internal faces:  259779
    cells:            88618
    boundary patches: 3
    point zones:      0
    face zones:      0
    cell zones:      1

Overall number of cells of each type:
    hexahedra:    88339
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:    279

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces ...
    Patch              Faces    Points  Surface topology                 
    inlet              2640    2754    ok (non-closed singly connected) 
    outlet              2640    2754    ok (non-closed singly connected) 
    heatWall            7611    7859    ok (non-closed singly connected) 

Checking geometry...
    Overall domain bounding box (0 0 0) (0.02 0.01 0.01)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (-4.07224e-16 3.9387e-17 -3.50976e-15) OK.
    Max cell openness = 1.76465e-16 OK.
    Max aspect ratio = 1.33336 OK.
    Minumum face area = 4.6875e-09. Maximum face area = 1.01015e-07.  Face area magnitudes OK.
    Min volume = 3.55078e-13. Max volume = 2.52538e-11.  Total volume = 2e-06.  Cell volumes OK.
    Mesh non-orthogonality Max: 29.6211 average: 1.53168
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 0.334633 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

The issue seems to be with the gradScheme. It gives fairly the same result when for fvc::grad(T) and fvc::grad(T-TSat) where TSat is a dimensionedScalar at 371K while T is a volScalarField defined in previous post.
Code:

volScalarField gradT = mag(fvc::grad(T));
volScalarField gradTt = mag(fvc::grad(T-TSat));
Info << min(gradT) << max(gradT) << min(gradTt) << max(gradTt) << endl;

Checking the min. & max. values for mag(grad(T)) and mag(grad(T-TSat) shows that they are exactly the same. This is clearly wrong but I don't understand why. However, when I compute these values by postprocessing with funkySetField, I get more reasonable result as shown in the plots. So my question is this: why are these two grad(T-TSat) results significantly different? How do I best define grad(T-TSat) to give the expected result? Thanks

alexeym January 20, 2014 09:12

Hi,

Concerning grad(T) and grad(T - Tsat), as Tsat is constant, grad(Tsat) = 0 and grad(T) = grad(T - Tsat).

From you graphs I can see the areas of constant temperature, so in these areas grad(T) will be 0.

And finally negative numbers - we need to continue guessing what are the real initial and boundary conditions.


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