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

UDF for stream function and heatlines

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By guilbemloco
  • 1 Post By Rahul123
  • 1 Post By chandan100

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 3, 2013, 12:23
Question UDF for stream function and heatlines
  #1
New Member
 
gui
Join Date: Oct 2013
Posts: 10
Rep Power: 13
guilbemloco is on a distinguished road
Hello friends

My problem is a 2-D closed cavity with horizontal temperature gradient.
I'm working on a UDF that returns to me the value of stream function and it's profile as well, so far I have partially succeded on this task, because near the walls the profile and values for the stream funtion are not correct (the velocity and stream function should be zero, but I can't get zero because I'm getting the values for the velocities in the center of the cell), besides that, the values and profiles for the rest of the cavity is correct.

Does anybody know how can I get the correct values for the velocities on the walls?

The equation for stream lines is known as psi = psi(i,j-1) + integral(U*dy)
Here's my UDF for the stream funtion:
#include "udf.h"
DEFINE_ON_DEMAND(stream_lines_mem1)
{
Domain *d;
Thread *t;
cell_t c;
real psi=0.;
real vxdy;
real NV_VEC(n);
real NV_VEC(veloc);
real k;
d=Get_Domain(1);

thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
NV_D(veloc,=,C_U(c,t),C_V(c,t));
NV_D(n,=,0.003333,0.0);
vxdy=NV_DOT(n,veloc);
k=C_K_L(c,t);
psi+=vxdy/k;
C_UDMI(c,t,1)=-psi;
}
end_c_loop(c,t)
}
}

The second UDF i'm working on returns the value of the heatlines and it's profile, this UDF is a little more complicated because it considers an inicial value for a control volume (on the bottom for example), and the values for the other volumes is obtained from a integration, in this case, in the vertical direction, the process should be repeated for the next cells until the end of the domain.

The equation for heat lines is known as dH/dy = rho*cp*U*(T-Tref) - k*dT/dx

Does anybody know how can I do this intregration in one direction and consider a different initial value for every control volume on the bottom?

Here's my UDF for heat lines:
#include "udf.h"
DEFINE_ON_DEMAND(heat_lines_mem0)
{
Domain *d;
Thread *t;
cell_t c;
real rho;
real u;
real T;
real k;
real dTdx;
real dTdy;
real H=0.0;
real term1;
real term2;
real Trho;
real aux1;
real aux2;
real dy;
real grad;
real veloc;
d=Get_Domain(1);

thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
if (NULL != THREAD_STORAGE(t,SV_T_G))
{
k=C_K_L(c,t);
T=C_T(c,t);
rho=C_R(c,t);
Trho=T*rho;
veloc=(Trho*C_U(c,t)/k);
grad=(k*C_T_G(c,t)[0]);
dy=0.003333;
aux1=dy*veloc;
aux2=dy*grad;
H+=aux1-aux2;

C_UDMI(c,t,0)=H;
}

else
{
C_UDMI(c,t,0)=0.;
}
}
end_c_loop(c,t)
}
}
newki likes this.
guilbemloco is offline   Reply With Quote

Old   February 13, 2014, 13:01
Default
  #2
Member
 
Satish Gupta
Join Date: Jun 2012
Posts: 30
Rep Power: 14
Rahul123 is on a distinguished road
hey,
I am also trying to get the heatlines in a cavity problem.....were you able to do it...if so do let me know..for steamlines you can export the stream function to tecplot and get the plots very easily
newki likes this.
Rahul123 is offline   Reply With Quote

Old   August 7, 2020, 11:30
Default
  #3
New Member
 
Chandan
Join Date: Aug 2020
Posts: 1
Rep Power: 0
chandan100 is on a distinguished road
Has anyone done the heatlines?
newki likes this.
chandan100 is offline   Reply With Quote

Reply

Tags
heat stream lines udf


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



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