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

error occurs when c_face_loop was used?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 11, 2005, 20:49
Default error occurs when c_face_loop was used?
  #1
Erica
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
  Reply With Quote

Old   March 11, 2005, 21:44
Default Re: error occurs when c_face_loop was used?
  #2
Melaku Habte
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
  Reply With Quote

Old   March 11, 2005, 22:33
Default Re: error occurs when c_face_loop was used?
  #3
Erica
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

  Reply With Quote

Old   March 13, 2005, 04:10
Default Re: error occurs when c_face_loop was used?
  #4
Melaku Habte
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;

} }
  Reply With Quote

Old   March 14, 2005, 08:30
Default Re: error occurs when c_face_loop was used?
  #5
Erica
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
  Reply With Quote

Old   March 14, 2005, 08:44
Default Re: error occurs when c_face_loop was used?
  #6
dirk
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
  Reply With Quote

Old   March 14, 2005, 23:36
Default Re: error occurs when c_face_loop was used?
  #7
Erica
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
  Reply With Quote

Old   March 15, 2005, 03:17
Default Re: error occurs when c_face_loop was used?
  #8
Melaku Habte
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

  Reply With Quote

Old   March 15, 2005, 03:26
Default Re: error occurs when c_face_loop was used?
  #9
Erica
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
  Reply With Quote

Old   May 30, 2011, 23:23
Default Melaku Habte udf nucleate boiling.
  #10
New Member
 
digvijay
Join Date: Feb 2011
Posts: 9
Rep Power: 15
digvijay8911@gmail.com is on a distinguished road
If anybody has udf developed by Melaku Habte for nucleate boiling then please give me. My email id is digvijay8911@gmail.com
digvijay8911@gmail.com is offline   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



All times are GMT -4. The time now is 02:19.