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

UDF for BCs in VOF model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 29, 2011, 08:46
Default UDF for BCs in VOF model
  #1
New Member
 
Join Date: Apr 2010
Posts: 5
Rep Power: 16
CLINT_E is on a distinguished road
Hi all,

I am having difficulties in finding a way to write down a specific UDF for a boundary in VOF model and I hope someone could give an hint.

Let us consider a cube (phase 1): inlet, outlet and symmetry on all other faces. Now I introduce a second phase by udf on one of the symmetry faces, say a 2D ellipse.

I would like to "fix" the 2D second phase on its plane, say imposing a local no-slip condition only for the 2nd phase while keeping symmetry on the rest of the face. Any idea on how to do it?

Up to now, my ideas:

1. Use DEFINE_PROFILE on the face, no possibility to hook UDF to symmetry;
2. Substitute symmetry with wall, DEFINE_PROFILE to set zero shear outside the 2nd pahse -> no way;
3. Use DEFINE_ADJUST to set zero velocity to the 2nd phase only -> this would be called at each iteration (looks to me not worth) and not sure about the results.

Any suggestion would be greatly appreciated, cheers!
CLINT_E is offline   Reply With Quote

Old   September 29, 2011, 16:53
Default
  #2
Senior Member
 
Mohammad
Join Date: Feb 2010
Location: Shiraz, Iran
Posts: 108
Rep Power: 16
m2montazari is on a distinguished road
hi clint,
I think your second option is a good choice. you can specify any shear profile in udf. for example if you want to have no slip outside of an ellipse and slip inside of it, simply write an if condition inside loop and set it. if I'm wrong or I didnt understood the problem well, tell me more!
yours,
mohammad
m2montazari is offline   Reply With Quote

Old   October 3, 2011, 07:58
Default
  #3
New Member
 
Join Date: Apr 2010
Posts: 5
Rep Power: 16
CLINT_E is on a distinguished road
my UDF:

#include "udf.h"

DEFINE_PROFILE(zonal_shear, thread, position)

{
int phase_domain_index; /* integer variable declared globally, corresponding to domain index */
face_t f;
cell_t cell; /* declare cell as a cell_t (cell index)*/
Thread *cell_thread; /* declaration of pointer to cell thread */
Domain *mixture_domain;
Domain *subdomain; /* declaration of pointer to subdomain */
real xc[ND_ND]; /* declaration of position vector with free dimension -> up to FLUENT */

mixture_domain = Get_Domain(1);

/* loop over all subdomains (phases) in the domain (mixture) */
sub_domain_loop(subdomain, mixture_domain, phase_domain_index)
{
/* loop if secondary phase */
if (DOMAIN_ID(subdomain) == 3) /* 3 is the ID of the domain of the 2nd phase /*

/* loop over all cell threads in the secondary phase domain */
thread_loop_c(cell_thread,subdomain)
{
begin_f_loop(f,thread)
{
F_CENTROID(xc, f, thread);
if (pow(xc[0],2) + pow(xc[1],2) > pow(0.1e-3,2)) /* if outside the circle */
F_PROFILE(f, thread, position) = 0.0;
}
end_f_loop(f, thread)
}
}
}

your udf should be sth like this:
#include "udf.h"
DEFINE_PROFILE(myname,t,i)
{
face_t f;
real x[ND_ND];
begin_f_loop(f,t)
{
if (F_VOF(f,t)=3) // the phase number you want
{
F_CENTROID(x,f,t);
if (pow(xc[0],2) + pow(xc[1],2) > pow(0.1e-3,2))
F_PROFILE(f,t,i)=0.0;
}
else
F_PROFILE(f,t,i)= /*.... something for shear inside the ellipse and for other phases*/
}
end_f_loop(f,t)
}

-----------------------------------------------

from m2montazari

your udf should be sth like this:
#include "udf.h"
DEFINE_PROFILE(myname,t,i)
{
face_t f;
real x[ND_ND];
begin_f_loop(f,t)
{
if (F_VOF(f,t)=3) // the phase number you want
{
F_CENTROID(x,f,t);
if (pow(xc[0],2) + pow(xc[1],2) > pow(0.1e-3,2))
F_PROFILE(f,t,i)=0.0;
}
else
F_PROFILE(f,t,i)= /*.... something for shear inside the ellipse and for other phases*/
}
end_f_loop(f,t)
}

-------------------------------------------------------

from clint_e

Thanks for your help mohammad, I am now trying to run this UDF after the one I use to initialise the second phase. I am going to run both as compiled, because as interpreted I always receive the following error "Error: chip-exec: function "VOF_init" not found", even though I have already run VOF_init and initialised the solution.
CLINT_E is offline   Reply With Quote

Old   October 5, 2011, 03:44
Default
  #4
New Member
 
Join Date: Apr 2010
Posts: 5
Rep Power: 16
CLINT_E is on a distinguished road
mohammad, thanks for your help, but I am still stuck with this problem as I am getting ACCESS VIOLATION with this UDF.

#include "udf.h"
DEFINE_PROFILE(myname,t,i)
{
face_t f;
real xc[ND_ND];
begin_f_loop(f,t)
{
if (F_VOF(f,t)==0) // here is VOF -> zero to 1
{
F_CENTROID(xc,f,t);
if (pow(xc[0],2) + pow(xc[1],2) > pow(0.1e-3,2)) /*primary phase, say air*/
F_PROFILE(f,t,i)=0.0; /*this achieves symmetry*/
}
else
F_PROFILE(f,t,i)= /*inside the circle I want no-slip for secondary phase, say water -> how to impose it? infinite shear??*/
}
end_f_loop(f,t)
}

I think the solver gives access error cos it doesn't know what phase to consider (F_VOF is defined for both phases an is complementary). I don't know if I have to refer to the mixture or specifically to each phase.

Please anyone can help with this? Thanks!
CLINT_E is offline   Reply With Quote

Old   October 5, 2011, 15:54
Default
  #5
Senior Member
 
Mohammad
Join Date: Feb 2010
Location: Shiraz, Iran
Posts: 108
Rep Power: 16
m2montazari is on a distinguished road
hi,
for no slip condition you can simply use the main formula for it: miu*du/dy
just define cell and use c_u and it would be delta u for u=0 on wall. then having cell size(or using some macro to extract it in udf) tau=miu*c_u/(cell size /2)
and about f_vof, I think it returns the phase no. for example 0 means primary phase and 1 means secondary phase. so you can separate phases using it.
finally about access violation, I dont have any idea now!! just recheck it and try to debug if it return error in compiling process(or interpreting process).
yours,
mohammad
m2montazari is offline   Reply With Quote

Reply

Tags
boundary conditions, symmetry, udf, vof


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
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 06:36
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32
UDF, Herschel-Bulkely model don't have Yielding viscosity term emad Fluent UDF and Scheme Programming 0 May 19, 2009 13:46
writing UDF for modelig mass transfer for VOF ardalan soleymani FLUENT 0 July 11, 2007 02:09
UDF of Zimont model in fluent Z Main CFD Forum 0 February 17, 2005 04:07


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