|
[Sponsors] |
UDF Using New Coordinates Instead of Original |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 25, 2021, 21:25 |
UDF Using New Coordinates Instead of Original
|
#1 |
New Member
Thomas Sprengeler
Join Date: Oct 2020
Posts: 3
Rep Power: 6 |
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 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to use UDF to get a grid cell centroid coordinates? | lvanlee | FLUENT | 4 | December 20, 2021 07:55 |
does Hyperthreading affect the application of UDF? | SJSW | Fluent UDF and Scheme Programming | 11 | October 10, 2018 23:28 |
Error code: 126 when loading parallel UDF | Coop | Fluent UDF and Scheme Programming | 0 | July 13, 2018 09:33 |
How to give the coordinates of the centroid of a parabolic profil in UDF | djing | Fluent UDF and Scheme Programming | 1 | December 5, 2016 04:11 |
UDF in Cylindrical Coordinates | donmezayd | Fluent UDF and Scheme Programming | 0 | April 19, 2012 04:14 |