
[Sponsors] 
January 16, 2014, 23:07 
Question about gradient scheme

#1 
Member
Tayo
Join Date: Aug 2012
Posts: 94
Rep Power: 6 
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.98156e10) (0 164633 2.98156e10) (0 0 2.98156e10) (0 0 1.49078e10) (164633 164633 0) (0 0 0) (0 0 0) (164633 0 0) (0 0 0) : : : : : : 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.98156e10) considering the small mesh size? Kindly help explain what's happening here. Thanks 

January 17, 2014, 03:06 

#2 
Senior Member

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? 

January 17, 2014, 04:58 

#3 
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,236
Rep Power: 23 
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. 

January 18, 2014, 12:57 

#4 
Member
Tayo
Join Date: Aug 2012
Posts: 94
Rep Power: 6 
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; : : : } 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 (nonclosed singly connected) outlet 2640 2754 ok (nonclosed singly connected) heatWall 7458 7684 ok (nonclosed singly connected) Checking geometry... Overall domain bounding box (0 0 0) (0.02 0.01 0.01) Mesh (nonempty, nonwedge) directions (1 1 1) Mesh (nonempty) directions (1 1 1) Boundary openness (3.88444e16 1.23164e16 3.56799e15) OK. Max cell openness = 8.82326e17 OK. Max aspect ratio = 1.33333 OK. Minumum face area = 7.5e08. Maximum face area = 1.0101e07. Face area magnitudes OK. Min volume = 2.27273e11. Max volume = 2.52525e11. Total volume = 2e06. Cell volumes OK. Mesh nonorthogonality Max: 0 average: 0 Nonorthogonality 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 (nonclosed singly connected) outlet 2640 2754 ok (nonclosed singly connected) heatWall 7611 7859 ok (nonclosed singly connected) Checking geometry... Overall domain bounding box (0 0 0) (0.02 0.01 0.01) Mesh (nonempty, nonwedge) directions (1 1 1) Mesh (nonempty) directions (1 1 1) Boundary openness (4.07224e16 3.9387e17 3.50976e15) OK. Max cell openness = 1.76465e16 OK. Max aspect ratio = 1.33336 OK. Minumum face area = 4.6875e09. Maximum face area = 1.01015e07. Face area magnitudes OK. Min volume = 3.55078e13. Max volume = 2.52538e11. Total volume = 2e06. Cell volumes OK. Mesh nonorthogonality Max: 29.6211 average: 1.53168 Nonorthogonality check OK. Face pyramids OK. Max skewness = 0.334633 OK. Coupled point location match (average 0) OK. Mesh OK. Code:
volScalarField gradT = mag(fvc::grad(T)); volScalarField gradTt = mag(fvc::grad(TTSat)); Info << min(gradT) << max(gradT) << min(gradTt) << max(gradTt) << endl; 

January 20, 2014, 10:12 

#5 
Senior Member

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. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
question on simulating rotating channel with a pressure gradient  huangxianbei  CFX  10  January 15, 2014 00:00 
Crank Nicolson scheme  msrinath80  OpenFOAM Running, Solving & CFD  6  November 14, 2010 14: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 11:27 
Question about meshing / solution scheme of CFX  Coriolius  CFX  8  August 1, 2004 18:39 