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

 Register Blogs Members List Search Today's Posts Mark Forums Read

 August 11, 2012, 07:06 udf problem.. output data comes out to "zero" #1 New Member   Jong Hwan Park Join Date: Oct 2011 Posts: 12 Rep Power: 7 Sponsored Links 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?

August 12, 2012, 23:07
#2
Senior Member

Ji Junjie
Join Date: Feb 2010
Location: Shanghai, China
Posts: 109
Rep Power: 10
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 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?

 August 13, 2012, 00:17 #3 New Member   Jong Hwan Park Join Date: Oct 2011 Posts: 12 Rep Power: 7 Hi, gearboy Thanks for your answer! Changed the get domain value 4-> 1 But same results comes out. What is the problem?

 August 15, 2012, 23:09 #4 Senior Member   Join Date: Aug 2011 Posts: 315 Rep Power: 13 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

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43 DLINSA Fluent UDF and Scheme Programming 1 March 16, 2012 01:45 aleisia Fluent UDF and Scheme Programming 1 June 29, 2011 13:17 Shane FLUENT 1 September 3, 2010 02:32 kerem FLUENT 2 June 20, 2006 06:56