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

How execute DEFINE_ON_DEMAND udf in (section 2.2.8

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 29, 2009, 12:26
Default How execute DEFINE_ON_DEMAND udf in (section 2.2.8
  #1
Alireza HOS
Guest
 
Posts: n/a
Hi I tried to use a UDF from UDFHelp(section 2.2.8) but it has errors.

1-I compiled it without error

2-I defined (Define->user-Defined->Memory) in this case i select 1

3-using: (Define->user-Defined->Execute on Demand)

but i receive an error:

Error: FLUENT received fatal signal (ACCESS_VIOLATION)

1. Note exact events leading to error.

2. Save case/data under new name.

3. Exit program and restart to continue.

4. Report error to your distributor.

Error Object: ()

Would you please guide me why do i have this error. Also i checked it with different computers.

The macro is mentioned in following:

/************************************************** ********************

UDF to calculate temperature field function and store in

user-defined memory. Also print min, max, avg temperatures. ************************************************** *********************/ #include "udf.h"

DEFINE_ON_DEMAND(on_demand_calc) {

Domain *d; /* declare domain pointer since it is not passed as an

argument to the DEFINE macro */

real tavg = 0.;

real tmax = 0.;

real tmin = 0.;

real temp,volume,vol_tot;

Thread *t;

cell_t c;

d = Get_Domain(1); /* Get the domain using Fluent utility */

/* Loop over all cell threads in the domain */

thread_loop_c(t,d)

{

/* Compute max, min, volume-averaged temperature */

/* Loop over all cells */

begin_c_loop(c,t)

{

volume = C_VOLUME(c,t); /* get cell volume */

temp = C_T(c,t); /* get cell temperature */

if (temp < tmin || tmin == 0.) tmin = temp;

if (temp > tmax || tmax == 0.) tmax = temp;

vol_tot += volume;

tavg += temp*volume;

}

end_c_loop(c,t)

tavg /= vol_tot;

printf("\n Tmin = %g Tmax = %g Tavg = %g\n",tmin,tmax,tavg);

/* Compute temperature function and store in user-defined memory*/

/*(location index 0) */

begin_c_loop(c,t)

{

temp = C_T(c,t);

C_UDMI(c,t,0) = (temp-tmin)/(tmax-tmin);

}

end_c_loop(c,t)

} }

  Reply With Quote

Old   February 1, 2009, 10:23
Default Re: How execute DEFINE_ON_DEMAND udf in (section 2
  #2
bohis
Guest
 
Posts: n/a
thread_loop_c(t,d) is not closed with bracket! Moreover, t_avg and vol_tot have to be initialized!!!

good luck

  Reply With Quote

Reply

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
DEFINE_ON_DEMAND and acces to particle (DPM) JFeg FLUENT 0 October 31, 2008 13:53
DEFINE_ON_DEMAND pourak FLUENT 4 April 19, 2007 04:34
DEFINE_ON_DEMAND jim FLUENT 0 June 13, 2006 02:36
define_on_demand help!! Thiyagarajan FLUENT 0 August 23, 2005 14:39
DEFINE_ON_DEMAND iker FLUENT 0 July 17, 2003 12:13


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