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 Defining VOF Free Surface at Outlet (http://www.cfd-online.com/Forums/fluent-udf/48391-udf-defining-vof-free-surface-outlet.html)

Alex June 2, 2008 14:01

UDF Defining VOF Free Surface at Outlet
 
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

Victor June 6, 2008 06:56

Re: UDF Defining VOF Free Surface at Outlet
 
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

Alex June 6, 2008 11:14

Re: UDF Defining VOF Free Surface at Outlet
 
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.

Victor June 6, 2008 11:34

Re: UDF Defining VOF Free Surface at Outlet
 
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.

Alex June 6, 2008 12:48

Re: UDF Defining VOF Free Surface at Outlet
 
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.

ukg August 18, 2010 01:18

UDF Defining VOF Free Surface at Outlet
 
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!

Hermanus Henning September 9, 2010 12:46

wave outlet
 
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

jack1980 September 14, 2010 07:41

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

Hermanus Henning September 14, 2010 09:54

Wave outlet
 
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

jack1980 September 14, 2010 10:21

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.

Hermanus Henning September 14, 2010 10:34

wave BC
 
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

arshiya4 February 20, 2012 06:29

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

rezacfd1361 March 29, 2012 12:01

whats the meaning of sum in surface monitoring define for tracking water elevation?
 
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.:confused:
please help me.:confused::confused:

gxu2 August 8, 2012 16:50

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!


All times are GMT -4. The time now is 23:01.