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

UDF-accessing fluent variables

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 21, 2007, 05:36
Default UDF-accessing fluent variables
  #1
manu
Guest
 
Posts: n/a
I'm writing a UDF in which I need to access the average value of the pressure on a compressor exit area (that have been calculated with 3D simulation). This so-called "area mass average" value is define as: sum(p_i*A_i*_m_i)/sum(A_i*m_i) where p_i is the pressure, A_i the area and m_i the mass flow in each cell of the exit face. I found the function "F_P(f,t)" that records the pressure in each cell of the face but not the average value. Does anybody knows how to compute this average then? Thanks Manu
  Reply With Quote

Old   November 21, 2007, 14:11
Default Re: UDF-accessing fluent variables
  #2
mohan raj
Guest
 
Posts: n/a
//Please check this udf after changing id to the outlet ID

#include "udf.h" DEFINE_ON_DEMAND(average_pressure) { Domain *d; real P_avg; real A[ND_ND]; Thread *t; real m_sum=0.0; real sum=0.0; int id="GIVE YOUR ZONE ID"; face_t f; d = Get_Domain(1); t= Lookup_Thread(d,id)

begin_f_loop(f,t) { sum=sum+(F_P(f,t)*NV_MAG(A)*F_FLUX(f,t)); m_sum=NV_MAG(A)*F_FLUX(f,t); } end_f_loop(f,t)

P_avg=sum/m_sum; Message("MY AVERAGE PRESSURE=%f\n",P_avg); }
  Reply With Quote

Old   November 26, 2007, 12:12
Default Re: UDF-accessing fluent variables
  #3
manu
Guest
 
Posts: n/a
Thank you very much, it looks great!!! I didn't try it yet because I have one small problem accessing the area of each cell. I don't exactly understand the syntax of the function: F_AREA(A,f,t). Does it suffice to add: (...) real A[ND_ND]; F_AREA(A,f,t); (...) and then A is assigned with the area vector?? Is it right so?

  Reply With Quote

Old   November 27, 2007, 22:52
Default Re: UDF-accessing fluent variables
  #4
mohanraj
Guest
 
Posts: n/a
F_AREA(A,f,t); is a function which returns the face normal w.r.t to the grobal axis. A--> has three components if its 3-D or two componnts if 2-D. f and t are the face id for the thread 't'. These things are discussed in fluent manual pertaining to UDF. You can find these things from any search engines Typically, http://venus.imp.mx/hilario/SuperCom...tml/node56.htm
  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
Fluent UDF Discontinuous Motion lequi7 Fluent UDF and Scheme Programming 2 November 3, 2011 23:18
'Set Environment Variables' for Fluent 12 DarrenC Fluent UDF and Scheme Programming 2 May 25, 2011 15:51
FLUENT variables for the use in UDF sega Fluent UDF and Scheme Programming 2 January 19, 2010 03:41
UDF in Fluent subha_meter Main CFD Forum 0 October 17, 2009 23:54
Accessing function definitions for UDF Karl FLUENT 2 February 14, 2002 08:29


All times are GMT -4. The time now is 22:08.