|
[Sponsors] |
|
November 21, 2007, 05:36 |
UDF-accessing fluent variables
|
#1 |
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
|
|
November 21, 2007, 14:11 |
Re: UDF-accessing fluent variables
|
#2 |
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); } |
|
November 26, 2007, 12:12 |
Re: UDF-accessing fluent variables
|
#3 |
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?
|
|
November 27, 2007, 22:52 |
Re: UDF-accessing fluent variables
|
#4 |
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
|
|
|
|
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 |