CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF Problem (https://www.cfd-online.com/Forums/fluent/37014-udf-problem.html)

Jan June 21, 2005 17:17

UDF Problem
 
Hello, I try to get the number of faces for a cell via UDF (function C_NFACES). My code looks like that:

#include "udf.h" DEFINE_PROPERTY(cell_density, cell, thread) { real rho; real temp = C_T(cell, thread); int number = C_NFACES(cell, thread);

rho = 101325/(8.314*temp)*28.966/1000;

return rho; }

Most of it is taken from the Fluent UDF manual. Everything works fine if I delete the line "int number ...". If I write the line to get the number of faces for "cell", I get the following message:

non-integer subscript expression: unsigned char

Could anyone help me to find the mistake? I have nearly given up. I would be thankful for any advice.

Regards Jan

Joey June 22, 2005 01:07

Re: UDF Problem
 
The "number" seems do nothing in the UDF. And I can not find anything incorrect. I think there could be something wrong with the code you have not paste here.

Jan June 22, 2005 01:36

Re: UDF Problem
 
This is all the code I tried at the moment. Okay, here the "number" is still unused, but I wanted to build up my code step by step. But not even this small code is working. I use interpreted UDFs. May that be the problem?

Luca June 22, 2005 03:02

Re: UDF Problem
 
Hi Jan. I compiled your UDF and there's no problem! I suggest always compiling UDFs even if they are quite simple...Luca

Jan June 22, 2005 07:23

Re: UDF Problem
 
Thanks for your help. Everything works fine in compiled mode.

Regards Jan

zubier June 27, 2005 04:05

Re: UDF Problem
 
i want to know how to model electric field distribution inside a heating cell using voltage and current (ohmic heating) i need help thanks in advance

linzhaowei July 9, 2005 01:00

Re: UDF Problem
 
Interpreted UDFs are restricted in the use of the C programming language,but compile not. use interpreted UDFs for small, straightforward functions. use compiled UDFs for complex functions that have a significant CPU requirement (e.g., a property UDF that is called on a per-cell basis every iteration). .


All times are GMT -4. The time now is 15:51.