CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF problems (http://www.cfd-online.com/Forums/fluent/37805-udf-problems.html)

Paolo Lampitella September 6, 2005 12:44

UDF problems
 
Hi to everyone (sorry for my english) I'm having some problems with UDFs. The first is: what is a "parse error"? I already had this error for having too much variable declaration in the same row but now Fluent gives me the error for the line:

"c=a+b;" obviously i declared all the variables and defined the values for "a" and "b" so...i don't know how to proceed. The second one is about the threads: can i define, via UDF, a new cell thread specifing what are the cells that i want to put in it?

Thanks

Aykut September 6, 2005 13:09

Street Canyon msh file??
 
Hi everybody;

I am a master degree student and I have a thesis topic of "Simulation of a flow in a Street Canyon". So I am a new user of both Gambit and Fluent Softwares. My first aim is to create a 2D and then a 3D Street Canyon Geometry and to mesh it.2D seems easy but with 3D i have no clue. Soooo if any of you have a basic simple 3D street canyon model and share it with me I will be sooooo satisfied. Thanxx for your cooperation. Bye

Amir September 6, 2005 18:07

Re: UDF problems
 
it would helpful if you post your UDF here to have a look

Ahmed September 6, 2005 20:38

Re: UDF problems
 
the parser reads your c statements and converts them to the equivalent in machine language, if it is not a problem for you go again through the spelling especially the lines before this statment or if you have a C++ compiler (if you are using a UNIX or LINUX machine then it is the cc command, check your man command for details) then transfer the code and recompile it again, if there is a spelling error it will give you better error message and even the line number

Paolo Lampitella September 7, 2005 10:23

UDF problems 2
 
Thank you Amir and Ahmed for your help; i solved the problem but now i'm experiencing some other problems, take a look, please:

thread_loop_c(t,domain)

{

begin_c_loop(c,t)

{

C_CENTROID(xc,c,t);

dist=sqrt(pow((xc[0]-bar[0]),2)+pow((xc[1]-bar[1]),2)+pow((xc[2]-bar[2]),2));

if ( dist < d )

{

d=dist;

C_CENTROID(xc1,c,t);

cid=c;

}

}

end_c_loop(c,t)

}

printf("cid = %d\n", cid);

c_node_loop(cid,t,n) /*line 182*/

{

ny=NODE_Y(n);

d2=fabs(ny-bar[1]);

if (d2>d1)

{

d1=d2;

}

}

This is only the final part of my udf (too much big to post it all) but is where i have the error:

"C:\Fluent.Inc tbin tx86\cpp.exe -IC:\Fluent.Inc\fluent6.2.16/src -IC:\Fluent.Inc\fluent6.2.16/cortex/src -IC:\Fluent.Inc\fluent6.2.16/client/src -IC:\Fluent.Inc\fluent6.2.16/multiport/src -I. -DUDFCONFIG_H="<udfconfig.h>" C:\Fluent.Inc tbin tx86\profili_source.c Error: C:\Fluent.Inc\ntbin\ntx86\profili_source.c: line 182: non-integer subscript expression: unsigned char."

But if i cut the c_node_loop he recognize the value for cid and the UDF works correctly writing it on the screen... oops, i forgot to say that it is a "DEFINE_ON_DEMAND" macro (i don't know if it is important).

Thank you

Ahmed September 8, 2005 20:43

Re: UDF problems 2
 
Check the number of the closing braces "}". As I said in a previous posting, use any available C compiler to check your code, most books about the C language that I know about come with MS VC. The C language is one of the most powerful programming tools today, but you have to strictly follow its syntax. Good Luck


All times are GMT -4. The time now is 16:40.