CFD Online Logo CFD Online URL
Home > Forums > FLUENT

C_NNODES UDF 'function' problem

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   June 21, 2000, 03:55
Default C_NNODES UDF 'function' problem
Matthew Brannock
Posts: n/a
With a view of patching values at a set position into a cell I need to check that they are exactly bounded by the cell nodes. First I need to see how many nodes there are (by using C_NNODES 'function') so I can use the NODE_X, ... function to find the position of the nodes. Hence I've run into problems at step 1 (see the code below) where I'm trying to use C_NNODES, with the following error resulting at trying to compile the interpreted UDF:

cpp -Ie:\\fluent5.2/src -Ie:\\fluent5.2/cortex/src -Ie:\\fluent5.2/client/src -Ie:\\fluent5.2/multiport/src -I. -DUDFCONFIG_H="<udfconfig.h>" e: est.c

Error: e:\test.c: line 23: non-integer subscript expression: unsigned char.

I've supplied the test code below, where am I going wrong?

I think problems will develop for me when using the NODE_X function because I don't know where the heck the 'node' pointer is going to be passed from, I just want to see how to use C_NNODES first.

PS: Please keep in mind I'm quite a novice when it comes to using C.

/************************************************** *********************/

/* interpreted UDF for patching values at initialisation */

/************************************************** *********************/

#include "udf.h"

DEFINE_INIT(my_init_function, domain) { cell_t c; Thread *thread; real xc[ND_ND];

thread_loop_c (thread,domain)


begin_c_loop_all (c,thread)



if (sqrt(ND_SUM(pow(xc[0] - 0.5,2.),

pow(xc[1] - 0.5,2.),

pow(xc[2] - 0.5,2.))) < 1.7) { /* checks whether inside spherical test region of interest - just to check if c and thread work in other functions (here C_CENTROID) and to limit number of points to print out in GUI */

int num;

num = C_NNODES(c,thread);

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

C_U(c,thread) = 1.;



C_U(c,thread) = 0.;


end_c_loop_all (c,thread)

} }

  Reply With Quote

Old   June 21, 2000, 10:16
Default Re: C_NNODES UDF 'function' problem
Posts: n/a
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)];

  Reply With Quote

Old   June 21, 2000, 22:46
Default Re: C_NNODES UDF 'function' problem
Matthew Brannock
Posts: n/a
Excellent, thankyou!
  Reply With Quote


Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM static build on Cray XT5 asaijo OpenFOAM Installation 9 April 6, 2011 12:21
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 05:37
UDF parse error at profile function line Wiggy Fluent UDF and Scheme Programming 1 July 27, 2009 15:59
fluent UDF external library lapack problem Rick FLUENT 0 May 7, 2008 10:16
HELP! Problem compiling UDF function Syrakus FLUENT 6 April 7, 2006 10:48

All times are GMT -4. The time now is 18:47.