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 dynamic mesh problem (https://www.cfd-online.com/Forums/fluent-udf/110797-udf-dynamic-mesh-problem.html)

gaozhengyu December 21, 2012 03:46

UDF dynamic mesh problem
 
3 Attachment(s)
These 2 udf codes are both for the model I uploaded(one for membrane one for axis), and the membrane oscillated successfully.

The problem is the stretching of the axis.I want the point of the axis at (0,0) fixed. How should I do?

gaozhengyu December 27, 2012 02:18

I have solved the problem, the code is changed as below.
And the model is not the one I uploaded before so the number in the code is different.


DEFINE_GRID_MOTION(oscilliation,domain,dt,time,dti me)
{
#if PARALLEL

Thread *tf = DT_THREAD(dt);
face_t f;
Node *v;
real NV_VEC(vel);
real NV_VEC(del);

real xx;
real yy;
real width;
real period;

int n;
/* set deforming flag on adjacent cell zone */
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));
//Message ("time = %f, omega = %f\n", time, sign);

NV_D(vel, =, 0.0,0.0,0.0);

width = 0.095776 / 2.0;
period = 0.05;


begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
v = F_NODE(f,tf,n);

xx = NODE_X(v);

if(xx>0.058)

{

if (NODE_POS_NEED_UPDATE (v))
{

NODE_POS_UPDATED(v);

yy = (NODE_Y(v)) / width;

vel[1] = 0;
vel[0] = - 2 * 3.14159 / period * 0.005 * (1 - pow(yy,2)) * cos(2 * 3.14159 / period * time);

NV_VS(del,=,vel,*,dtime);
NV_VV(NODE_COORD(v),=,NODE_COORD(v),+,del);
}
}
}
}
end_f_loop(f,tf);
#endif
}


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