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

UDF Defining VOF Free Surface at Outlet

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 2, 2008, 14:01
Default UDF Defining VOF Free Surface at Outlet
  #1
Alex
Guest
 
Posts: n/a
I am currently modeling the horizontal flow of water with a free surface and air above (using VOF model in FLUENT). My question relates to the outlet boundary condition. I am trying to define the pressure profile at the outlet. The idea was to loop over the cells at the exit while reading the volume fraction to determine the height of the free surface. With the height of the free surface I was going to define the pressure in the water with a linear relation to the hydrostatic pressure at the bottom of the domain. Hopefully this will allow for the free surface to shift up and down.

I have tried several techniques with my UDF but I keep recieving an (ACCESS VIOLATION). I have looked through the UDF manual quite a bit and don't understand where my problem is occuring. I have added my udf used below. If anyone has any idea how to do this, or can see my problem, please let me know.

/************************************************** ********************* Outlet pressure profile for multiphase flow with VOF ************************************************** **********************/

#include "udf.h"

DEFINE_PROFILE(pressure_profile,t,i)

{

real x[ND_ND], xx[2], pstat, density; real gravity, yholder, height, vof, pbot;

Domain *d; face_t f; cell_t cc; Thread *t; Thread *tt;

d=Get_Domain(1); pstat=0; density=998.2; gravity=9.81; yholder=1; height=6; vof=0; pbot= density*gravity*height;

thread_loop_c(cc,domain){

begin_c_loop(cc,tt){

vof = C_VOF(cc,tt);

C_CENTROID(x,cc,tt);

if (vof < 1)

{

if (x[0]>14.9)

{

if (x[1] >= yholder)

{yholder = x[1];}

}

}

}end_c_loop(cc,tt) }

begin_f_loop(f,t){

F_CENTROID(xx,f,t);

if (xx[1]>yholder)

{F_PROFILE(f,t,i) = pstat;}

if (xx[1]<=yholder)

{F_PROFILE(f,t,i) = pstat + pbot*(yholder-xx[1])/yholder;}

}end_f_loop(f,t)

}

I would appreciate any help, thank.

Alex
  Reply With Quote

Old   June 6, 2008, 06:56
Default Re: UDF Defining VOF Free Surface at Outlet
  #2
Victor
Guest
 
Posts: n/a
What are you trying to do, in fact? Are you trying to impose a pressure outlet profile?

I can't see why one would do that, why don't you just use a "outflow" BC at the outlet? That should work just fine.

Then you'll get the pressure profile at the outlet as a result from Fluent, not as a BC you have to impose.

My best regards, Victor
  Reply With Quote

Old   June 6, 2008, 11:14
Default Re: UDF Defining VOF Free Surface at Outlet
  #3
Alex
Guest
 
Posts: n/a
Due to the geometry, we have set part of our top boundary as a pressure inlet. Fluent will not allow the use of pressure conditions and outflow conditions. Therefore we were trying to define an approximate pressure outlet profile for a distance downstream.
  Reply With Quote

Old   June 6, 2008, 11:34
Default Re: UDF Defining VOF Free Surface at Outlet
  #4
Victor
Guest
 
Posts: n/a
Hi,

Ok, maybe I just thought the problem is simpler than it is, but I still don't get one thing: you've just said that you KNOW you have the top of the boundary as a pressure inlet boundary condition. Then you just have to set is as a "pressure inlet" boundary condition with Fluent.

I think your problem is that your downstream boundary has one part as a inlet (with know pressure) and other as outlet. If so, just split the face with Gambit, before meshing the volumes, so you'll be able to set two separately boundary conditions for your problem at the downstream.

So the pressure inlet is know and you just set it manually.

The outlet you set as outflow, so Fluent will use the pressure from the cells just before the boundary faces - it'll consider the hydrostatic pressure automatically as you have gravity activated.

If you're not sure about where the boundary condition turns from outflow to inflow, just try first where you think is more logical, and then check for backflow in the solution, so you'll be able to do another mesh and be more accurate in the simulation. That should work...

Probably I didn't get it right and I'm just bothering you with useless advices. Sorry if that's the case.

My best regards, Victor.
  Reply With Quote

Old   June 6, 2008, 12:48
Default Re: UDF Defining VOF Free Surface at Outlet
  #5
Alex
Guest
 
Posts: n/a
Victor,

Thanks for the reply, I appreciate the help.

