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

udf help.....

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 11, 2008, 10:13
Default udf help.....
  #1
Ken
Guest
 
Posts: n/a
hi everyone, i was trying to write an equation into udf but what i got is line 1 parse error... i am new to fluent and the udf thing, so here is my equation,

u=170 * (1 + tanh((25-y)/2.25))

and the udf i worte is based on the tutorial file i found in fluent.... here is the udf i wrote...

DEFINE_PROFILE(mass_flow_velocity,thread,index)

{

real x[ND_ND];

real y;

face_t f;

begin_f_loop(f,thread)

{

F_CENTROID(x,f,thread);

y = x[1];

F_PROFILE(f,thread,index) = 170.*(1.+tanh((25.-y)/2.25));

}

end_f_loop(f,thread)

}

can anyone correct it for me??

thanks alot...
  Reply With Quote

Old   January 11, 2008, 11:10
Default Re: udf help.....
  #2
al_c
Guest
 
Posts: n/a
At the beginning of every UDF you write must be

#include "udf.h"

  Reply With Quote

Old   January 11, 2008, 11:15
Default Re: udf help.....
  #3
Ken
Guest
 
Posts: n/a
thanks for the advise~~

but it still comes out with the 'line 1: parse error'...

would it be something wrong with my udf itself?...wrong command or so..?
  Reply With Quote

Old   January 11, 2008, 12:24
Default Re: udf help.....
  #4
al_c
Guest
 
Posts: n/a
I think, your udf is correct, only #include "udf.h" is missing. What operator do you have at line 1 after you add #include 'udf.h'? Do you use interpreted or compiled UDF?

  Reply With Quote

Old   January 11, 2008, 13:58
Default Re: udf help.....
  #5
Ken Lau
Guest
 
Posts: n/a
what do you mean by operator?

i actually havent got anything after line 1, just as it is in my shown udf...

i used interpreted udf~~
  Reply With Quote

Old   January 11, 2008, 15:27
Default Re: udf help.....
  #6
al_c
Guest
 
Posts: n/a
Here is the corrected udf - first line is #include "udf.h" :

#include "udf.h"

DEFINE_PROFILE(mass_flow_velocity,thread,index)

{

real x[ND_ND];

real y;

face_t f;

begin_f_loop(f,thread)

{

F_CENTROID(x,f,thread);

y = x[1];

F_PROFILE(f,thread,index) = 170.*(1.+tanh((25.-y)/2.25));

}

end_f_loop(f,thread)

}
  Reply With Quote

Old   January 11, 2008, 16:13
Default Re: udf help.....
  #7
Ken Lau
Guest
 
Posts: n/a
thanks alot, finally it works!!!!

thank you for your help^^
  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 04:59.