CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF of gradient-------please help (https://www.cfd-online.com/Forums/fluent/40306-udf-gradient-please-help.html)

Mech March 25, 2006 01:00

UDF of gradient-------please help
 
Hi I need a UDF to compute velocity gradient. In 2D case it is du/dy where u is the x component along the streamline and y is the distance normal to the wall. can anybody help me? I want to use this gradient value as the fluid velocity on the wall (slip condition). Thanks.

KP March 25, 2006 08:24

Re: UDF of gradient-------please help
 
DEFINE_ADJUST Function will let u do that. kp@dal.ca

Lucy March 27, 2006 09:18

Re: UDF of gradient-------please help
 
There are macros in UDF for you to access gradients such as C_DUDX(c,t),etc. I think you don't need to compute it yourself.

Mech March 27, 2006 21:33

Re: UDF of gradient-------please help
 
Hi I need the streamwise component of velocity gradient i.e. du/dy, where y is the normal vector on the wall. I'll use this value as the velocity on the wall (slip condition). I wrote the following UDF. But the solution diverges and does not give me the gradient.Can anybody do the required correction and send me? I'll be grateful to you. Mech

#include <udf.h> #include <mem.h>

DEFINE_PROFILE(top_wall_vel, t, i)

{

face_t f;

cell_t c0;

Thread *t0;

real g_u, val;

begin_f_loop(f,t)

{

c0=F_C0(f,t);

t0=t->t0;

g_u = - C_U_G(c0,t0)[1];

val = g_u;

F_PROFILE(f,t,i)=val;

}

end_f_loop(f,t) }



All times are GMT -4. The time now is 04:56.