# UDF-accessing fluent variables

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

 November 21, 2007, 06:36 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

 November 21, 2007, 15:11 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); }

 November 26, 2007, 13:12 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?

 November 27, 2007, 23:52 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

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post lequi7 Fluent UDF and Scheme Programming 2 November 4, 2011 00:18 DarrenC Fluent UDF and Scheme Programming 2 May 25, 2011 15:51 sega Fluent UDF and Scheme Programming 2 January 19, 2010 04:41 subha_meter Main CFD Forum 0 October 17, 2009 23:54 Karl FLUENT 2 February 14, 2002 09:29

All times are GMT -4. The time now is 23:00.