CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

calculate temperature gradient from temperature field

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 29, 2012, 14:16
Default calculate temperature gradient from temperature field
  #1
Member
 
yu
Join Date: Nov 2010
Posts: 39
Rep Power: 15
xiyuqiu is on a distinguished road
Hello all,

I have a field of temperatures (on nodes) and would like to calculate the temperature gradient (at cell center) from them. I was able to do it for structured cubes using finite difference. However, I am having a hard time to do it for unstructured tetrahedrons. anyone has suggestion?

best
xiyuqiu is offline   Reply With Quote

Old   June 29, 2012, 20:16
Default
  #2
Member
 
Wu Jian
Join Date: Jun 2009
Location: Poitiers
Posts: 33
Rep Power: 16
harbinyg is on a distinguished road
Send a message via MSN to harbinyg
Generally, there are two methods for gradient evaluation: based on Gauss Theorem and the Least-Squares approach

for unstructured grid, i advice you use the Gauss method, which is easy to implement ....

the method is widely known and can be found in lots of textbook of CFD
harbinyg is offline   Reply With Quote

Old   July 2, 2012, 12:24
Default
  #3
Member
 
yu
Join Date: Nov 2010
Posts: 39
Rep Power: 15
xiyuqiu is on a distinguished road
Dear Wu Jian

Thank you for your reply. I will look into this.

best,

yu
xiyuqiu is offline   Reply With Quote

Old   July 25, 2012, 00:18
Default
  #4
Member
 
yu
Join Date: Nov 2010
Posts: 39
Rep Power: 15
xiyuqiu is on a distinguished road
Hello Wu Jian,

I have implemented this Gauss method you suggested. It works great for cells with significant volume. I have tried to run a case with very small cell volume(10^-13) and with same temperature on four nodes (i use tetrahedrons). As expected I got very small flux (10^-14). However, when try to get the gradient, we need to divide the flux by the volume. Therefore, I actually got a significant gradient(10^-1) when I suppose to get zero. Is there anyway I can resolve this? Thanks again for your help.

best,

yu
xiyuqiu is offline   Reply With Quote

Old   July 25, 2012, 04:53
Default
  #5
Member
 
Wu Jian
Join Date: Jun 2009
Location: Poitiers
Posts: 33
Rep Power: 16
harbinyg is on a distinguished road
Send a message via MSN to harbinyg
first of all, i am glad you are working hard to solve your problem.

before my answer, i need to know something about your implementation ...

1. what do you mean by ' significant volume' ? the grid cell with large volume ?

2. I do not care about the size of your cell but the shape ... is your cell regular or not ?

3. Generally, for Gauss method, there is a grid induced error for non-orthogonal grid .

To get high accuarcy, you have to make sue the value at the center of the surface is a good interpolation value from the values of central nodes ....

generally, you may say : phi_surface _1 = fx*phi_left + (1-fx) phi_right

then the question is , if the grid is non-orthogonal, fx is not a good interpolation factor ...

so you should improve your Gauss method, i think you can find some paper about this point ...
harbinyg is offline   Reply With Quote

Old   July 25, 2012, 14:04
Default
  #6
Member
 
yu
Join Date: Nov 2010
Posts: 39
Rep Power: 15
xiyuqiu is on a distinguished road
Thanks for your time Wu Jian,
I created a tetrahedron cell with (0,0,0) (1,0,0) (0,1,0) and (0,0,1). With the same temperature on all four points, the method work fine . When I reduced the size, the cell is now (0,0,0) (0.00001,0,0) (0,0.00001,0) and (0,0,0.00001). The answer is incorrect.
xiyuqiu is offline   Reply With Quote

Old   July 25, 2012, 17:29
Default
  #7
Senior Member
 
Join Date: Aug 2011
Posts: 272
Rep Power: 15
leflix is on a distinguished road
Hi Yu,

The proposition of Wu Jian sounds good and it's funny it doesn't work, even if I can see why.

What you may do is to use an interpolation procedure as in finite element.

T(x,y) = h1(x,y)*T1 + h2(x,y)*T2+h3(x,y)*T3

where Ti are the values at each node of a triangle and hi(x,y) are interpolation functions. for example h1(x,y) =(1/2A)*( (y3-y2)(x2-x) - (x3-x2)(y2-y) ) where xi,yi are the coordinates of node i...
you will easily find the other interpolation functions h2(x,y) and h3(x,y) in any finite element text book.
Then when you get T(x,y) you can easily derive it analytically to obtain the gradient.
leflix is offline   Reply With Quote

Old   July 25, 2012, 17:36
Default
  #8
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,764
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by leflix View Post
Hi Yu,

What you may do is to use an interpolation procedure as in finite element.

T(x,y) = h1(x,y)*T1 + h2(x,y)*T2+h3(x,y)*T3

