CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF for Navier slip condition (https://www.cfd-online.com/Forums/fluent-udf/234382-udf-navier-slip-condition.html)

polopol March 4, 2021 09:56

UDF for Navier slip condition
 
hello
I'm looking for an UDF to implement the Navier slip condition on Fluent. I would like to enter the slip length at the top of the UDF.


For the moment I've been working with the following UDF and selected the functions in Specified Shear. Unfortunately changing the slip length changes nothing in the results.
I've been working on a Poiseuille flow at low Reynolds (laminar) to see if the results were correct.



#include "udf.h"
/*
===============================================
Velocity slip at wall boundaries
separate routines for every velocity coordinate
UDF can be interpreted
at least 2 user-defined memories (UDM) need to be allocated first!
===============================================
*/
// wall slip layer thickness [m]
#define DELTA 10.0e-6
// under-relaxation factor for tangential wall velocity
#define RELAX_CT 0.1

DEFINE_PROFILE(slip_velocity_x,f_thread,index)
{
face_t face;
cell_t cell;
Thread *c_thread;
real u, v;
real ct, cx;
real gamma;
int i;
begin_f_loop(face,f_thread) // for each face: get face-id and thread
{
cell=F_C0(face,f_thread); // get corresponding cell
c_thread=THREAD_T0(f_thread); // get cell thread
u = C_U(cell,c_thread); // F_U(face,f_thread); // get cell center velocity u
v = C_V(cell,c_thread); // F_V(face,f_thread); // get cell center velocity v
gamma = C_STRAIN_RATE_MAG(cell,c_thread); // get strain rate (equivalent to du/dn at wall)

ct = (1-RELAX_CT)*F_UDMI(face,f_thread,0)+RELAX_CT*DELTA*g amma; // calculate tangential velocity (with under-relaxation using previous calculation step)
F_UDMI(face,f_thread,0)=ct; //store in user-defined face memory (id=0) for next calculation

cx = ct*u/sqrt(u*u+v*v); // component of ct in x-direction
F_PROFILE(face,f_thread,index) = cx; // assign to profile
}
end_f_loop(face,f_thread)
}
DEFINE_PROFILE(slip_velocity_y,f_thread,index)
{
face_t face;
cell_t cell;
Thread *c_thread;
real u, v;
real ct, cy;
real gamma;
begin_f_loop(face,f_thread)
{
cell=F_C0(face,f_thread); // get cell
c_thread=THREAD_T0(f_thread); // get cell thread
u = C_U(cell,c_thread); // F_U(face,f_thread);
v = C_V(cell,c_thread); // F_V(face,f_thread);
gamma = C_STRAIN_RATE_MAG(cell,c_thread);

ct = (1-RELAX_CT)*F_UDMI(face,f_thread,1)+RELAX_CT*DELTA*g amma;
F_UDMI(face,f_thread,1)=ct;

cy = ct*v/sqrt(u*u+v*v);
F_PROFILE(face,f_thread,index) = cy;
}
end_f_loop(face,f_thread)
}

pakk March 4, 2021 10:24

You might have very good reasons to implement your own version, but I should mention it nevertheless : velocity slip is standard implemented in Fluent, you don't need a UDF, just enable low-pressure boundary slip.

I don't have an answer to the problem in your post.


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