|
[Sponsors] |
March 11, 2005, 20:49 |
error occurs when c_face_loop was used?
|
#1 |
Guest
Posts: n/a
|
hello,everyone
when i use the Macro c_face_loop in a DEFINE_SOURCE, error occurs@non-integer subscript expression: unsigned char@ to the line of c_face_loop(c,t,n), what is this meaning? Thanks for any reply Erica |
|
March 11, 2005, 21:44 |
Re: error occurs when c_face_loop was used?
|
#2 |
Guest
Posts: n/a
|
Hi,
Could you post ur UDF or part of it. I am just gonna guess tho that you might check the variable definitions and Thread etc. Did it compiled/Interpreted sucessfully? Is this a run time error or during compilation...? rgds Melaku Habte |
|
March 11, 2005, 22:33 |
Re: error occurs when c_face_loop was used?
|
#3 |
Guest
Posts: n/a
|
#define con 1.0e20 #define m 5 DEFINE_SOURCE(x_mon, c, t, dS, eqn) {
real source; Domain *d; int id; face_t f; Thread *tf1,*tf2; int i; id=6; /* loop over all subdomains (phases) in the superdomain (mixture) */ tf1=Lookup_Thread(d,id); c_face_loop(c, t, i) { f=C_FACE(c,t,i); tf2=C_FACE_THREAD(c,t,i); if(tf1==tf2) source = con*m; /* otherwise initialize to zero */ dS[eqn]=-con; } return source; } #include "udf.h" DEFINE_PROFILE(face_T,t,i) { real xc[ND_ND]; face_t f; real y; begin_f_loop(f,t) { F_CENTROID(xc,f,t); y=xc[1]; F_PROFILE(f,t,i)=350+5000*fabs(y); } end_f_loop(f,t) } This is the whole code, thanks for help |
|
March 13, 2005, 04:10 |
Re: error occurs when c_face_loop was used?
|
#4 |
Guest
Posts: n/a
|
Hi,
As you know, Fluent's solver data can be accessed in two ways. 1) FLuent passes it to your UDF or 2) You have to ask the solver to pass it from ur UDF. In your UDF the solver is not passing the domain so i included a Get_Domain macro with 1 as the domain ID..you might check this but in Fluent it is refered to the mixture. I also didn't know why you included the C_FACE macro - may be for the profile UDF. But in anycase I managed to compile the following UDF - and it was OK. If you are interpreting it...it still gives the char error. I also put the common "if" command..to avoid any uninitialized data problem. If you like compiling rather than interpreting(i like comp) then this should work..may be some run time error show up tho. run it and lets see. I haven't found the bug why its not interpreting it tho. rgds Melaku Habte. #include "udf.h" #define con 1.0e20 #define m 5 DEFINE_SOURCE(x_mon, c, t, dS, eqn) { real source; int id ; Thread *tf1,*tf2; int n ; face_t f; Domain *d; d = Get_Domain(1); id = 6 ; if(!Data_Valid_P()) return 0.0; else { /* loop over all subdomains (phases) in the superdomain (mixture) */ tf1= Lookup_Thread(d, id ); c_face_loop(c, t, n) { f = C_FACE(c,t,n); tf2=C_FACE_THREAD(c,t,n); if(tf1== tf2) source = con*m; /* otherwise initialize to zero */ dS[eqn]=-con; } return source; } } |
|
March 14, 2005, 08:30 |
Re: error occurs when c_face_loop was used?
|
#5 |
Guest
Posts: n/a
|
Thank you very much
I use the c_face_loop only for that I just want add a source on the cells near the wall and zero for other cells I don't know why it can't work as I expected I 'll have a try under your advice! BR Erica |
|
March 14, 2005, 08:44 |
Re: error occurs when c_face_loop was used?
|
#6 |
Guest
Posts: n/a
|
Hello,
you don't have to use any loops in a DEFINE_SOURCE. This should work for you: if (C_WALL_DIST(c,t) <= ...) source=...; else source=0; Dirk |
|
March 14, 2005, 23:36 |
Re: error occurs when c_face_loop was used?
|
#7 |
Guest
Posts: n/a
|
Hi Melaku Habte
I can compile the code successfully, neither interprete. Though compiled it, it doesn't work. The old error occurs when interprete the code. I guess whether this macro need some expecial deal or not.Anyone can give some help? Thanks in advance. Erica |
|
March 15, 2005, 03:17 |
Re: error occurs when c_face_loop was used?
|
#8 |
Guest
Posts: n/a
|
Hi Erica,
If you can manage to compile then, now the problem is a run time error. Let me see thru the code again n be back. Others can comment on it. rgds Melaku habte |
|
March 15, 2005, 03:26 |
Re: error occurs when c_face_loop was used?
|
#9 |
Guest
Posts: n/a
|
Hello, Melaku Habte If you are kindful enough to help me to have a try to use the macro (C_NFACES and c_face_loop ) for any purpose, just to have a test the macros
Thank you Erica |
|
May 30, 2011, 23:23 |
Melaku Habte udf nucleate boiling.
|
#10 |
New Member
digvijay
Join Date: Feb 2011
Posts: 9
Rep Power: 15 |
If anybody has udf developed by Melaku Habte for nucleate boiling then please give me. My email id is digvijay8911@gmail.com
|
|
|
|