

April 2, 2020 at 1:17 pmCameronLawSubscriber
Hi all, I've been trying to write a UDF in FLUENT that describes the figure of eight motion of hummingbird flight.
My idea has been to use these three equations that gives angles that cover 3 degrees of freedom, then divide these by time to get angular velocity. To do this I've used the CG_MOTION macro and used a rigid body dynamic mesh for the wing.
However this doesn't give anything resembling a figure of eight motion. In fact as time increases it is inevitable that the angular velocity will decrease quickly to effectively zero.
So my question is; do you think I'm using CG_MOTION correctly? Is this the best macro to create a figure of eight motion? And also is there anything in my logic here about how I'm getting angular velocity that is obviously wrong?
Here is my UDF:
#include "udf.h"
DEFINE_CG_MOTION(complex_wing, dt, vel, omega, time, dtime)
{
real pi, f, theta, phi_m, phi_0, alpha_m, alpha_0, phi_alpha, delta_m_1, delta_m_2, phi, alpha_star, delta;
pi = 3.14159265359;
f = 48 * (2 * pi); /* flapping frequency */
theta = 0 * (pi / 180); /* mean stroke plane angle */
phi_m = 90 * (pi / 180); /* sweep angle amplitude */
phi_0 = 0 * (pi / 180); /* sweep angle offset */
alpha_m = 0 * (pi / 180);/* inclination angle amplitude */
alpha_0 = 0 * (pi / 180);/* inclination angle offset */
phi_alpha = 10 * (pi / 180); /* inclination angle phase shift */
delta_m_1 = 0 * (pi / 180); /* deviation angle amplitude for oval trajectory*/
delta_m_2 = 30 * (pi / 180); /* deviation angle amplitude for figure of eight trajectory */
phi = phi_0 + (phi_m * cos(2 * pi * f * time)); /* sweep angle */
// alpha_star = alpha_0 + (((pi / 2)  alpha_m) * sin(2 * pi * f * (time  phi_alpha))); /* inclination angle, ignore for now */
delta = delta_m_2 * sin(4 * pi * f * time); /* deviation angle */
//omega[3] = alpha_star; // ignore this for now
omega[2] = delta;
omega[1] = phi;
}
Any advice you can give will be greatly appreciated thank you.
Kind regards,
Cameron

April 2, 2020 at 3:12 pmRobAnsys Employee
Have a think about the motion, and the maths. If time is always increasing you need to review how time or cos(time) interact with the rest of the equation(s).

April 2, 2020 at 3:45 pmDrAmineAnsys EmployeeAnd to add are you dividing with time intervall? It does not seem so.

April 2, 2020 at 4:36 pmCameronLawSubscriber
Thanks for the reply, just to clarify do you mean the timestep when you say time interval? As I've tried dividing by dtime instead but the resulting motion is wildly different depending on the size of the timestep I use. Giving huge angular velocities if my timestep is small.

April 2, 2020 at 5:08 pmDrAmineAnsys EmployeeOmega vector is angular speed and not the angle vector. Probably you need to derivate it from the equations you posted.

April 2, 2020 at 5:54 pmCameronLawSubscriber
I've been under the impression that dividing the angle by time at every timestep would give me the angular speed and that would inform the motion. Have I misunderstood how this macro or omega works?

April 6, 2020 at 5:09 pmCameronLawSubscriber
I thought I would update this as I recently solved it. Slightly embarrassing as it is a really simple oversight on my part.
My equations gave me angle as a function of time, so obviously by differentiating them I was able to get angular velocity as a function of time.
Also as I'm writing this I've also noticed that Amine literally gave me that answer but I misunderstood at the time, so apologies about that.

 You must be logged in to reply to this topic.
Simulation World 2022
Check out more than 70 different sessions now available on demand. Get inspired as you hear from visionary companies, leading researchers and educators from around the globe on a variety of topics from lifesaving improvements in healthcare, to bold new realities of space travel. Take a leap of certainty and check out a session today here.
Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.
Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
 Suppress Fluent to open with GUI while performing in journal file
 Heat transfer coefficient
 What are the differences between CFX and Fluent?
 Floating point exception in Fluent
 The solver failed with a nonzero exit code of : 2
 Getting graph and tabular data from result in workbench mechanical
 Difference between Kepsilon and Komega Turbulence Model
 Time Step Size and Courant Number
 Mesh Interfaces in ANSYS FLUENT
 error in cfd post

2006

1730

949

732

409
© 2022 Copyright ANSYS, Inc. All rights reserved.