
[Sponsors] 
July 8, 2010, 10:00 
Udf

#1 
New Member
Denis Palienko
Join Date: Jul 2010
Posts: 12
Rep Power: 8 
hello,
try my first udf. i need a linear profile along a tube in a heatexchanger for the teperature of the wall. the functione is: T(z) = T(0)  20 * z / 618 T(z) = Walltemperature subject to the control variable z T(0) = Walltemperature at the beginning (here 343.15K) z = control variable 618 mm = Tube legth I wrote this function for the problem: #include "udf.h" DEFINE_PROFILE(temperature_profile,t,i) { real x[ND_ND]; real z; face_t f; begin_f_loop(f,t) { F_CENTROID(x,f,t); z = x[3]; F_PROFILE(f,t,i) = 343.15  20*z/618; } end_f_loop(f,t) My question is, will it work? I try to test it, but could not find out if it works. Is the main function DEFINE_PROFILE the right choise for this problem? thx for your help 

July 8, 2010, 10:15 

#2 
Senior Member
Jouke de Baar
Join Date: Oct 2009
Posts: 125
Rep Power: 9 
Hi, this is almost correct. However, I think you should follow the definition where:
x = x[0] y = x[1] z = x[2] (which is the one you want) I think x[3] is undefined. Hope this helps! 

July 8, 2010, 12:07 

#3 
New Member
Denis Palienko
Join Date: Jul 2010
Posts: 12
Rep Power: 8 
try to do what you told:
#include "udf.h" DEFINE_PROFILE(temperature_profile,t,i) { real x[ND_ND]; real z; face_t f; begin_f_loop(f,t) { F_CENTROID(x,f,t); x = x[0]; y = x[1]; z = x[2]; F_PROFILE(f,t,i) = 343.15  20*z/618; } end_f_loop(f,t) } but i get this error: temperature_profile.c:incompatible types in allocation temperature_profile.c:12: Error: >>y<< is not declared...... if i declare y like that: real x[ND_ND]; real y; real z; i get the same error: temperature_profile.c: Error: incompatible types in allocation. what now? 

July 8, 2010, 12:15 

#4 
New Member
Denis Palienko
Join Date: Jul 2010
Posts: 12
Rep Power: 8 
by the way why fluent tell allways:
warning: File`udf_names.c` has modification time 0,13s in teh future....??? and Warning: no newline at the end of data file...???? 

July 8, 2010, 12:16 

#5 
Senior Member
Jouke de Baar
Join Date: Oct 2009
Posts: 125
Rep Power: 9 
Sorry for confusing, I meant to say: in you original udf replace the line
z = x[3]; with the line z = x[2]; I think that should work. So: DEFINE_PROFILE(temperature_profile,t,i) { real x[ND_ND]; real z; face_t f; begin_f_loop(f,t) { F_CENTROID(x,f,t); z = x[2]; F_PROFILE(f,t,i) = 343.15  20*z/618; } end_f_loop(f,t) } Good luck! 

July 8, 2010, 12:57 

#6 
New Member
Denis Palienko
Join Date: Jul 2010
Posts: 12
Rep Power: 8 
the solution is not really what i expected:
if i let me show the contours(Temperature) of the tube after the itaration, i expect a profile like i wrote it in my function. But i see: at the begin a temperature gradient from 301K to 343K for a short distance, after it the temperature is constant and at the end the same gradient but mirrored. I got two flows on both sides of the tube, and both entered the exchanger with the temperature value of 283.K 

July 8, 2010, 12:58 

#7 
New Member
Denis Palienko
Join Date: Jul 2010
Posts: 12
Rep Power: 8 
thx for your help jack1980


July 8, 2010, 14:26 

#8 
Senior Member
Jouke de Baar
Join Date: Oct 2009
Posts: 125
Rep Power: 9 
Sorry I don't know how to improve this. Hope you can find a way ...
Good luck 

July 8, 2010, 14:44 

#9 
New Member
Denis Palienko
Join Date: Jul 2010
Posts: 12
Rep Power: 8 
i think i got it...have to change the function:
F_PROFILE(f,t,i) = 343.15  20.0*z/0.618 sounds silly, just because of the dot but it works thx 

July 8, 2010, 14:47 

#10 
Senior Member
Jouke de Baar
Join Date: Oct 2009
Posts: 125
Rep Power: 9 
Ah yes that is it. Great that you found it!


September 23, 2010, 03:47 
what is the Difference with UDF Fluent 4 and fluent 6 versions

#11 
Member
Join Date: Sep 2010
Posts: 51
Rep Power: 8 
I want to know how to use the mesh in version 6 of fluent, because in the UDF version 4 we call the lattice L = I + NI ((J1) + NJ (K1)). . For example in version 4 if I want to inject a source term in the mesh 10 20 mesh and I do:
IF (L.EQ.10) THEN ATERMES = 150 ELSE FI (L.EQ.20) THEN ATERMES = 250 ENDIF but on version 6 I do not know how to do that?? Thanks for you 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
UDF parallel error: chipexec: function not found?????  shankara.2  Fluent UDF and Scheme Programming  1  January 16, 2012 23:14 
How to add a UDF to a compiled UDF library  kim  FLUENT  3  October 26, 2011 21:38 
Dynamic Mesh UDF  Qureshi  FLUENT  1  December 2, 2009 01:27 
UDF...UDF...UDF...UDF  Luc SEMINEL  FLUENT  0  November 25, 2002 05:03 
UDF, UDF, UDF, UDF  Luc SEMINEL  Main CFD Forum  0  November 25, 2002 05:01 