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

UDF to set pressure

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2022, 06:14
Question UDF to set pressure
  #1
New Member
 
cedric k
Join Date: Mar 2022
Posts: 4
Rep Power: 4
le-ceko is on a distinguished road
Hi all,

I work on a project and i'm pretty new in UDF.

I have to set an udf depending on the mass flow rate at the outlet.
i try to write an udf code but it doesn,t work :
#include "udf.h"

DEFINE_PROFILE(pressure_outlet,t,i)
{
real inlet_mass_flow_rate = 0.025 ; /* liquid inlet mass flow rate */
real current_mass_flow_rate; /* declare variable for the current mass flow rate */
real error;
real kp = 50; /* proportional constant */
face_t f;
begin_f_loop(f,t)
{
current_mass_flow_rate = F_FLUX(f,t); /* F_FLUX is the mass flow rate through a face */
error = inlet_mass_flow_rate - current_mass_flow_rate; /* difference between each mass flow rate */
F_PROFILE(f,t,i) = F_P(f,t) + kp * error; /* pressure definition */
}
end_f_loop(f,t)
}

I think i have forgotten something. I found an article about that so they said that :

the set point of the exit mass flow rates ( sp
mexit ) was determined as the inlet mass flow rate. The error (Ei)
between the set point and the actual mass flow rate ( ie
m xit ) at the ith time level was calculated as follows:
Ei = msp -mexit
The exit pressure ( i+1 Pexit ) at the next time level was obtained from the current exit pressure (P i exit ) and a correction value proportional to the error
Pexit(i+1) = P(i) - K Ei

Someone can help me ?
le-ceko 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
Setting up the pressure variation due to tornado in a duct(UDF)+animation guillaume1990 FLUENT 0 March 3, 2014 12:59
Set inlet velocity and pressure in cavitational model GerardX89 FLUENT 1 July 5, 2012 17:17
how to get pressure and pressure gradient using UDF Honglin Fluent UDF and Scheme Programming 0 May 24, 2012 07:47
Fluent 5.2, UDF and Pressure BC's Alfonso Ferrandez FLUENT 0 May 4, 2000 08:02


All times are GMT -4. The time now is 16:59.