The problem that I am testing, has waves which develop and have the potential of changing the water level at the exit with time. That is one of the reasons why I am trying to model a pressure outlet which adjusts to the water height at the exit. Since I cannot specify two separate outlets when the water level at the exit will be changing (because then my mesh would need to change with time).

Secondly, unless you know a trick, Fluent will simply not allow me to specifiy a pressure condition (anywhere in the domain) with an outflow boundary condition. It will tell me that solution cannot proceed until I get rid of my pressure BC or my outflow bc.

Sorry if I caused any confusion with an unclear problem statement. If my reasoning doesn't make sense please let me know, I am relatively new to VOF modeling.
  Reply With Quote

Old   August 18, 2010, 01:18
Smile UDF Defining VOF Free Surface at Outlet
  #6
ukg
New Member
 
Anshul
Join Date: Aug 2010
Posts: 1
Rep Power: 0
ukg is on a distinguished road
hi,

Alex did ur UDF worked?

Did u find any mistake in that?
I have a very similar problem....

Please let me know the solution of this?

Thanks in advance!
ukg is offline   Reply With Quote

Old   September 9, 2010, 12:46
Default wave outlet
  #7
New Member
 
Hermanus Henning
Join Date: Jun 2010
Posts: 6
Rep Power: 16
Hermanus Henning is on a distinguished road
ukg,
I'm simulating a ship oscillating vertically in water. The waves being generated by the hull need to travel through my 'far-boundaries' (I can't really call them far-wall boundaries) so I defined them as pressure outlets. In the edit BC (pressure outlet) tab in FLUENT, i set open-channel flow and specified the top and bottom of the initial water level. Maybe try that? It worked for me.
I hope it helps.
All the best
Kind regards
Hermanus Henning is offline   Reply With Quote

Old   September 14, 2010, 07:41
Default
  #8
Senior Member
 
Jouke de Baar
Join Date: Oct 2009
Posts: 127
Rep Power: 17
jack1980 is on a distinguished road
Hi, perhaps you can use this udf for a pressure outlet:

#include "udf.h"
DEFINE_PROFILE(static_pressure,thread,position)
{
real x[ND_ND];
real zcoor;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
zcoor = x[2];
F_PROFILE(f, thread, position) =-9.81*999*zcoor;
}
end_f_loop(f,thread)

}


See http://repository.tudelft.nl/view/ir...-36dea1f40918/ for a similar case
jack1980 is offline   Reply With Quote

Old   September 14, 2010, 09:54
Default Wave outlet
  #9
New Member
 
Hermanus Henning
Join Date: Jun 2010
Posts: 6
Rep Power: 16
Hermanus Henning is on a distinguished road
Hi Jouke,
Thank you for the suggestion.
I did try implementing a prescribed hydrostatic pressure profile like the one you posted, however I'm not convinced that this boundary condition (BC) will not affect the surface waves generated by my oscillating hull.

As far as I understand it, FLUENT's open channel BC tracks the free surface and then determines the hydrostatic pressure profile.

Please inform me if I'm misunderstanding these BCs.
Thank you for your help
Kind Regards
Hermanus Henning is offline   Reply With Quote

Old   September 14, 2010, 10:21
Default
  #10
Senior Member
 
Jouke de Baar
Join Date: Oct 2009
Posts: 127
Rep Power: 17
jack1980 is on a distinguished road
You're right, I didn't read your post very well ...

I am not familiar with the open channel settings, they might very well be a solution. I've always had inflow problems so didn't use it.

Another option you could consider is to have a numerical beach. This is where you have a fairly large domain, with very large cells at the edge. The large cells will act as a filter for the waves, in this way your grid will damp the waves at the edge of the domain. I'm not sure this will work, but it might be an option.
jack1980 is offline   Reply With Quote

Old   September 14, 2010, 10:34
Default wave BC
  #11
New Member
 
Hermanus Henning
Join Date: Jun 2010
Posts: 6
Rep Power: 16
Hermanus Henning is on a distinguished road
Thank you Jouke,
I've also considered beaches, but due to the large number of simulations that I need to run, I can't afford to implement large computational domains. A lot of people also run their simulations until the waves reach their far-wall boundaries, but this is way to computationally intensive for me
So that is why I'm experimenting with the open-channel pressure outlet BC, it looks promising... even though it also has its own limitations
If it doesn't work I'll try a numerical beach for sure.
Thanks again for your help
All the best
Hermanus Henning is offline   Reply With Quote

