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

UDF for pressure outlet (resistance)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 15, 2014, 07:22
Default UDF for pressure outlet (resistance)
  #1
Senior Member
 
Join Date: Feb 2011
Posts: 140
Rep Power: 15
Lilly is on a distinguished road

Dear all,

I try to write a UDF to set the pressure at the outlets of my geometry according to the equation p=R*Q (p: pressure, R: resistance and Q: volume flow rate) for a fixed value of “R” at each outlet which corresponds to the resistance of the downstream vessels. Therefore, I have to use/readout the outflow at each outlet to calculate the pressure. My first guess of the UDF was:

#include "udf.h"
#include "math.h"

#define Density 1050.
#define R1 3.590987710898600e+10


real QMout1;
real Qout1;
real Pout1;

DEFINE_PROFILE(outlet1_pressure,thread,nv)
{
face_t f;

QMout1=0.0; //initial value

begin_f_loop(f,thread)
{
QMout1+=F_FLUX(f,thread); //sum of mass flow rate of all faces of the outlet at the same time step

}
end_f_loop(f,thread)

Qout1=QMout1/Density; //calculate volume flow rate

Pout1=R1*Qout1; //calculate pressure

begin_f_loop(f,thread)
{
F_PROFILE(f,thread,nv)=Pout1;
}
end_f_loop(f,thread)
}


I checked the results (static pressure and volume flow rate) for several time steps at several outlets and found the equation was satisfied.

However, I am not sure, if this makes sense, since I thought I must e.g. use the volume flow rate of the previous time step and solve the equation iteratively. But I am a bit confused how to integrate this at the UDF!? And what about the first time step? I certainly need to make a proper initial guess, don’t I? Does anybody have an idea how to fix this UDF? I am thankful for any help and idea!
Lilly
Lilly 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
UDF to adjust pressure outlet a.lynchy FLUENT 4 February 15, 2021 01:50
multiphase udf ak2009 Fluent UDF and Scheme Programming 0 June 7, 2012 01:15
UDF for Pressure outlet condition jubs FLUENT 0 February 8, 2007 05:30
UDF Hydrostatic Pressure Outlet Bridget FLUENT 0 May 16, 2006 18:55
UDF in Fluent to Match Mass Flow at Pressure Outlet Jonas Larsson Main CFD Forum 1 April 29, 1999 11:44


All times are GMT -4. The time now is 10:34.