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

Udf problem

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 14, 2004, 10:46
Default Udf problem
  #1
Karthick
Guest
 
Posts: n/a
Hello all

I am writing a simple udf to get the temperature at each cell during iterations. It is interpreting well. But when I try to run the iterations, it is showing Access_violation error and it comes out.

What may be the problem? Also I am having one more doubt. Whether can I include the udf in between the runs? It is leading to always error. Whether is it permissible in Fluent.

My udf is given below: #include "udf.h" DEFINE_EXECUTE_AT_END(my_execute) { Domain *d;

int ID=2;

Thread *t=Lookup_Thread(d,ID);

cell_t c;

FILE *fp4;

int i;

real temp=0.;

fp4=fopen("temp_zone2.dat","w");

begin_c_loop(c,t)

{

temp=C_T(c,t);

fprintf(fp4,"%g\n",temp);

i++;

}

end_c_loop(c,t) printf("The %d values ", i); fclose(fp4); }

  Reply With Quote

Old   April 14, 2004, 18:33
Default Re: Udf problem
  #2
Ajay
Guest
 
Posts: n/a
Karthik ,

you are missing

d=getdomain(1), use it before

Thread *t=Lookup_Thread(d,ID);

Should work then

-Ajay
  Reply With Quote

Old   April 15, 2004, 01:51
Default Re: Udf problem
  #3
Karthick
Guest
 
Posts: n/a
Since Get_Domain(1) and Thread *t=Lookup_Thread(d,ID) both are same, we can use either of two.

Is it right?

Regards Karthick
  Reply With Quote

Old   April 15, 2004, 10:05
Default Re: Udf problem
  #4
Ajay
Guest
 
Posts: n/a
No they are not the same .

Thread *t=Lookup_Thread(d,ID)

will return a thread pointing to the ID number which you specify .Each boundary or zone is associated with an unique ID. but the other paramter you need which is d the domain pointer is not passed automatically when you use define_execute_at_end you need to get the domain ponter by using d=get_domain(1)

-Ajay
  Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 06:05
Problem with my udf july Fluent UDF and Scheme Programming 3 June 20, 2010 06:56
UDF problem mansha goraya FLUENT 0 October 29, 2007 00:31
udf compiling problem akr FLUENT 3 August 22, 2007 07:14
UDF problem chiseung FLUENT 4 January 10, 2002 09:58


All times are GMT -4. The time now is 02:34.