# To calculate area averaged species mass fraction from PDF

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

May 18, 2015, 02:14
To calculate area averaged species mass fraction from PDF
#1
Member

Join Date: Jan 2015
Posts: 75
Rep Power: 4
Dear all,

I am having a problem in determining the mass fraction of a specie at the surface of sphere which is inside a flow domain (cylindrical) using UDF.

I have written a code for this from which the value of tot_frac will be used for mass flow rate calculation in other function.

Quote:
 DEFINE_ADJUST(massfraccalc,d) { d=Get_Domain(1); t=Lookup_Thread(d,ID); begin_f_loop(f,t) if PRINCIPAL_FACE_P(f,t) { d=Get_Domain(1); t=Lookup_Thread(d,ID); F_AREA(A,f,t); tot_area+=NV_MAG(A); mass_frac=mass_frac+(Pdf_Yi(c,t,3)*NV_MAG(A)); } end_f_loop(f,t) tot_frac=mass_frac/tot_area; Message("Area averaged mass fraction of carbon dioxide(co2) is %e\n",tot_frac); }

where Pdf_Yi(c,t,3) is the macro for fetching mass fraction. 3 is the specie index, i.e, in my case it is for co2.

I have tried this code for all other species (index) all seems to work fine but when I give specie index as 3, the value is always 0.00000e+0.

But the plot of area averaged mass fraction (monitor) is showing very different, it is varying every iteration.

QUESTION

Is there any problem with my UDF for area averaged mass fraction calculation?

 May 18, 2015, 02:16 Details #2 Member   Baradwaj B S Join Date: Jan 2015 Posts: 75 Rep Power: 4 Dear all, All required variables are defined globally outside this function. Thanks, Bharadwaj B S

 March 7, 2016, 04:08 #3 New Member   志新高(Zhixin Gao) Join Date: Aug 2014 Location: hz.China Posts: 22 Rep Power: 4 Dear Bharadwaj B S maybe you have only three species, because when one use C_YI(c,t,i) macros, i=0,1,2 when there are 3 species(I am not sure if the macros you used like this or not).

 March 8, 2016, 03:22 Thank you #4 Member   Baradwaj B S Join Date: Jan 2015 Posts: 75 Rep Power: 4 Thanks for the reply. Issue was there very long back. I have used some other method to fetch mass fraction. I do not remember, sorry for that. Again huge thanks. Regards,

 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 prince_pahariaa FLUENT 0 August 26, 2014 08:08 combustion FLUENT 15 October 29, 2013 04:57 soni_sth CFX 7 February 14, 2012 17:37 llrr FLUENT 0 May 21, 2010 04:41 Ale FLUENT 0 July 18, 2003 09:04