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

Udf

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 8, 2010, 10:00
Default Udf
  #1
New Member
 
Denis Palienko
Join Date: Jul 2010
Posts: 12
Rep Power: 7
fabolous is on a distinguished road
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
fabolous is offline   Reply With Quote

Old   July 8, 2010, 10:15
Default
  #2
Senior Member
 
Jouke de Baar
Join Date: Oct 2009
Posts: 122
Rep Power: 7
jack1980 is on a distinguished road
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!
jack1980 is offline   Reply With Quote

Old   July 8, 2010, 12:07
Default
  #3
New Member
 
Denis Palienko
Join Date: Jul 2010
Posts: 12
Rep Power: 7
fabolous is on a distinguished road
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?
fabolous is offline   Reply With Quote

Old   July 8, 2010, 12:15
Default
  #4
New Member
 
Denis Palienko
Join Date: Jul 2010
Posts: 12
Rep Power: 7
fabolous is on a distinguished road
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...????
fabolous is offline   Reply With Quote

Old   July 8, 2010, 12:16
Default
  #5
Senior Member
 
Jouke de Baar
Join Date: Oct 2009
Posts: 122
Rep Power: 7
jack1980 is on a distinguished road
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!
jack1980 is offline   Reply With Quote

Old   July 8, 2010, 12:57
Default
  #6
New Member
 
Denis Palienko
Join Date: Jul 2010
Posts: 12
Rep Power: 7
fabolous is on a distinguished road
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
fabolous is offline   Reply With Quote

Old   July 8, 2010, 12:58
Default
  #7
New Member
 
Denis Palienko
Join Date: Jul 2010
Posts: 12
Rep Power: 7
fabolous is on a distinguished road
thx for your help jack1980
fabolous is offline   Reply With Quote

Old   July 8, 2010, 14:26
Default
  #8
Senior Member
 
Jouke de Baar
Join Date: Oct 2009
Posts: 122
Rep Power: 7
jack1980 is on a distinguished road
Sorry I don't know how to improve this. Hope you can find a way ...

Good luck
jack1980 is offline   Reply With Quote

Old   July 8, 2010, 14:44
Default
  #9
New Member
 
Denis Palienko
Join Date: Jul 2010
Posts: 12
Rep Power: 7
fabolous is on a distinguished road
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
fabolous is offline   Reply With Quote

Old   July 8, 2010, 14:47
Default
  #10
Senior Member
 
Jouke de Baar
Join Date: Oct 2009
Posts: 122
Rep Power: 7
jack1980 is on a distinguished road
Ah yes that is it. Great that you found it!
jack1980 is offline   Reply With Quote

Old   September 23, 2010, 03:47
Default what is the Difference with UDF Fluent 4 and fluent 6 versions
  #11
Member
 
Join Date: Sep 2010
Posts: 51
Rep Power: 6
stage81 is on a distinguished road
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 ((J-1) + NJ (K-1)). . 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
stage81 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF parallel error: chip-exec: 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


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