|
[Sponsors] |
|
July 21, 2010, 11:21 |
How can I twist a surface with UDF? -solved-
|
#1 |
Senior Member
Herman
Join Date: Nov 2009
Posts: 122
Rep Power: 16 |
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! Last edited by enry; July 21, 2010 at 16:57. |
|
July 21, 2010, 16:57 |
|
#2 |
Senior Member
Herman
Join Date: Nov 2009
Posts: 122
Rep Power: 16 |
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); } Last edited by enry; July 21, 2010 at 17:21. |
|
September 16, 2010, 13:40 |
|
#3 |
New Member
Taher
Join Date: Jun 2009
Posts: 1
Rep Power: 0 |
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..
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
need help regarding error in surface rxn UDF | Ashish Jain | FLUENT | 0 | May 16, 2005 10:43 |
need help regarding surface reaction UDF | Ashish Jain | FLUENT | 0 | May 11, 2005 14:31 |
solid edge problem....can you help? | cindy | Main CFD Forum | 3 | April 5, 2004 13:43 |
Patran Volume Meshing | Deb | CFX | 19 | April 17, 2003 10:56 |
free convection heat transfer from a heated horizontal surface through a liquid to a thin cooled fin | Kaushik | FLUENT | 1 | May 8, 2000 06:47 |