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   March 3, 2005, 17:44
Default UDF help!
  #1
Bikash
Guest
 
Posts: n/a
can anyone help me with this udf.i get errors when i compile it.

#include "udf.h" #define hp 2.0

DEFINE_SOURCE (cell_source,cell,thread,dS,eqn) {

real x[ND_ND], x_coord, y_coord,r,p,source;

cell_t c;

begin_c_loop(c, thread) { C_CENTROID(x,c,thread);

x_coord = x[0];

y_coord = x[1];

p = SQR(x_coord) + SQR(y_coord); r = SQRT(p); source = hp/r; } end_c_loop(c,thread) }
  Reply With Quote

Old   March 3, 2005, 21:04
Default Re: UDF help!
  #2
Erica
Guest
 
Posts: n/a
add 'return source;' at last row
  Reply With Quote

Old   March 3, 2005, 22:20
Default Re: UDF help!
  #3
laoquange
Guest
 
Posts: n/a
Your problem is 2D or 3D?
  Reply With Quote

Old   March 4, 2005, 05:13
Default Re: UDF help!
  #4
Giordano Bruno
Guest
 
Posts: n/a
In DEFINE_SOURCE you can't use "begin_c_loop" and you must specify dS[eqn].

Good luck!!!

Giordano Bruno
  Reply With Quote

Old   March 5, 2005, 13:42
Default Re: UDF help!
  #5
Bikash
Guest
 
Posts: n/a
its a 2D problem

  Reply With Quote

Old   March 6, 2005, 01:55
Default Re: UDF help!
  #6
laoquange
Guest
 
Posts: n/a
Why did not ou try the function? face_t f thread *thread begin_f_loop(f, thread) {

}end_f_loop Good lucky
  Reply With Quote

Old   March 8, 2005, 10:26
Default Re: UDF help!
  #7
Bikash
Guest
 
Posts: n/a
i want the centroid of the cell to find the radial distance of each cell from the center of the model.

thank you
  Reply With Quote

Old   March 14, 2005, 21:39
Default Re: UDF help!
  #8
Angelo Sozzi
Guest
 
Posts: n/a
Why do you want to define it as a source then? Just use a define on demand and save the values in User Defined Memory.

You can always access the distance with over the memory then C_UDMI(c,t,0).

DEFINE_ON_DEMAND(init_UDS_distance) { Domain *d; Thread *t; cell_t c; real x[ND_ND], x_coord, y_coord,r,p,source; d = Get_Domain(1); t = Lookup_Thread(d, thread_id); /* Loop over all the cells in the given thread */

begin_c_loop (c,t)

{

C_CENTROID(x,c,t);

x_coord = x[0];

y_coord = x[1];

p = SQR(x_coord) + SQR(y_coord);

r = SQRT(p);

C_UDMI(c,t,0) = hp/r;

}

end_c_loop(c,t) }

Where does hp (hp/r) come from ?
  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 21:15.