Old   February 20, 2012, 05:29
Default
  #12
New Member
 
Arshiya Hoseyni Chime
Join Date: Feb 2012
Posts: 11
Rep Power: 14
arshiya4 is on a distinguished road
Hi Alex and everybody else

I am working on the same problem. I was wondering if you wrote any UDF for the inlet velocity for your case? I figured that Fluent assigns a velocity to both water and air in the open channel free surface problem! But, I want the air to have no velocity! I know it has not much effects on the flow but, when I put a gate in my flow I face some trouble!

My advisor wants me to write a UDF to set a parabolic water flow from bottom to free surface and then set air velocity on top to zero! Did you end up doing anything like this? Here is my UDF...

#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);
}


Best regards
Arshiya
arshiya4 is offline   Reply With Quote

Old   March 29, 2012, 12:01
Question whats the meaning of sum in surface monitoring define for tracking water elevation?
  #13
New Member
 
rz
Join Date: Mar 2012
Posts: 25
Rep Power: 0
rezacfd1361 is on a distinguished road
what s the meaning of selecting sum in "define surface monitor" for "Phrases" , "volume fraction" . I have a 2 phase domain, primary phase is air and secondary phase is water. I am going to track surface changes for water, in internet i read that I have to select sum when i intoduce monitors/surface/surface monitors/define surface monitor.
my case is a Neumerical Wave Tank.
please help me.
rezacfd1361 is offline   Reply With Quote

Old   August 8, 2012, 16:50
Default
  #14
New Member
 
guoji xu
Join Date: Feb 2012
Posts: 19
Rep Power: 14
gxu2 is on a distinguished road
Quote:
Originally Posted by Alex
;151211
I am currently modeling the horizontal flow of water with a free surface and air above (using VOF model in FLUENT). My question relates to the outlet boundary condition. I am trying to define the pressure profile at the outlet. The idea was to loop over the cells at the exit while reading the volume fraction to determine the height of the free surface. With the height of the free surface I was going to define the pressure in the water with a linear relation to the hydrostatic pressure at the bottom of the domain. Hopefully this will allow for the free surface to shift up and down.

I have tried several techniques with my UDF but I keep recieving an (ACCESS VIOLATION). I have looked through the UDF manual quite a bit and don't understand where my problem is occuring. I have added my udf used below. If anyone has any idea how to do this, or can see my problem, please let me know.

/************************************************** ********************* Outlet pressure profile for multiphase flow with VOF ************************************************** **********************/

#include "udf.h"

DEFINE_PROFILE(pressure_profile,t,i)

{

real x[ND_ND], xx[2], pstat, density; real gravity, yholder, height, vof, pbot;

Domain *d; face_t f; cell_t cc; Thread *t; Thread *tt;

d=Get_Domain(1); pstat=0; density=998.2; gravity=9.81; yholder=1; height=6; vof=0; pbot= density*gravity*height;

thread_loop_c(cc,domain){

begin_c_loop(cc,tt){

vof = C_VOF(cc,tt);

C_CENTROID(x,cc,tt);

if (vof < 1)

{

if (x[0]>14.9)

{

if (x[1] >= yholder)

{yholder = x[1];}

}

}

}end_c_loop(cc,tt) }

begin_f_loop(f,t){

F_CENTROID(xx,f,t);

if (xx[1]>yholder)

{F_PROFILE(f,t,i) = pstat;}

if (xx[1]<=yholder)

{F_PROFILE(f,t,i) = pstat + pbot*(yholder-xx[1])/yholder;}

}end_f_loop(f,t)

}

I would appreciate any help, thank.

Alex

Hi, Alex, could you teach me how to get the wave surface at a setted section when the wave is propagating passing by this section.

Thanks in advance!
gxu2 is offline   Reply With Quote

Reply

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
Defining a surface from points or edges in CFXpost Gui CFX 9 July 26, 2007 15:12
Defining a surface from edges or points in CFXpost Gui CFX 0 July 25, 2007 16:03
free surface outlet novice Siemens 2 October 19, 2005 07:31
Defining Outlet conditions Luis CFX 0 April 4, 2005 20:36
Free surface pressure outlet nico FLUENT 0 November 9, 2004 15:29


All times are GMT -4. The time now is 00:56.