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

UDF help!

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 3, 2005, 16: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, 20:04
Default Re: UDF help!
  #2
Erica
Guest
 
Posts: n/a
add 'return source;' at last row
  Reply With Quote

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

Old   March 4, 2005, 04: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, 12:42
Default Re: UDF help!
  #5
Bikash
Guest
 
Posts: n/a
its a 2D problem

  Reply With Quote

Old   March 6, 2005, 00: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, 09: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, 20: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


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 07:37
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 22:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 04:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 04:01


All times are GMT -4. The time now is 06:52.