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

volume flow rate error in udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 12, 2010, 09:49
Default volume flow rate error in udf
  #1
New Member
 
christophe
Join Date: Aug 2009
Posts: 24
Rep Power: 17
jjchristophe is on a distinguished road
In order to model a specific pressure outlet condition, I wrote a UDF that compute the outlet pressure with the following equation:
p_out=k*(4e6)*Q_out+2000 (1)
where p_out is the outlet pressure, Q_out the outlet volume flow rate and k a coefficient that i use to increase the resistance at the outlet.
In my real model I have 19 outlets, and 8 should use this condition (for the other k=1).
I tested my UDF on a cylinder of 1cm radius and 8cm length, for Re=1000 at the inlet (velocity inlet), with k=2 and 200.
among the different test, I output the outlet pressure and I compared it with the expected pressure from equ. (1).
I was really surprised of the difference: p_out=2009Pa instead of 2928Pa for k=2 and 5327Pa instead of 94800Pa for k=200.
Could you tell me if there is any problem in my udf, especially the way to obtain the outlet volume flow rate?
the code is as follow:

#include "udf.h"
#include "unsteady.h"
DEFINE_PROFILE(resistance_S,thread,i)
{
real Q=0.;
real t=CURRENT_TIME;
real A[ND_ND];
face_t f;
float u,v,w,vi,vn;
float k=2.0;
{
begin_f_loop(f,thread)
{
u=F_U(f,thread);
v=F_V(f,thread);
w=F_W(f,thread);
vi=u*u+v*v+w*w;
vn=sqrt(vi);
F_AREA(A,f,thread);
Q=Q+NV_MAG(A)*vn;
F_PROFILE(f,thread,i)=k*(4e6)*Q+2000.0;
u=0.;
v=0.;
w=0.;
vn=0.;
Q=0.;
}
end_f_loop(f,thread)
}

Thank you for any help
jjchristophe is offline   Reply With Quote

Old   July 13, 2010, 05:23
Default
  #2
New Member
 
christophe
Join Date: Aug 2009
Posts: 24
Rep Power: 17
jjchristophe is on a distinguished road
It seems there were some mistake in my UDF, so I re wrote it as follow:


#include "udf.h"
#include "unsteady.h"
DEFINE_PROFILE(resistance_S,thread,i)
{
real Q=0.;
real t=CURRENT_TIME;
real A[ND_ND];
face_t f;
float u,v,w,vi,vn;
float k=2.0;
{
begin_f_loop(f,thread)
{
u=F_U(f,thread);
v=F_V(f,thread);
w=F_W(f,thread);
vi=u*u+v*v+w*w;
vn=sqrt(vi);
F_AREA(A,f,thread);
Q=Q+NV_MAG(A)*vn;
u=0.;
v=0.;
w=0.;
vn=0.;
}
end_f_loop(f,thread)
begin_f_loop(f,thread)
{
F_PROFILE(f,thread,i)=k*(4e6)*Q+2000.0;
}
end_f_loop(f,thread)
}
}

This seems fine now for k=2, but if I set k to 200, I should get a pressure at the outlet of 2.012x10^6Pa, instead I have 1.229x10^6Pa.
I also tried it with a Y junction mesh, and even with k=1 for both outlet, the results are not good.
Any one could explain me why?
jjchristophe is offline   Reply With Quote

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
mass flow rate not conserved in turbomachine, interface defined wrong? wildli FLUENT 3 September 15, 2022 13:19
UDF to measure Mass Flow Rate a.lynchy Fluent UDF and Scheme Programming 31 October 4, 2018 15:10
FloWorks (Flow Express) Volume Goal Setting Issue rbigelow FloEFD, FloWorks & FloTHERM 1 November 16, 2009 02:32
How to define mass flow rate using UDF? SAMUEL FLUENT 3 December 25, 2004 01:36
How to define mass flow rate using UDF? SAMUEL FLUENT 0 December 16, 2004 03:55


All times are GMT -4. The time now is 09:36.