|
[Sponsors] |
June 21, 2000, 04:55 |
C_NNODES UDF 'function' problem
|
#1 |
Guest
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:\fluent.inc\fluent5.2/src -Ie:\fluent.inc\fluent5.2/cortex/src -Ie:\fluent.inc\fluent5.2/client/src -Ie:\fluent.inc\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) { C_CENTROID(xc,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.; } else C_U(c,thread) = 0.; } end_c_loop_all (c,thread) } } |
|
June 21, 2000, 11:16 |
Re: C_NNODES UDF 'function' problem
|
#2 |
Guest
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)]; Chris |
|
June 21, 2000, 23:46 |
Re: C_NNODES UDF 'function' problem
|
#3 |
Guest
Posts: n/a
|
Excellent, thankyou!
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM static build on Cray XT5 | asaijo | OpenFOAM Installation | 9 | April 6, 2011 13: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 16:59 |
fluent UDF external library lapack problem | Rick | FLUENT | 0 | May 7, 2008 11:16 |
HELP! Problem compiling UDF function | Syrakus | FLUENT | 6 | April 7, 2006 11:48 |