CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF for flapping of the aifoil

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 21, 2023, 14:42
Default UDF for flapping of the aifoil
  #1
New Member
 
CFD
Join Date: May 2022
Posts: 15
Rep Power: 4
satyamshk2 is on a distinguished road
Hello, I am trying to simulate the effet of trailing edge flap. I have created a udf based on cg motion but i am facing problems. The rotor has 4 zones, 3 zones each containing the trailing edge flaps for each blade (three blades) and one zone containing the remaining. I am rotating the main domain Zone1 with all the blades with sliding mesh method and all other zones are rotating relative to the first zone. So far no problems. Now as the domain with blades is rotating along z-axis (0,0,1), At the same time I want to flap the trailing edge with a function lets say sin theta degrees where theta is azimuthal. when the blade is between 0 and 180 degrees, i want the trailing edge to flap with function A and when 180 to 360, function B.
I m using the dynamic mesh method with a rigid body and the trailing edge is not deforming. initially, i am giving the cg points x and y as the point about which the trailing edge will flap for each blade and hooking the udf in the dynamic mesh.
Attached Images
File Type: jpg Domain.jpg (104.3 KB, 5 views)
File Type: jpg Blade.jpg (171.3 KB, 5 views)
satyamshk2 is offline   Reply With Quote

Old   June 21, 2023, 23:40
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
show UDF you are using
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   June 22, 2023, 05:13
Default
  #3
New Member
 
CFD
Join Date: May 2022
Posts: 15
Rep Power: 4
satyamshk2 is on a distinguished road
#include "udf.h"

DEFINE_CGMOTION(flapping_motion, dt, vel, omega, time, dtime)
{
Thread *t;
face_t f;
real flapping_amplitude = 1.0; // flapping amplitude

/* apply flapping motion */
thread_loop_c(t, dt)
{
begin_f_loop(f, t)
{
real NV_VEC(p), NV_VEC(axis_z);
real theta, flapping_motion;

/* flapping motion based on the azimuthal position */
C_CENTROID(p, f, t);
theta = atan2(p[1], p[0]);

if ((theta >= 0.0 && theta <= M_PI / 3.0) || (theta >= 5.0 * M_PI / 3.0 && theta <= 2.0 * M_PI))
flapping_motion = flapping_amplitude * sin(3.0 * theta);
else if (theta >= M_PI / 3.0 && theta <= 5.0 * M_PI / 3.0)
flapping_motion = -flapping_amplitude * sin(3.0 * theta);
else
flapping_motion = 0.0;

/* Define the blade axis */
NV_D(axis_z, =, 1.0);

/* Apply the flapping motion to the face motion */
NV_S(domega, =, 0.0);
NV_S(vel, =, 0.0);
NV_S(omega, =, flapping_motion * axis_z);
}
end_f_loop(f, t)
}
}
satyamshk2 is offline   Reply With Quote

Old   June 22, 2023, 23:34
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
compile code
Code:
#include "udf.h"



DEFINE_CG_MOTION(flapping_motion, dt, vel, omega, time, dtime)
{
Thread *t;
face_t f;
real flapping_amplitude = 1.0; // flapping amplitude

/* apply flapping motion */
if (!Data_Valid_P())
return;
/* get the thread pointer for which this motion is defined */
t = DT_THREAD(dt);

begin_f_loop(f, t)
{
real NV_VEC(p), NV_VEC(axis_z);
real theta, flapping_motion;

/* flapping motion based on the azimuthal position */
F_CENTROID(p, f, t);
theta = atan2(p[1], p[0]);

if ((theta >= 0.0 && theta <= M_PI / 3.0) || (theta >= 5.0 * M_PI / 3.0 && theta <= 2.0 * M_PI))
flapping_motion = flapping_amplitude * sin(3.0 * theta);
else if (theta >= M_PI / 3.0 && theta <= 5.0 * M_PI / 3.0)
flapping_motion = -flapping_amplitude * sin(3.0 * theta);
else
flapping_motion = 0.0;

/* Define the blade axis */
NV_D(axis_z, =, 0.0, 0.0, 1.0);

/* Apply the flapping motion to the face motion */
NV_S(omega, =, 0.0);
NV_S(vel, =, 0.0);
omega = axis_z;
NV_S(omega, *=, flapping_motion);
}
end_f_loop(f, t)

}
satyamshk2 likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   June 24, 2023, 16:36
Default
  #5
New Member
 
CFD
Join Date: May 2022
Posts: 15
Rep Power: 4
satyamshk2 is on a distinguished road
The provided udf is not showing any error but the trailing edge is also not moving.
It is showing this warning of no motion
Warning: incorrect cg motion UDF flapping_airfoil on zone 27 (assuming no motion)

In my case, the center of the flap is different than the center of the flapping zone as can be seen in the picture. In the dynamic mesh zone, I am giving that flap center(not flapping zone center) initially as cg location. The flap center is the small flap leading edge circle's center.
so I have added
theta_offset = atan2(0.37076, 0.6641); // Initial angle offset, x and y of the flap centroid
theta = atan2(p[1], p[0]) - theta_offset;


What mistake am I doing?
even if the udf is taking a different center, I should see the zone motion, which I can not.
Also, flapping the trailing edge about its centroid will not give correct value of the flapping center. In the dynamic mesh zone, i am using flap as rigid body so no connection with the flapping zone. I think, i should find the centroid of that flap and its offset from the rotation centre and then calculate azimuthal angle as per the the coordinates.


I was trying another udf to rotate the trailing edge by a fixed angle when it passes through 181 degrees azimuthal.
In this udf, i am calculating the azimuthal from time as i know the time-step.
#include "udf.h"
#include <math.h>

#define rotation_angle 2.0*M_PI/180 /* Desired rotation angle in degrees */
#define time_conversion_factor 0.00165835760852502 /* Conversion factor from time step to degrees */

DEFINE_CG_MOTION(case2d, dt, vel, omega, time, dtime)
{
real alpha_dot, angle;


angle = fmod((time / time_conversion_factor) * 5, 360); /* Calculate the angle using the time and conversion factor 5degree is the time step size */

if (angle > 180.0 && angle < 360.0)
{
if (angle == 181.0)

alpha_dot = (rotation_angle / dtime ); /* Rotate the complete angle in one time step */

else

alpha_dot = 0.0;

}
else
{
alpha_dot = 0.0;
}

omega[0] = 0.0;
omega[1] = 0.0;
omega[2] = alpha_dot;
}
The same problem. None of the above are working.
Thanks
Attached Images
File Type: jpg Flap center.JPG (57.5 KB, 3 views)

Last edited by satyamshk2; June 26, 2023 at 05:14. Reason: attachment
satyamshk2 is offline   Reply With Quote

Reply

Tags
dynamic mesh zones, sliding interface, udf cg motion, wind turbine blade


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
udf for one dimensional linear motion based on force maccheese Fluent UDF and Scheme Programming 2 September 1, 2019 03:18
Save output of udf in another udf! JuanJoMex FLUENT 0 February 8, 2018 13:43
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 01:53
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 01:52.