CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   udf problem.. output data comes out to "zero" (https://www.cfd-online.com/Forums/fluent-udf/105874-udf-problem-output-data-comes-out-zero.html)

startup0820 August 11, 2012 07:06

udf problem.. output data comes out to "zero"
 
Hi Guys~

I am trying to output to a point w-velocity.

but, All values are output "0".

----------------------------------------------------------------------

#include "udf.h"

#define ID1 5 /*ID of the point*/


DEFINE_EXECUTE_AT_END(monkeymagic)
{
FILE *fp;
Domain *d;
real x[ND_ND];
Thread *t;
cell_t c;
real w=0, time=0;

fp = fopen("velocity.txt","w");
d = Get_Domain(4);
t = Lookup_Thread (d, ID1);
begin_c_loop(c, t)
{
C_CENTROID(x,c,t);

w= (C_W(c,t));

}
end_c_loop(c, t)

time=CURRENT_TIME;
fprintf (fp, "%f\n",time);
fprintf (fp, "%f\n",w);
fclose(fp);
}

----------------------------------------------------------------------

If I fix this problem,

Base on this udf source, I will generate 200 points and output velocity.(x, y, z velocity)

Plz anyone help me

What`s the problem of the source code?

gearboy August 12, 2012 23:07

Is this a multiphase problem? Why use "4" in the "Get_Domain"? Usually it should be d = Get_Domain(1) for a single-phase case.

d = Get_Domain(4);

Quote:

Originally Posted by startup0820 (Post 376570)
Hi Guys~

I am trying to output to a point w-velocity.

but, All values are output "0".

----------------------------------------------------------------------

#include "udf.h"

#define ID1 5 /*ID of the point*/


DEFINE_EXECUTE_AT_END(monkeymagic)
{
FILE *fp;
Domain *d;
real x[ND_ND];
Thread *t;
cell_t c;
real w=0, time=0;

fp = fopen("velocity.txt","w");
d = Get_Domain(4);
t = Lookup_Thread (d, ID1);
begin_c_loop(c, t)
{
C_CENTROID(x,c,t);

w= (C_W(c,t));

}
end_c_loop(c, t)

time=CURRENT_TIME;
fprintf (fp, "%f\n",time);
fprintf (fp, "%f\n",w);
fclose(fp);
}

----------------------------------------------------------------------

If I fix this problem,

Base on this udf source, I will generate 200 points and output velocity.(x, y, z velocity)

Plz anyone help me

What`s the problem of the source code?


startup0820 August 13, 2012 00:17

Hi, gearboy
Thanks for your answer!
Changed the get domain value 4-> 1
But same results comes out.
What is the problem?

blackmask August 15, 2012 23:09

If I guess correctly, after
t = Lookup_Thread (d, ID1);
t is NULL

The following thread should help you with your task.

http://www.cfd-online.com/Forums/flu...r-xy-plot.html


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