- **FLUENT**
(*https://www.cfd-online.com/Forums/fluent/*)

- - **UDF for BCs in VOF model**
(*https://www.cfd-online.com/Forums/fluent/92926-udf-bcs-vof-model.html*)

UDF for BCs in VOF modelHi 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! |

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 |

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. |

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! |

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 |

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