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

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

Like Tree5Likes
  • 1 Post By arshiya4
  • 2 Post By ghost82
  • 2 Post By arshiya4

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 20, 2012, 06:39
Default 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
arshiya4 is on a distinguished road
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.
arshiya4 is offline   Reply With Quote

Old   February 20, 2012, 08:02
Default
  #2
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27
ghost82 will become famous soon enough
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
Attached Images
File Type: jpg velocity.jpg (36.7 KB, 126 views)
rajann_786 and nahid rahnama like this.

Last edited by ghost82; February 20, 2012 at 09:05.
ghost82 is offline   Reply With Quote

Old   February 20, 2012, 22:51
Default
  #3
New Member
 
Arshiya Hoseyni Chime
Join Date: Feb 2012
Posts: 11
Rep Power: 14
arshiya4 is on a distinguished road
Thank you Danielle. It worked
arshiya4 is offline   Reply With Quote

Old   March 6, 2012, 19:13
Question problem encountered with UDF
  #4
New Member
 
Arshiya Hoseyni Chime
Join Date: Feb 2012
Posts: 11
Rep Power: 14
arshiya4 is on a distinguished road
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
File Type: jpg parabolic velocity_interpolated data.jpg (42.4 KB, 83 views)
File Type: jpg parabolic velocity_streamlines.jpg (60.8 KB, 116 views)
File Type: jpg parabolic velocity.jpg (80.0 KB, 100 views)
remo and nahid rahnama like this.
arshiya4 is offline   Reply With Quote

Reply

Tags
free surface, open channel flow, udf, vof

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thermocapillary free surface flow zakifoam OpenFOAM Running, Solving & CFD 10 December 12, 2016 12:44
Open channel flow motaba Main CFD Forum 4 March 26, 2011 04:22
Open Channel Flow forsumit FLUENT 0 October 1, 2009 03:01
Free surface, open channel Linda FLUENT 2 April 10, 2006 12:43
open channel flow vof model Yong Siemens 3 June 21, 2005 06:54


All times are GMT -4. The time now is 12:52.