CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Question about gradient scheme

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 16, 2014, 22:07
Default Question about gradient scheme
  #1
Member
 
Tayo
Join Date: Aug 2012
Posts: 94
Rep Power: 13
tayo is on a distinguished road
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
tayo is offline   Reply With Quote

Old   January 17, 2014, 02:06
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
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?
alexeym is offline   Reply With Quote

Old   January 17, 2014, 03:58
Default
  #3
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29
akidess will become famous soon enough
Post plots of T and gradT from paraview as well.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   January 18, 2014, 11:57
Default
  #4
Member
 
Tayo
Join Date: Aug 2012
Posts: 94
Rep Power: 13
tayo is on a distinguished road
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
Attached Images
File Type: jpg Temp.jpg (23.7 KB, 11 views)
File Type: jpg grad(T).jpg (24.8 KB, 11 views)
File Type: jpg grad(T-TSat).jpg (24.1 KB, 10 views)
tayo is offline   Reply With Quote

Old   January 20, 2014, 09:12
Default
  #5
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
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.
alexeym is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
question on simulating rotating channel with a pressure gradient huangxianbei CFX 10 January 14, 2014 23:00
Crank Nicolson scheme msrinath80 OpenFOAM Running, Solving & CFD 6 November 14, 2010 13:59
Question about gamma intgerpolation scheme titio OpenFOAM Running, Solving & CFD 0 July 26, 2010 10:22
Scheme file for sinusoidal channel flow elobb FLUENT 0 November 24, 2009 10:27
Question about meshing / solution scheme of CFX Coriolius CFX 8 August 1, 2004 18:39


All times are GMT -4. The time now is 08:36.