# UDF Using New Coordinates Instead of Original

 Register Blogs Members List Search Today's Posts Mark Forums Read

 October 25, 2021, 20:25 UDF Using New Coordinates Instead of Original #1 New Member   Thomas Sprengeler Join Date: Oct 2020 Posts: 3 Rep Power: 5 Hi All, Below is my UDF that I have been working on for rotating the points of an airfoil. This code works in my previous application where I calculated a new Y value based on X, but now I just want to read the x and y coordinates, rotate them, then output the rotated coordinates. This code works but it is calculated each time step based on the previously rotated points instead of the original baseline coordinates thus creating too much rotation of the coordinates. Can anyone help so that it always reads the original x and y coordinates? Thanks, Thomas #include "udf.h" #define FTT 0.4 #define chord 1.00000 /*upper surface*/ DEFINE_GRID_MOTION(Up, domain, dt, time, dtime) { Thread *tf = DT_THREAD (dt); face_t f; Node *node_p; real x,y,theta,x_s,y_s,T_max,Tmorph,freq,omega,xuc,yuc, Rux,Ruy,rcux,rcuy; int n; freq = 0.2; omega = 2 * M_PI * freq; Tmorph= 0.0555555794; T_max = FTT+Tmorph; x_s = 0.25*chord; y_s = 0; SET_DEFORMING_THREAD_FLAG (THREAD_T0 (tf)); begin_f_loop (f, tf) { f_node_loop (f, tf, n) { node_p = F_NODE(f, tf, n); x = NODE_X(node_p); y = NODE_Y(node_p); if (NODE_POS_NEED_UPDATE (node_p)) { NODE_POS_UPDATED (node_p); if ( x < x_s) { if ( CURRENT_TIME >= FTT && CURRENT_TIME <= T_max) { theta = omega * (CURRENT_TIME - FTT); xuc = x - x_s; yuc = y - y_s; Rux = ((xuc * cos(-theta)) + (yuc * sin(-theta))); Ruy = ((xuc * -sin(-theta)) + (yuc * cos(-theta))); rcux = Rux + x_s; rcuy = Ruy + y_s; NODE_Y (node_p) = rcuy ; } /*morphing stops*/ if ( CURRENT_TIME > T_max) { theta = omega * Tmorph; xuc = x - x_s; yuc = y - y_s; Rux = ((xuc * cos(-theta)) + (yuc * sin(-theta))); Ruy = ((xuc * -sin(-theta)) + (yuc * cos(-theta))); rcux = Rux + x_s; rcuy = Ruy + y_s; NODE_Y (node_p) = rcuy; } } } end_f_loop (f, tf); } } }

 Tags airfoil, ansys, fluent, fluent udf, udf