where Ti are the values at each node of a triangle and hi(x,y) are interpolation functions. for example h1(x,y) =(1/2A)*( (y3-y2)(x2-x) - (x3-x2)(y2-y) ) where xi,yi are the coordinates of node i...
you will easily find the other interpolation functions h2(x,y) and h3(x,y) in any finite element text book.
Then when you get T(x,y) you can easily derive it to obtain the gradient.
I agree, using the shape function is very simple and you can construct also higher order shape functions by exploting suitable manipulation of the linear ones
FMDenaro is offline   Reply With Quote

Old   July 25, 2012, 17:42
Default
  #9
Senior Member
 
Join Date: Aug 2011
Posts: 272
Rep Power: 15
leflix is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
I agree, using the shape function is very simple and you can construct also higher order shape functions by exploting suitable manipulation of the linear ones
shape function that's it ! Thanx Filippo I missed the word !
leflix is offline   Reply With Quote

Old   July 25, 2012, 21:53
Default
  #10
Senior Member
 
Julien de Charentenay
Join Date: Jun 2009
Location: Australia
Posts: 231
Rep Power: 17
julien.decharentenay is on a distinguished road
Send a message via Skype™ to julien.decharentenay
Hi Yu,

The issue you are having is divide a very small number by another very small number, which give you an erroneous answer (due to machine errors).

There are a number of solution:
1 - Use a normalisation factor for your coordinate system;
2 - Maximise the machine precision (run double precision, on a 64bOS and check the compiler options).

Good luck.
Julien
__________________
---
Julien de Charentenay
julien.decharentenay is offline   Reply With Quote

Old   July 26, 2012, 12:28
Default
  #11
Member
 
yu
Join Date: Nov 2010
Posts: 39
Rep Power: 15
xiyuqiu is on a distinguished road
Thank you all for your replies. I think the interpolation will help with temperature averaging on each face. However, my problem is even when the temperatures are the same (i.e. no problem with averaging) I got incorrect temperature gradient. I will try what Julien suggested. Thank you to all again for your help.

best,

yu
xiyuqiu is offline   Reply With Quote

Old   July 26, 2012, 23:54
Default
  #12
Super Moderator
 
Praveen. C
Join Date: Mar 2009
Location: Bangalore
Posts: 342
Blog Entries: 6
Rep Power: 18
praveen is on a distinguished road
Division is a stable operation. You probably have problem with addition/subtraction. If you are computing determinant, you need to be careful. Check that your cell volume is correct. Write the gradient formula in terms of differences of state variables. You should then get zero gradient for a constant data.
praveen is offline   Reply With Quote

Old   July 27, 2012, 15:57
Default
  #13
Member
 
yu
Join Date: Nov 2010
Posts: 39
Rep Power: 15
xiyuqiu is on a distinguished road
I think you are right, praveen. It seems when I sum the flux, I should have zero, but instead I got 10^-10, but my volume is in the order of 10^-10. Therefore, I am getting some non-zero gradient. Would you provide a little more details on "write the gradient formula in terms of differences of stat variables"? I am not sure what it is. Thanks!
xiyuqiu is offline   Reply With Quote

Old   July 27, 2012, 22:15
Default
  #14
Super Moderator
 
Praveen. C
Join Date: Mar 2009
Location: Bangalore
Posts: 342
Blog Entries: 6
Rep Power: 18
praveen is on a distinguished road
Write your gradient on a tetrahedron as

\nabla T  = \vec{a}_1 T_1 + \vec{a}_2 T_2 + \vec{a}_3 T_3 + \vec{a}_4 T_4

The coefficients should sum to zero

\vec{a}_1 + \vec{a}_2 + \vec{a}_3 + \vec{a}_4 = 0

If they dont then try to fix it. Its a round off problem, look at how you compute the coefficients and fix the round off issues.

Since the coefficients should sum to zero, you can also write


\nabla T  = \vec{a}_2 (T_2 -T_1) + \vec{a}_3 (T_3 -T_1) + \vec{a}_4 (T_4 -T_1)

This gives zero gradients for constant data. You can use this, but first eliminate roundoff errors also.
praveen is offline   Reply With Quote

Old   July 30, 2012, 14:38
Default
  #15
Member
 
yu
Join Date: Nov 2010
Posts: 39
Rep Power: 15
xiyuqiu is on a distinguished road
Thank you Praveen! This is pretty much what I have. My coefficients do not add up to zero. I will try to fix the round off problem. Thanks again for your genuine help.
xiyuqiu 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
Field Function relating to temperature. Please Help kj878 STAR-CCM+ 12 February 8, 2012 16:13
Temperature Gradient at Wall sven OpenFOAM 7 November 1, 2010 17:25
problem with temperature field in modeling evaporation with fluent MOhaj FLUENT 0 April 24, 2010 23:54
calculate the temperature gradient on a profile arther FLUENT 0 April 19, 2006 23:12
Question on Face Temperature Gradient Tomasz Didenko FLUENT 1 June 27, 2003 04:30


All times are GMT -4. The time now is 00:40.