|
[Sponsors] |
March 3, 2005, 16:44 |
UDF help!
|
#1 |
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) } |
|
March 3, 2005, 20:04 |
Re: UDF help!
|
#2 |
Guest
Posts: n/a
|
add 'return source;' at last row
|
|
March 3, 2005, 21:20 |
Re: UDF help!
|
#3 |
Guest
Posts: n/a
|
Your problem is 2D or 3D?
|
|
March 4, 2005, 04:13 |
Re: UDF help!
|
#4 |
Guest
Posts: n/a
|
In DEFINE_SOURCE you can't use "begin_c_loop" and you must specify dS[eqn].
Good luck!!! Giordano Bruno |
|
March 5, 2005, 12:42 |
Re: UDF help!
|
#5 |
Guest
Posts: n/a
|
its a 2D problem
|
|
March 6, 2005, 00:55 |
Re: UDF help!
|
#6 |
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 |
|
March 8, 2005, 09:26 |
Re: UDF help!
|
#7 |
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 |
|
March 14, 2005, 20:39 |
Re: UDF help!
|
#8 |
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 ? |
|
|
|
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 |