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