CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   How to define nodes for a certain cell ? (https://www.cfd-online.com/Forums/fluent/27984-how-define-nodes-certain-cell.html)

mikhail October 25, 2000 11:00

How to define nodes for a certain cell ?
 
Hi !

While looping over cells in a thread I need to define coordinates of all cell nodes to provide the next calculations.All I want to do might be done by using functions NODE_X(node), NODE_Y(node), NODE_Z(node),NODE_GX(node),NODE_GY(node),NODE_GZ(n ode), but how can I get this "node" parameter for a certain cell ?

Your reply would be very convenient...

Best wishes. Mikhail

minun October 29, 2000 21:52

Re: How to define nodes for a certain cell ?
 
do you want a kind of following ones?

DEFINE_ADJUST(test_coord,domain) { cell_t c; Thread *t; Node *v; int n; real xn,yn;

thread_loop_c(t, domain){

begin_c_loop(c, t){

Message("cell %d (%d) : ",c,C_NNODES(c,t));

c_node_loop(c, t, n){

v = C_NODE(c, t, n);

xn = NODE_X(v);

yn = NODE_Y(v);

Message(" %d(%g,%g)",n,xn,yn);

}

Message("\n");

} end_c_loop(c,t) } }

Harry November 8, 2000 20:59

Re: How to define nodes for a certain cell ?
 
Hi Minun, I've try to run your program, but it doesn't work. The error seem when reach the "Message("cell %d (%d) : ",c,C_NNODES(c,t));" line with the error message (unsigned char error). Is it true??, and how to fix it?


minun November 12, 2000 20:51

Re: How to define nodes for a certain cell ?
 
If you compile the source with 'compiled udf', it should work well.

I guess you compiled it with 'interpreted udf'. Change that line to 'printf("cell %d (%d) : ",c,cell_type_nnodes[(int)C_TYPE(c,t)]);

You can find following message posted by Chris in this forum. ================================================== ===============

That is a bug. It should work OK as is for compiled UDFs.

To make it work in the interpreted UDFs, change the line:

num = C_NNODES(c,thread);

to read:

num = cell_type_nnodes[(int)C_TYPE(c,thread)];

Chris

Harry November 17, 2000 01:42

Re: How to define nodes for a certain cell ?
 
Thank you very much, and i'll try it


All times are GMT -4. The time now is 04:56.