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

Computing Average Temperature using DEFINE_ADJUST macro

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By T81
  • 1 Post By kirmaks

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   March 17, 2009, 06:54
Default Computing Average Temperature using DEFINE_ADJUST macro
  #1
T81
New Member
 
Join Date: Mar 2009
Posts: 15
Rep Power: 17
T81 is on a distinguished road
Hi!

I have the following 2D channel geometry, like my previous post:

..............____________________________
heat --> |............................................ |
flux ---> |____________________________|

fluid ---> ----------------axis--------------------
..............____________________________
heat --> |............................................ |
flux ---> |____________________________|

I want to compute the average temperature of the walls (solid), in a transient analysis.

First, I define a User-Defined Memory (Define-->User-Defined-->Memory...)
Then I patch the value 1 for the User Memory O to the Solid Zone.

Then I wrote the following code using the DEFINE_ADJUST macro, hooked it, but when I start the iterations I get:

"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: ()
"

What's wrong in my code?

Thanks in advance.

Explaining the code: In every iteration, if a region has a value > 0.5 for UDMI 0 (solid has the value 1, fluid 0), the code computes the sum of temperatures for this region, and then the average value.

Code:
/***************************************************/
/* User-Defined Function for computing Solid Average Temperature  */
/***************************************************/

#include "udf.h"

DEFINE_ADJUST(my_adjust,d)
{
  real n = 0.;
  real Tsum = 0.;
  real T_AVG = 0.;
  
  Thread *t;
  cell_t c;
  real flag = C_UDMI(c,t,0);

 thread_loop_c(t,d)
 {
   begin_c_loop(c,t)
   if (flag > 0.5)
  {
    Tsum = Tsum + C_T(c,t);
     n = n + 1;
  }
   end_c_loop(c,t)
 }
  
  T_AVG = Tsum/n;
}
aestas likes this.
T81 is offline   Reply With Quote

 

Tags
define_adjust, temperature average value, temperature summary value, udmi


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
TEMPERATURE-AVERAGE mech FLUENT 1 April 25, 2007 16:06
Temperature Average Danny FLUENT 0 May 3, 2005 05:47
Define_Adjust Macro Mahesh FLUENT 0 November 10, 2004 05:54
average temperature mehravar FLUENT 2 January 1, 2004 00:43
Bug in the DEFINE_ADJUST macro? Senthil FLUENT 5 September 3, 2002 22:26


All times are GMT -4. The time now is 05:30.