CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

Calculate the entering flow rate in each cell

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

Reply
 
LinkBack Thread Tools Display Modes
Old   February 21, 2012, 04:21
Default Calculate the entering flow rate in each cell
  #1
Member
 
Join Date: Apr 2010
Posts: 53
Rep Power: 6
bephi is on a distinguished road
Hi at all!

I am trying to find a way how to calculate the flow rate that enters or leaves a cell. In sum it should be zero but I like to find out a specific value for each cell of the domain.

Does anyone has an idea how to approach this? Thank you very much in advance.
bephi is offline   Reply With Quote

Old   February 21, 2012, 20:11
Default
  #2
Member
 
Ji Junjie
Join Date: Feb 2010
Location: Shanghai, China
Posts: 99
Rep Power: 6
gearboy is on a distinguished road
Quote:
Originally Posted by bephi View Post
Hi at all!

I am trying to find a way how to calculate the flow rate that enters or leaves a cell. In sum it should be zero but I like to find out a specific value for each cell of the domain.

Does anyone has an idea how to approach this? Thank you very much in advance.
loop over the faces of a cell, and calculate the sum of flux through these faces
gearboy is offline   Reply With Quote

Old   May 30, 2012, 11:11
Default problem trying to get the mass flow entering a cell
  #3
New Member
 
javiercran
Join Date: May 2012
Posts: 2
Rep Power: 0
javiercran is on a distinguished road
Hello,
I have tried to calculate the mass flow entering inside a cell (for a DEFINE_SOURCE macro) with a loop over the faces of the cell but I have problems of "non-integer subscript expression: unsigned char".
This is my code

#include "udf.h"
#include <mem.h>
DEFINE_SOURCE(theta_momentum,c,t,dS,eqn)
{
//near peak operating point
real Ft; //Ft source term
real T01; //Inlet Total temperature
real T02; //Outlet Total temperature
real cp; //variable which will store the specific heat of air
real x[ND_ND]; //array for storing the centroid position
real pi=3.1416;
real omega=16043*2*pi/60;
real r;
face_t f;
real massflow=0;
real volume;
Thread *f_thread;
int n;

c_face_loop(c,t,n)//line 21 the one which gives problems
{f=C_FACE(c,t,n);
f_thread = C_FACE_THREAD(c,t,n);
if(F_FLUX(f,f_thread)>0)// only calculate the massflow entering
{massflow=massflow+F_FLUX(f,f_thread);
}
}

massflow=massflow*2*pi;//axisymmetric
volume=C_VOLUME(c,t);
T01=288.15;
cp=1006;
C_CENTROID(x,c,t);//we store in x the centroid position of each cell
r=x[1];// the radial position is the y-coordinate of the cell centroid
r = x[1];
T02=1.164*T01;
Ft=massflow*cp*(T02-T01)/(volume*omega*r);
dS[eqn]=0;
return Ft;
}

I need your help because I cant see the mistake I am doing.
Regards
javiercran is offline   Reply With Quote

Reply

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
Mass flow rate: calculation v/s computation beguxa FLUENT 4 June 8, 2013 16:17
mass flow rate error Masood FLUENT 0 May 22, 2005 00:32
How to calculate the mass flow rate with UDF ? HP FLUENT 0 January 10, 2005 19:38
sos! How to define the flow rate of outflow BC? zjm FLUENT 0 June 4, 2004 09:12
cell flow rate sivakumar FLUENT 0 March 31, 2003 13:05


All times are GMT -4. The time now is 04:25.