CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

udf problem.. output data comes out to "zero"

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 11, 2012, 07:06
Default udf problem.. output data comes out to "zero"
  #1
New Member
 
Jong Hwan Park
Join Date: Oct 2011
Posts: 12
Rep Power: 14
startup0820 is on a distinguished road
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 is offline   Reply With Quote

Old   August 12, 2012, 23:07
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
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 View Post
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 is offline   Reply With Quote

Old   August 13, 2012, 00:17
Default
  #3
New Member
 
Jong Hwan Park
Join Date: Oct 2011
Posts: 12
Rep Power: 14
startup0820 is on a distinguished road
Hi, gearboy
Thanks for your answer!
Changed the get domain value 4-> 1
But same results comes out.
What is the problem?
startup0820 is offline   Reply With Quote

Old   August 15, 2012, 23:09
Default
  #4
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
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

Last edited by blackmask; August 16, 2012 at 00:43. Reason: additional information
blackmask is offline   Reply With Quote

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
DPM Output Problem (Again...) DLINSA Fluent UDF and Scheme Programming 1 March 16, 2012 00:45
Weird problem in my UDF aleisia Fluent UDF and Scheme Programming 1 June 29, 2011 13:17
Help! Compiled UDF problem 4 Wave tank tutorial Shane FLUENT 1 September 3, 2010 02:32
parallel UDF problem kerem FLUENT 2 June 20, 2006 06:56


All times are GMT -4. The time now is 20:38.