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 macros on face

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 9, 2010, 04:54
Default Temperature gradient macros on face
  #1
New Member
 
qwerty753
Join Date: May 2009
Posts: 16
Rep Power: 17
qwerty753 is on a distinguished road
How to obtain a temperature gradient directly from the solver for the UDF purposes? Does any macro exist to compute temperature gradient on a face?
my aim i to extract heat flux on a face!
Thank you
qwerty753 is offline   Reply With Quote

Old   March 9, 2010, 00:54
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by qwerty753 View Post
How to obtain a temperature gradient directly from the solver for the UDF purposes? Does any macro exist to compute temperature gradient on a face?
my aim i to extract heat flux on a face!
Thank you
If your face is a wall boundary, then use WALL_HEAT_FLUX(face_t f,Thread*tf) to directly report the heat flux
gearboy is offline   Reply With Quote

Old   March 11, 2010, 08:35
Default
  #3
New Member
 
qwerty753
Join Date: May 2009
Posts: 16
Rep Power: 17
qwerty753 is on a distinguished road
Thanks, but i don't need of a heat flux, i want to know dt/dn i.e. gradient.
Bye.
qwerty753 is offline   Reply With Quote

Old   March 12, 2010, 01:08
Default
  #4
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by qwerty753 View Post
How to obtain a temperature gradient directly from the solver for the UDF purposes? Does any macro exist to compute temperature gradient on a face?
my aim i to extract heat flux on a face!
Thank you
You can define a UDS. loop over all the cells and let its UDS value equal to the temperature gradient , C_UDSI(c,t,0)=C_T_G(c,t).
Then use the UDS gradient on cell, distance vector to compute the temperature gradient on face.

#include "udf.h"
DEFINE_ON_DEMAND(test)
{
face_t f;
cell_t c0;
Thread *tf,*t0;
Domain*domain=Get_Domain(1);
real NV_VEC(dist_vector);
real f_centoid[ND_ND],c_centroid[ND_ND];
real face_value,cell_value;
thread_loop_f(tf, domain)/* loops over all face threads in a domain*/
{
begin_f_loop(f, tf) /* loops over faces in a face thread */
{
F_CENTROID(f_centoid,f,tf); //centroid of a face
c0=F_C0(f,tf);
t0=THREAD_T0(tf);
C_CENTROID(c_centroid,c0,t0); //centroid of the neighbour cell
NV_DD(dist_vector,=,f_centoid[0],f_centoid[1],0,-,c_centroid[0],c_centroid[1],0);
face_value=C_UDSI(c0,t0,0)+NV_DOT(C_UDSI_G(c0,t0,0 ),dist_vector);
cell_value=C_UDSI(c0,t0,0);
Message0("x coord.=%g,face value=%g,cell value=%g\n",f_centoid[0],face_value,cell_value);
}
end_f_loop(f, f_thread)
}
}
gearboy is offline   Reply With Quote

Old   June 16, 2010, 04:38
Default convective boundary condition
  #5
New Member
 
askask
Join Date: Jun 2010
Posts: 1
Rep Power: 0
kayihana is on a distinguished road
after writing a similar face gradient, i have to give a mass convection boundary condition with the face and air, but i couldn't manage to put the cell (for air) and face (for solid face) together. can you help me?
kayihana is offline   Reply With Quote

Old   March 12, 2013, 08:20
Default
  #6
Member
 
Satish Gupta
Join Date: Jun 2012
Posts: 30
Rep Power: 14
Rahul123 is on a distinguished road
I am solving a 2D problem. I want to calculate temperature gradient (and also write it) on the surface(line) whose end points I know. Can anyone tell me how to do it
Thank you
Rahul123 is offline   Reply With Quote

Old   July 31, 2016, 12:13
Default udf for temperature gradient
  #7
New Member
 
saad
Join Date: May 2012
Posts: 6
Rep Power: 14
s.m.saad jamil is on a distinguished road
I want x and y component of temperature gradient, please tell me how can i be able to get it.
i have done solve/set/expert to retain various gradients.
but when i am try to run the simulation fatal error occurs.
I am writing my code below.

#include "udf.h"
DEFINE_ADJUST(my_adjust,domain)
{
Thread*t;
cell_t c;
real vol_tot, tavg;
tavg=0.;
vol_tot=0.;
domain=Get_Domain(1);
thread_loop_c(t,domain)
{
begin_c_loop(c,t)
{
vol_tot += C_VOLUME(c,t);
tavg += (C_T(c,t)*C_VOLUME(c,t));
end_c_loop(c,t)
}
tavg= tavg/vol_tot;
printf("Volume integral of temperature:%g\n", tavg);
}
thread_loop_c(t,domain)
{
begin_c_loop(c,t)
{
C_UDMI(c,t,0)=tavg;
C_UDSI(c,t,0)= C_T_G(c,t)[0];
}
end_c_loop(c,t)
}
}
DEFINE_SOURCE(mom_source,c,t,dS,eqn)
{
real x[ND_ND];
real source;
C_CENTROID(x,c,t);
source= 1.0+5.33*(C_T(c,t)-C_UDMI(c,t,0));
dS[eqn]= 0.0;
return source;
}
s.m.saad jamil 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
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 06:50
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 08:36
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15


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