# UDF for inlet BC, Free Surface Open Channel Flow VOF

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

 February 20, 2012, 05:39 UDF for inlet BC, Free Surface Open Channel Flow VOF #1 New Member   Arshiya Hoseyni Chime Join Date: Feb 2012 Posts: 11 Rep Power: 14 Hi everyone I am working on an open channel flow problem. I used the VOF model and successfully simulated a free surface flow over a bump! But, I figured that Fluent assigns a velocity to both water and air! However, I want to set the inlet velocity of air to zero. My advisor wants me to write a UDF to set a parabolic velocity for water flow from bottom to free surface and then set air velocity on top to zero! This is the UDF I came up with but it doesn't work! (0,0) is the left bottom corner of a rectangle (0.1x0.6 m) . Free surface is at 0.05m and has 2m/s velocity. #include "udf.h" #define Ui 2.0 DEFINE_PROFILE(inlet_x_velocity, thread, position) { real x[ND_ND]; real y; face_t f; begin_f_loop(f,thread) { F_CENTROID(x, f, thread); y=x[1]; } if (y<0.05.) { F_PROFILE(f, thread, position)= Ui*(y*y)/(0.05*0.05); } else F_PROFILE(f,thread, position)=0; end_f_loop(f,thread); } I will appreciate any help Best regards Arshiya nahid rahnama likes this.

February 20, 2012, 07:02
#2
Senior Member

Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26
Hi!
Delete the point after 0.05 and include the if cycle into the begin_f_loop and your udf will be fine.

Here is the corrected udf:

Code:
```#include "udf.h"
#define Ui 2.0
{
real x[ND_ND];
real y;
face_t f;
{
y=x[1];

if (y<0.05)
{
}
else
}
}```
..and attached your resulting inlet x velocity after some iterations.

Daniele
Attached Images
 velocity.jpg (36.7 KB, 125 views)

Last edited by ghost82; February 20, 2012 at 08:05.

 February 20, 2012, 21:51 #3 New Member   Arshiya Hoseyni Chime Join Date: Feb 2012 Posts: 11 Rep Power: 14 Thank you Danielle. It worked

March 6, 2012, 18:13
problem encountered with UDF
#4
New Member

Arshiya Hoseyni Chime
Join Date: Feb 2012
Posts: 11
Rep Power: 14
I used the UDF in a simple channel flow with the following Boundary Conditions:

My shape is 0.6x0.15 m

Inlet:
- Velocity: UDF (max velocity gets to 1.2m/s at free surface)
- Free surface level: 0.07m

Outlet:
-Free Surface: Use from neighboring cell

Sides of the rectangular: no slip

The idea of writing this UDF is to set the velocity of air to zero and give a parabolic velocity for water inlet. But, once I run the Fluent, velocity profile shows that velocity of mixture is about zero on the bottom and about 7.5 m/s for air! Also Velocity vectors imply that air moves faster than water! Although, I set air Temperature to zero at the inlet!!!!

I've attached my velocity profile, velocity vector, and defined profile.

I would appreciate any help.

Arshiya
Attached Images
 parabolic velocity_interpolated data.jpg (42.4 KB, 83 views) parabolic velocity_streamlines.jpg (60.8 KB, 116 views) parabolic velocity.jpg (80.0 KB, 99 views)

 Tags free surface, open channel flow, udf, vof