
[Sponsors] 
September 29, 2011, 07:46 
UDF for BCs in VOF model

#1 
New Member
Join Date: Apr 2010
Posts: 5
Rep Power: 9 
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 noslip 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! 

September 29, 2011, 15:53 

#2 
Senior Member
Mohammad
Join Date: Feb 2010
Location: Shiraz, Iran
Posts: 109
Rep Power: 9 
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 

October 3, 2011, 06:58 

#3 
New Member
Join Date: Apr 2010
Posts: 5
Rep Power: 9 
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.1e3,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.1e3,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.1e3,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: chipexec: function "VOF_init" not found", even though I have already run VOF_init and initialised the solution. 

October 5, 2011, 02:44 

#4 
New Member
Join Date: Apr 2010
Posts: 5
Rep Power: 9 
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.1e3,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 noslip 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! 

October 5, 2011, 14:54 

#5 
Senior Member
Mohammad
Join Date: Feb 2010
Location: Shiraz, Iran
Posts: 109
Rep Power: 9 
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 

Tags 
boundary conditions, symmetry, udf, vof 
Thread Tools  
Display Modes  


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, HerschelBulkely model don't have Yielding viscosity term  emad  Fluent UDF and Scheme Programming  0  May 19, 2009 12:46 
writing UDF for modelig mass transfer for VOF  ardalan soleymani  FLUENT  0  July 11, 2007 01:09 
UDF of Zimont model in fluent  Z  Main CFD Forum  0  February 17, 2005 04:07 