初学,请高手指点关于UDF的
<P>fluent中一个圆平面的动载荷,圆周固定,平面做余弦曲面周期振动(圆心为顶点),下面这个C程序不能通过编译,请高手指点一下。<BR>#include "udf.h"<BR>#include "math.h"<BR>DEFINE_GRID_MOTION(membrane_moving, domain, dt, time, dtime)<BR>{<BR>Thread *tf=DT_THREAD(dt);<BR>face_t f;<BR>Node *v;<BR>real NV_VEC(axis);<BR>real NV_VEC(origin);/* NV_VEC(rvec);*/<BR>real sign, x, a, y, c,signx; <BR>int n;<BR>float d=0.0008, fre=50; /* maxim deformation through all timesteps and frequency */<BR></P><P> /*Message("magnitude is: %g\n", sign);<BR> Message("magnitude of center is: %g\n",r);<BR>Message("radius is: %g\n",a); */<BR>/*NV_D(axis, =, 1.0, 1.0, 0.0); */ <BR>/*NV_D(origin, =, 0.0, 0.0,0.0);*/ <BR> <BR>begin_f_loop(f,tf)<BR> {<BR> f_node_loop(f, tf, n)<BR> {<BR> v=F_NODE(f, tf, n); /* check nodes */<BR> c=NODE_X(v); <BR> y=NODE_Y(v); <BR> if(NODE_POS_NEED_UPDATE(v))/* ensure each node only be used once */<BR> { <BR> NODE_POS_UPDATED(v); <BR> signx=d*cos(sqrt(c*c+y*y));<BR> x=NODE_X (v); <BR> x=NODE_Y (v);<BR> x=signx*sin(2*3.1415926*fre*time);<BR> /* NV_VV(rvec, =, x, -, origin); */ <BR> <BR> NV_V(NODE_COORD(v), =, x); /* return new position to node */<BR> /* Message("Node-coordinate x: %g\n", c);<BR> Message("Node-coordinate y: %g\n", x);*/<BR> } <BR> }<BR> }<BR>end_f_loop(f,tf);<BR>}</P>
页:
[1]