CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

Calculation of the molar flow rate

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

LinkBack Thread Tools Display Modes
Old   July 18, 2012, 08:56
Question Calculation of the molar flow rate
New Member
Join Date: Jul 2012
Posts: 6
Rep Power: 7
sylvix48 is on a distinguished road
Sponsored Links
Hello everyone !

In my problem I have a cylindrical geometry with an inlet and an outlet with a mixture inside and I want to determinate the molar flow rate in the inlet and the outlet. The formula to calculate the molar flow rate is :

\int\int C*S*VdS

Where C is the concentration of the specie, V the velocity of the flow and S the surface

The Inlet ID is 23, the outlet is 24 and my mixture ID is 15.

I've tried to code it but I've several issues :

Here's my UDF for my inlet case:

#include "udf.h"

Domain *d;
real molar_flow_rate_inl=0.;
face_t f;
Thread *t;
d = Get_Domain(15);
t= Lookup_Thread(d, 24);

molar_flow_rate_inl+=NV_MAG(A)*F_W(f,t)*"Concentra tion";

/* How to define the face concentration of a specific specie when my mixture contains several species and how I can define A in NV_MAG(A) ???*/

printf("Molecular Flow Rate inlet: %g\n",molar_flow_rate_inl);

Thank you for your future answers !!!
sylvix48 is offline   Reply With Quote
Sponsored Links

Old   July 19, 2012, 04:52
New Member
Join Date: Jul 2012
Posts: 6
Rep Power: 7
sylvix48 is on a distinguished road
I have a litlle bit improved my code :


#define i_ch4 1
#define i_h2 2

#define mw_ch4 16.04303
#define mw_h2 2.01594

real A[ND_ND];
real molar_inlet=0;
real molar_outlet=0;
real efficiency=0;
int inlet_ID=23;
int outlet_ID=24;
Domain *d=Get_Domain(1);
Thread *t_inlet=Lookup_Thread(d,inlet_ID);
Thread *t_outlet=Lookup_Thread(d,outlet_ID);
face_t f;


molar_inlet += F_FLUX(f,t_inlet)*F_YI(f,t_inlet,i_ch4)/(mw_ch4)*1e-3;
Message("inlet %f mol/s of CH4\n",molar_inlet);


molar_outlet += F_FLUX(f,t_outlet)*F_YI(f,t_outlet,i_h2)/(mw_h2)*1e-3;
Message("outlet %f mol/s of H2\n",molar_outlet);

Message("Efficiency %f %\n",efficiency);


It is compiled under Fluent but it returns 0 for each case while there is a mass rate of CH4 and H2 at the boundaries. At the end of calculation it is stated :" Unable to enter text edit mode " maybe it is the error ? I don't understand why it doesn't work, if someone could help me.

Last edited by sylvix48; July 19, 2012 at 06:04.
sylvix48 is offline   Reply With Quote

Old   July 19, 2012, 05:15
Senior Member
flotus1's Avatar
Join Date: Jun 2012
Location: Germany
Posts: 1,507
Rep Power: 25
flotus1 will become famous soon enoughflotus1 will become famous soon enough
Message("Efficiency %f %\n",efficiency);
Are you sure that the second % isn't misunderstood by the compiler?
flotus1 is offline   Reply With Quote

Old   July 19, 2012, 05:34
New Member
Join Date: Jul 2012
Posts: 6
Rep Power: 7
sylvix48 is on a distinguished road
No it's not that.

I've tried without it still doesn't work.

Moreover it is already 0 for the inlet and the outlet.

I don't get also why it is printed several time on my screen when I ask to write it once ?
sylvix48 is offline   Reply With Quote


Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to calculate phase flow rate? sangramroy FLUENT 0 January 11, 2012 14:02
Mass Flow Rate is not converging destgir448 CFX 5 December 11, 2010 06:55
Calculation of mass flow rate msrinath80 OpenFOAM Running, Solving & CFD 0 April 18, 2007 14:05
mass flow rate error Masood FLUENT 0 May 22, 2005 00:32

Sponsored Links

All times are GMT -4. The time now is 07:46.