# 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: 4 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 Thread Tools Search this Thread Show Printable Version Email this Page Search this Thread: Advanced Search Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules Similar Threads Thread Thread Starter Forum Replies Last Post lvanlee FLUENT 4 December 20, 2021 06:55 SJSW Fluent UDF and Scheme Programming 11 October 10, 2018 22:28 Coop Fluent UDF and Scheme Programming 0 July 13, 2018 08:33 djing Fluent UDF and Scheme Programming 1 December 5, 2016 03:11 donmezayd Fluent UDF and Scheme Programming 0 April 19, 2012 03:14

All times are GMT -4. The time now is 13:28.