CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF for inlet BC, Free Surface Open Channel Flow VOF (http://www.cfd-online.com/Forums/fluent-udf/97544-udf-inlet-bc-free-surface-open-channel-flow-vof.html)

arshiya4 February 20, 2012 06:39

UDF for inlet BC, Free Surface Open Channel Flow VOF
 
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

ghost82 February 20, 2012 08:02

1 Attachment(s)
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
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);
}

..and attached your resulting inlet x velocity after some iterations.

Daniele

arshiya4 February 20, 2012 22:51

Thank you Danielle. It worked:)

arshiya4 March 6, 2012 19:13

problem encountered with UDF
 
3 Attachment(s)
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


All times are GMT -4. The time now is 05:39.