CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Is this UDF correct? (http://www.cfd-online.com/Forums/fluent/28409-udf-correct.html)

JJ April 4, 2001 03:36

Is this UDF correct?
 
Hi all,

I am a novice in C programming, I wrote the following in an attempt to generate a two layer flow in my domain. But when I try to compile it, fluent keeps giving me error msg. Not sure what is wrong. Can anybody help? Thanx.

#include "udf.h"

DEFINE_PROPERTY(cell_density, cell, threads) {

real density;

real grid_y = NODE_Y(c,t);

if (grid_y<0.81)

density = 998;

else

density = 968;

return density; }

Regards, JJ


Greg Perkins April 4, 2001 04:27

Re: Is this UDF correct?
 
try grid_y = NODE_Y(cell,threads);

JJ April 6, 2001 07:08

Re: Is this UDF correct?
 
Hi Greg,

Thanx for your help, tried it and I was able to compile it. But I am still stuck cos when I try to initialize the flow, I obtain the following error msg "2ldensity.cpp:6: macro `NODE_Y' used with too many (2) args"

2ldensity is the name of the UDF. May I know what can be done?

Thanx in advance.

JJ

Greg Perkins April 8, 2001 18:54

Re: Is this UDF correct?
 
Actually you'd be better to use C_CENTROID to determine the location of the cell centroid. Check this out in the udf manual.

Greg


All times are GMT -4. The time now is 16:50.