How can I twist a surface with UDF? -solved-
Hi all,
I have to twist a surface through mesh-motion. How can I do that? How should I write the UDF? Please help me... Thanks in advace! |
I solved the problem, with define_grid_motion.
If somebody is interested, here is the UDF. #include"udf.h" DEFINE_GRID_MOTION(twist,domain,dt,time,dtime) { Thread *tf = DT_THREAD(dt); face_t f; Node *v; real NV_VEC(axis); real delta,xaxis,yaxis,teta,xn,yn,dx,dy,H; int n; H = 0.1; /*z-dimension of the model*/ teta = 10*3.14/180; /*rotation angle*/ begin_f_loop(f,tf) { f_node_loop(f,tf,n) { v = F_NODE(f,tf,n); /* update node if the current node has not been previously visited when looping through previous faces */ if ( NODE_POS_NEED_UPDATE (v)) { /* indicate that node position has been update so that it's not updated more than once */ NODE_POS_UPDATED(v); xn = cos(teta)*NODE_X(v)-sin(teta)*NODE_Y(v); yn = sin(teta)*NODE_X(v)+cos(teta)*NODE_Y(v); dx = xn-NODE_X(v); dy = yn-NODE_Y(v); xaxis = dx/sqrt(pow(dx,2) + pow(dy,2)); yaxis = dy/sqrt(pow(dx,2) + pow(dy,2)); NV_D(axis, =, xaxis,yaxis, 0.0); delta = sqrt(pow(dx,2) + pow(dy,2))*NODE_Z(v)/H; NV_V_VS(NODE_COORD(v), =, NODE_COORD(v), +, axis,*,delta); } } } end_f_loop(f,tf); } |
Hey guys.. I need to move a 2D airfoil through certain angle of attack.. now if I dont want to use CG_Motion.. do you think I can do it through GRID_MOTION.. Like may be threading all the nodes across surface and moving them all..
|
All times are GMT -4. The time now is 11:31. |