CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF for slip and moving wall (http://www.cfd-online.com/Forums/fluent/36724-udf-slip-moving-wall.html)

lichun Dong May 20, 2005 11:25

UDF for slip and moving wall
 
Dear all:

I am trying to put a slip and moving boundary condition at the wall. so I write a UDF as the followed. But the FLUENT said there is a fatal problem "Segmentation violation". I select moving wall and non-slip at Fluent, maybe that is the reason? But if I select slip wall, I can not specify the wall velocity. Anybody has some experience to put a slip moving wall boundary? please give some suggestion.

Thanks a lot

#include "udf.h" DEFINE_PROFILE(wall_velocity,t,i) { face_t f; cell_t c; real cellnumber = 0; /*the number of the cells on the boundary*/ real A = 0.002; /*the amplitude of the oscillation*/ real omega = 100; /*the frequency of the oscillation*/ real dudy; /*the y derivative of the horizontal velocity*/ real sumdudy = 0; /*the sum of the velocity derivative*/ real avgdudy; /*the average of the velocity derivative*/ real beta = 0.2; /*the slippy coefficient*/ Thread *tc;

tc = THREAD_T0(t);

if (NULL != C_DUDY(c,tc)) {

begin_c_loop(c,tc)

{

cellnumber = cellnumber + 1;

dudy = C_DUDY(c,tc);

sumdudy = sumdudy + dudy;

}

end_c_loop(c,tc)

avgdudy = sumdudy/cellnumber;

begin_f_loop(f,t)

{

real tempt = RP_Get_Real("flow-time");

F_PROFILE(f,t,i) = omega*A*cos(omega*tempt) - beta*avgdudy;

}

end_f_loop(f,t)

} else {

begin_f_loop(f,t)

{

real tempt = RP_Get_Real("flow-time");

F_PROFILE(f,t,i) = omega*A*cos(omega*tempt) - beta*avgdudy;

}

end_f_loop(f,t) } }

lichun Dong May 21, 2005 21:55

How to access variables in Fluent
 
Dear all:

This seems a hard question. I checked that once I try to access the variables, the "Segmentation violation" appears. So what is the trick to access the varibles in Fluent?

I attached my UDF again. #include "udf.h"

DEFINE_PROFILE(wall_velocity, t, i)

{

face_t f;

cell_t c;

real cellnumber = 0; /*the number of the cells on the boundary*/

real A; /*the amplitude of the oscillation*/

real omega; /*the frequency of the oscillation*/

real dudy; /*the y derivative of the horizontal velocity */

real sumdudy = 0; /*the sum of the velocity derivative */

real avgdudy; /*the average of the velocity derivative */

real beta; /*the slippry coeeficient*/

if (NULL != C_DUDY(c,t))

{

begin_c_loop(c, t)

{

cellnumber++;

dudy = C_DUDY(c,t);

sumdudy =+ dudy;

}

end_f_loop(f,t);

avgdudy = sumdudy/cellnumber;

begin_f_loop(f, t)

{

real t = RP_Get_Real("flow-time");

F_PROFILE(f,t,i) = omega*A*cos(omega*t) - beta*avgdudy;

}

end_f_loop(f,t);

}

else

{

begin_f_loop(f, t)

{

real t = RP_Get_Real("flow-time");

F_PROFILE(f,t,i) = omega*A*cos(omega*t);

}

end_f_loop(f,t);

}

}

ramesh May 30, 2005 14:24

Re: UDF for slip and moving wall
 
Hi, DEFINE_PROFILE takes input the boundary face not the cell. So when u are running a loop on the faces u cant access the particular cell directly. Because the thread for face is different from thread for cells. If u want to access the cell of the partciular boundary face use F_C0(f,tf). I hope this should solve the problem

elaf_2003 March 26, 2014 05:37

moving wall slip
 
Hi all
I was wondering if any body can help me?
I am using flow around cylinder, the shear stresses at the wall need to be specified to constant value. In this option, there are 3 components for the shear stresses, i.e. x direction components and so on.

Does anyone know for example how can set these values for cylinder surface
Regard.


All times are GMT -4. The time now is 15:39.