CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   wall moving on the cylinder (http://www.cfd-online.com/Forums/fluent/102596-wall-moving-cylinder.html)

CKW May 29, 2012 12:55

wall moving on the cylinder
 
Dear all,
I write a velocity profile into the wall moving condition for cylinder rotate

but my UDF had something problem
the velocity vetor on the cylinder will be wrong in the quadrant 2(x<0,y>0)
my cylinder center point is (0,0)

Quote:

DEFINE_PROFILE(rotate_x, thread, index)
{

real x[ND_ND];
real y;
real k;
face_t f;
real t = RP_Get_Real("flow-time");

begin_f_loop(f, thread)
{

F_CENTROID(x,f,thread);
y=x[1];
k=x[0];
if(t<=1)
{
if(y*k<0)
{
F_PROFILE(f, thread, index) = (0.2)*sin(pi*t)*(k/NV_MAG(x));
}

else
{
F_PROFILE(f, thread, index) = (-0.2)*sin(pi*t)*(k/NV_MAG(x));
}

}

else
{
F_PROFILE(f, thread, index) = 0;
}
end_f_loop(f, thread)
}
}

DEFINE_PROFILE(rotate_y, thread, index)
{

real x[ND_ND];
real y;
real k;
face_t f;
real t = RP_Get_Real("flow-time");

begin_f_loop(f, thread)
{

F_CENTROID(x,f,thread);
y=x[1];
k=x[0];
if(t<=1)
{
if(k*y<0)
{
F_PROFILE(f, thread, index) = (-0.2)*sin(pi*t)*(y/NV_MAG(x));
}

else
{
F_PROFILE(f, thread, index) = (0.2)*sin(pi*t)*(y/NV_MAG(x));
}

}

else
{
F_PROFILE(f, thread, index) = 0;
}

end_f_loop(f, thread)
}
}

I don't know where is the problem in my code
thank everyone!!


All times are GMT -4. The time now is 00:40.