CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

UDF for use value of one BC and use it on another BC

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

LinkBack Thread Tools Display Modes
Old   January 13, 2010, 06:15
Lightbulb UDF for use value of one BC and use it on another BC
New Member
Join Date: Apr 2009
Location: Amsterdam
Posts: 16
Rep Power: 10
xavi is on a distinguished road
Sponsored Links
I would like to create a boundary condition of velocity inlet which depends on the mass flow rate of the pressure outlet boundary condition of the model. It does exist a delay between the value of the mass flow rate of the pressure outlet and the value of the velocity inlet, this delay is represented by the length and the velocity of the fluid through a pipe which connects the pressure outlet and the velocity inlet of the system (and is not modeled in the CFD software). Does anyone have an UDF which reads this value from another BC and uses it in the present BC?
xavi is offline   Reply With Quote
Sponsored Links

Old   May 29, 2013, 16:54
Default values from BC
Nick Cleveland
Join Date: Mar 2012
Posts: 34
Rep Power: 7
NCle is on a distinguished road
Hi Xavi,

I'm trying to currently do something similar. Not sure if you still even remember this cause its from 4 years ago. I want to write UDF to adjust velocity inlet speed based on the pressure at that inlet. So I need to read the pressure average from the inlet surface and put into the UDF, not sure how to. Did you figure it out?
NCle is offline   Reply With Quote

Old   May 29, 2013, 19:52
Senior Member
Join Date: Aug 2011
Posts: 315
Rep Power: 14
blackmask will become famous soon enough
It is not hard. Declare the average pressure in the file scope. Use
to calculate it. You might need
Get_Domain Loopup_Thread BEGIN_F_LOOP END_F_LOOP C_P
for such purpose.

The velocity profile then could be specified with
blackmask is offline   Reply With Quote

Old   May 30, 2013, 09:32
Default surface specification
Nick Cleveland
Join Date: Mar 2012
Posts: 34
Rep Power: 7
NCle is on a distinguished road
Thanks Blackmask. If you have time, I have a general question about your post. I'm pretty new to UDFs also, so is there a way to first just write a UDF that only gets the average pressure and prints it out (do you know of any so I could start from there?) Then I could hopefully add the velocity adjusting part of it. Should I structure my UDF like this?

commands that get average pressure at inlet (I'm wondering how to print this out)

F_Profile= some function of the pressure from above section (this determines inlet velocity)

This is my UDF currently
/************************************************** ******************
UDF for averaging pressure displaying it in the
console at the end of the current iteration or time step
************************************************** *******************/

#include "udf.h"
#include "mem.h"
Domain *d;
Thread *t;
face_t f;
/* Integrate dissipation. */
real sum_diss=0.;
real press;
cell_t c;
d = Get_Domain(1); /* mixture domain if multiphase */
sum_diss += C_P(c,t);
printf("AVERAGE PRESSURE AT FACE: %g\n", sum_diss);

DEFINE_PROFILE(unsteady_velocity, thread, position)
face_t f;
begin_f_loop(f, thread)
real time;

F_PROFILE(f, thread, position) = 1E7;
end_f_loop(f, thread)

Last edited by NCle; May 31, 2013 at 10:08.
NCle is offline   Reply With Quote


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

Sponsored Links

All times are GMT -4. The time now is 15:37.