CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Temperature gradient macro

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 10, 2017, 14:05
Default Temperature gradient macro
  #1
Member
 
sebastian bergman
Join Date: Mar 2017
Location: seattle
Posts: 52
Rep Power: 9
Tushar_Telmasre is on a distinguished road
I wanted to calculate temperature gradient. It can be obtained by macro C_T_G(c,t). I wrote a simple udf to save the Gradient magnitude in UDM.

include "udf.h"

DEFINE_EXECUTE_AT_END(temp_gradient)
{
Domain *d;

Thread *t;

cell_t c;

d = Get_Domain(1);

thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_UDMI(c,t,0) = (C_T_G(c,t)[0]);

C_UDMI(c,t,1) = (C_T(c,t)-C_T(c-1,t))/0.00025;
}
end_c_loop(c,t)
}

}

But I do not know the gradient value is correct. The regions where temperature is constant should have zero gradient value but in result there is some finite value. Attached herewith the images. Can someone take a look at them and comment?

Thanking you in anticipation.
Attached Images
File Type: jpg temperature.jpg (137.3 KB, 66 views)
File Type: jpg temperature gradient.jpg (132.5 KB, 61 views)
Tushar_Telmasre is offline   Reply With Quote

Old   May 10, 2017, 14:26
Default
  #2
New Member
 
Swapnil Chavanda
Join Date: Jan 2017
Location: Pune
Posts: 19
Rep Power: 9
swpnl9282@gmail.com is on a distinguished road
Hello Tushar_Telmasre
You use command define on DEFINE_ON_DEMAND
First define Temperature gradient by real value
Define definition
Temperature_gradient=C_T_G(c,t)
C_UDMI(c,t,1)=C_T_G(c,t)

Sent from my Moto G (4) using CFD Online Forum mobile app
swpnl9282@gmail.com is offline   Reply With Quote

Old   May 10, 2017, 14:28
Default
  #3
New Member
 
Swapnil Chavanda
Join Date: Jan 2017
Location: Pune
Posts: 19
Rep Power: 9
swpnl9282@gmail.com is on a distinguished road
I am facing the same

Sent from my Moto G (4) using CFD Online Forum mobile app
swpnl9282@gmail.com is offline   Reply With Quote

Old   May 10, 2017, 14:29
Default
  #4
New Member
 
Swapnil Chavanda
Join Date: Jan 2017
Location: Pune
Posts: 19
Rep Power: 9
swpnl9282@gmail.com is on a distinguished road
If you have any idea rather than this please send me

Sent from my Moto G (4) using CFD Online Forum mobile app
swpnl9282@gmail.com is offline   Reply With Quote

Old   May 11, 2017, 06:54
Default
  #5
Member
 
sebastian bergman
Join Date: Mar 2017
Location: seattle
Posts: 52
Rep Power: 9
Tushar_Telmasre is on a distinguished road
hi swapnil,
I use EXECUTE_AT_END macro so that solver automatically calculates the gradient value at the end of the time step.

Further I formulated a similar problem in comsol and calculated the gradient.
As expected the gradient value was zero where there was no change in temperature.

now I am thinking about calculating the gradient value myself using C_T(c,t) macro but for gradient I would need the values OF TEMPERATURE at surrounding nodes and I don't know how to do that.

have you any idea?
Tushar_Telmasre 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
Boussinesq approximation (temperature gradient range) azizi0407 FLUENT 3 December 11, 2023 13:05
Temperature gradient macros on face qwerty753 Fluent UDF and Scheme Programming 6 July 31, 2016 12:13
temperature gradient for use in surface monitor Catherine FLUENT 1 August 24, 2012 10:10
Temperature gradient macro ameyadurve FLUENT 0 October 3, 2009 09:46
Direct calculation of temperature gradient J.W.Ryu FLUENT 5 December 27, 2001 07:39


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