CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF for looping over nodes in cells. (http://www.cfd-online.com/Forums/fluent/27764-udf-looping-over-nodes-cells.html)

Malcolm Wallace June 29, 2000 05:11

UDF for looping over nodes in cells.
 
I'm trying to develop an interpreted UDF (under Windows NT) that will ultimately check to see whether cells lie on a specified plane or not (so that I can then access cell centre values on that plane). However, in order to do this, I need a UDF that can access the coordinates of all nodes associated with a particular cell. The UDF included below is designed to run as a 'Chip-exec' command, but unfortunately I have problems getting it to compile. I suspect I have the same sort of problem as the C_NNODE item posted here recently. Can anyone shed some light as to why the UDF below should not compile? The error which comes up is:-

cpp -IE:\FLUENT.INC\fluent5.3/src -IE:\FLUENT.INC\fluent5.3/cortex/src -IE:\FLUENT.INC\fluent5.3/client/src -IE:\FLUENT.INC\fluent5.3/multiport/src -I. -DUDFCONFIG_H="<udfconfig.h>" e:\fluent.inc\libudf\src\cinfo3b.c Error: e:\fluent.inc\libudf\src\cinfo3b.c: line 19: non-integer subscript expression: unsigned char.

This must refer to the 'n' contained in the line 'c_node_loop(c, t, n). What do I need to do before the compiler will recognise this line? Any help will be greatly appreciated!

Malcolm W.

mwallace@nel.uk

************************************************** ************************* #include "udf.h"

extern Domain *domain; void cinfo3();

void cinfo3() {

cell_t c;

Thread *t;

Node *v;

int n;

real yvalue;

thread_loop_c(t, domain)

{

begin_c_loop_all(c, t)

{

c_node_loop(c, t, n)

{

v = CELL_NODE(c, t, n);

yvalue = NODE_Y(v);

}

}

end_c_loop(c,t)

} }

Chris June 30, 2000 09:44

Re: UDF for looping over nodes in cells.
 
You are right, it is the same problem. Change the c_node_loop(c,t,n) line to read

for(n=0;n<cell_type_nnodes[(int)C_TYPE(c,t)];++n)

Also you need to change CELL_NODE(c,t,n) to C_NODE(c,t,n).


Chris June 30, 2000 15:01

Re: UDF for looping over nodes in cells.
 
Hmm. That didn't work at all. Apparently it didn;t like the less-than symbol. Lets try again, but where it shows LT you want to use the less-than sign (the ampersand lt semicolon doesn't work either...).

You need to replace the c_node_loop(c,t,n) line with:

for (n=0; n LT cell_type_nnodes[(int)C_TYPE(c,t)]; n++)

Also you need to change CELL_NODE(c,t,n) to C_NODE(c,t,n).

Malcolm Wallace July 3, 2000 09:22

Re: UDF for looping over nodes in cells.
 
Problem solved! Thanks Chris.

Malcolm


All times are GMT -4. The time now is 01:34.