FLUENT 6 - monitoring phase flow rates using the mixture model


There is no direct way to monitor phase flow rates at inlet/outlet boundaries when using the mixture model in FLUENT 6.2. Monitoring flow rates or mass flow rates at a surface will include mixture density and velocity and will not provide relevant information on the phase flow rates.

The following udf solves the problem. User needs to provide the surface ID and number of phases used in his/her model. Then hook it up to Define/User defined/ Functionhooks/Execute at end.
The udf output is an ASCII file that contains n+1 columns, one for flow time and the remaining ones to report phase flow rates in kg/s. The udf can be run both in serial and parallel modes.

/****************************************************************
* UDF for monitoring phase flow rates at inlet/outlet boundaries
* User needs to specify:
* i) the face_ID from The Define/Boundary condition/ID panel
* ii) number of phases
*
* FLUENT 6.2.16, serial & parallel
* by Peter Spicka, ps@fluent.com
* March 2005
****************************************************************/

#include "udf.h"
#define face_ID 4
#define N_PHASES 2

DEFINE_EXECUTE_AT_END(fluxes)
{
real mass_flux[N_PHASES], iwork[N_PHASES];
int i=0;
#if !RP_NODE
FILE *fp;
char *path;
path="./fluxes.dat";
#endif


#if !RP_HOST /*serial or node*/
Domain *d = Get_Domain(1);
Thread *t, **pt;
face_t f;
real fflux;
real A[ND_ND], vel[ND_ND];
t=Lookup_Thread(d,face_ID);
pt = THREAD_SUB_THREADS(t);


for (i=0; i < N_PHASES; i++)
{
mass_flux[i]=0.;
begin_f_loop(f,t)
{
if ( PRINCIPAL_FACE_P(f,t) )
{
F_AREA(A, f, t);
NV_D( vel, = , C_U(f,pt[i]) , C_V(f,pt[i]), C_W(f,pt[i]) );
fflux = NV_DOT( A, vel) * C_R(f,pt[i]) * C_VOF(f,pt[i]);
mass_flux[i] +=fflux;
}
}end_f_loop(f, t)
}

#if RP_NODE
PRF_GRSUM(mass_flux,N_PHASES,iwork);
#endif
#endif

node_to_host_real( mass_flux, N_PHASES);

#if !RP_NODE /*serial or host*/

fp =fopen(path,"a");
fprintf(fp,"%10.6f", CURRENT_TIME);
for (i=0; i<N_PHASES; i++)
{
Message("Phase-%d mass flux: %12.8fn", i,mass_flux[i]);
fprintf(fp,"%12.8f", mass_flux[i]);
}
fprintf(fp,"n");
fclose(fp);
#endif
}





Show Form
No comments yet. Be the first to add a comment!