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

DEFINE_CG_MOTION for flapping wing UDF

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 14, 2011, 08:51
Exclamation DEFINE_CG_MOTION for flapping wing UDF
  #1
New Member
 
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 14
xyzch001 is on a distinguished road
Hi everybody!
I'm a graduate student of mechanical engineering working at a Fluent project for my thesys. I have to write a UDF in order to give a motion law to a flapping wing. By using the UDF "DEFINE_CG_MOTION" I need to specify an angular velocity d(theta)/dt so that the oscillation angle of the flapping wing is: theta(t)=25*sin(2*pi*frequency*t+arcsin(3/5))-15
If I use the derivate d(theta)/dt=50*frequency*pi*cos(2*pi*frequency*t+arcsin(3/5)) I lose the constant "-15" so that the oscillation angle is no more from +10 deg to -40 deg. As a matter of fact the positive peak amplitude must be +10 deg and the negative one must be -40 deg.
How can I solve the problem?
Thank you so much!
xyzch001 is offline   Reply With Quote

Old   December 15, 2011, 03:47
Default
  #2
Senior Member
 
Pay D.
Join Date: Aug 2011
Posts: 166
Blog Entries: 1
Rep Power: 14
pdp.aero is on a distinguished road
Hello xyh001
one point about the writing udf that i remember and i think you should be contain it, its your argument must be in radian!
sorry i don't understood clearly your problem.
i hope its be useful.
pdp.aero is offline   Reply With Quote

Old   December 15, 2011, 08:38
Default
  #3
New Member
 
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 14
xyzch001 is on a distinguished road
Hi pdp.aero! Thank you for your answer! Yes I already know that the argument must be in radian...I wrote the previous formula in degrees for convenience. That is not a problem...The problem is to find a trigonometric function that after being derived, gives me the desired theta(t).
xyzch001 is offline   Reply With Quote

Old   December 15, 2011, 09:04
Default
  #4
Senior Member
 
Pay D.
Join Date: Aug 2011
Posts: 166
Blog Entries: 1
Rep Power: 14
pdp.aero is on a distinguished road
sorry i asked this questions , i curious about your problem!
and what's the problem with those function that you mention for theta(t) and d(theta)/dt...?
in every time-step you have t ,so you can calculate the theta and the angular velocity with those formula.
pdp.aero is offline   Reply With Quote

Old   December 15, 2011, 09:28
Default
  #5
New Member
 
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 14
xyzch001 is on a distinguished road
The problem is that when you derive theta to find the angular velocity you lose the constant, so when Fluent integrates the velocity (DEFINE_CG_MOTION requires the angular velocity, not the angle(t)) it loses the constant "-15", giving the symmetrical function 25*sin(2*pi*frequency*t+arcsin(3/5)). But unfortunately I want an asymmetrical function ranging from +10deg to -40deg.
xyzch001 is offline   Reply With Quote

Old   December 15, 2011, 12:15
Default
  #6
Senior Member
 
Pay D.
Join Date: Aug 2011
Posts: 166
Blog Entries: 1
Rep Power: 14
pdp.aero is on a distinguished road
aha!
you can use this function:
theta(t)=40*sin(2*pi*50*(t+0.4314)+30);
f=50;
arcsin(3/6)=30 deg;
then you got theta=10 deg in t= 0 sec and theta=-40 deg in t=0.33 sec
with time-step=0.0001 sec.
if your flap in your grid have theta=10 deg you haven't problem, but if your flap have theta= 0 deg in t=0 in your grid you must first use cg-motion with diffrent function as udf to move your flap to 10 degree without solve the flow equation just use the Grid motion in Solve panel and then when your flap got the 10 deg use udf with this function to move your flap to -40 deg and solve the equation.
i hope its useful.
pdp.aero is offline   Reply With Quote

Old   December 15, 2011, 13:14
Default
  #7
New Member
 
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 14
xyzch001 is on a distinguished road
Hi! If I use your function I get +33.13 deg for t=0 and -33.13 deg for t=0.33. What am I doing wrong? Anyway the frequency f of the flapping is 6. Thank you
xyzch001 is offline   Reply With Quote

Old   December 16, 2011, 04:40
Default
  #8
Senior Member
 
Pay D.
Join Date: Aug 2011
Posts: 166
Blog Entries: 1
Rep Power: 14
pdp.aero is on a distinguished road
ok! with f=6 for your flap ; use same function with different coefficient!
theta(t)=40.*sin(2.*pi.*6.*(t+3.6)+30)
this gave you theta=10 at t=0 and theta=40 at t=2.7662, be sure its true.
you can plot your function in so many software such as MATLAB. and you can see how your function behave with different t or f or other coefficient. that's easy.
xyzch001 likes this.
pdp.aero is offline   Reply With Quote

Old   December 16, 2011, 04:57
Default
  #9
New Member
 
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 14
xyzch001 is on a distinguished road
Yes it works! you're great man! but my flap is theta=0 for t=0 how can I solve the problem? How can I use the "grid motion"? thanks a lot!!
xyzch001 is offline   Reply With Quote

Old   December 16, 2011, 05:45
Default
  #10
Senior Member
 
Pay D.
Join Date: Aug 2011
Posts: 166
Blog Entries: 1
Rep Power: 14
pdp.aero is on a distinguished road
in this case you must move your flap smoothly to theta=10 deg with different function and UDF with Cg-motion macro , without solve the flow equation. that's means you must hook your cg-motion UDF with for example this function to move the flap.
theta(t)=1000t.
hook the UDF with this function and then go to the solve> mesh motion in FLUENT,with time-step=0.0001 in 0.01 sec your flap got 10 deg and then unload your UDF and load the second UDF with previous function to move flap in 10 deg to -40 deg.
if you do this your grid maybe change badly and you got bad quality it's depended how small your time-step is.
you have second choice to have 10 deg in t=0 sec.
you can change your geometry with theta=10 for flap and mesh it again.
its depend your self to choice one of this solution for your flap got 10 deg in t=0.
your welcome.
pdp.aero is offline   Reply With Quote

Old   December 18, 2011, 14:45
Default
  #11
New Member
 
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 14
xyzch001 is on a distinguished road
Hi pdp.aero!
Finally I found the solution: this is the function that gives me the desired flapping angles: theta[t] = 0.8409*sin(w*t - 0.2563) + 0.6643*cos(w*t + 0.7741) - 0.000001868*Sin(0.7629*w*t + 0.1884) +0.3773*cos(-0.000002463*w*t + 2.338)
It has no constants so that, when I derive it to find the omega[t] and then Fluent integrates it,Fluent gets back the original theta[t]. I used Matlab "Curve fitting toolbox" to find this function by interpolation of many points.
Anyway thank you for your help!
xyzch001 is offline   Reply With Quote

Old   January 11, 2012, 23:10
Default
  #12
Member
 
sanjay's Avatar
 
aerosapien
Join Date: Sep 2010
Posts: 59
Rep Power: 15
sanjay is on a distinguished road
can this be simulated in STAR CCM+ ??
sanjay is offline   Reply With Quote

Old   January 12, 2012, 05:48
Default
  #13
New Member
 
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 14
xyzch001 is on a distinguished road
Hi, I don't know STAR CCM+, but I think you can do it.
xyzch001 is offline   Reply With Quote

Old   March 30, 2012, 11:46
Default
  #14
New Member
 
irfan khan
Join Date: Aug 2011
Posts: 11
Rep Power: 14
imbaasat is on a distinguished road
for flapping wing, following is required:

1. use GRID_MOTION instead of CG_MOTION.
2. use sinusoidal function with temporal effect.
3. make one & half wave in wing span direction.
imbaasat is offline   Reply With Quote

Old   June 20, 2012, 12:35
Default
  #15
New Member
 
Kyle
Join Date: Jun 2012
Posts: 12
Rep Power: 13
hippiekyle is on a distinguished road
Quote:
Originally Posted by imbaasat View Post
for flapping wing, following is required:

1. use GRID_MOTION instead of CG_MOTION.
2. use sinusoidal function with temporal effect.
3. make one & half wave in wing span direction.
What's the difference between GRID_MOTION and CG_MOTION ?
hippiekyle is offline   Reply With Quote

Old   June 21, 2012, 10:40
Default
  #16
Senior Member
 
Pay D.
Join Date: Aug 2011
Posts: 166
Blog Entries: 1
Rep Power: 14
pdp.aero is on a distinguished road
Quote:
Originally Posted by hippiekyle View Post
What's the difference between GRID_MOTION and CG_MOTION ?
GRID_MOTION used for non-rigid object but CG_MOTION used for move the rigid center of gravity object.
pdp.aero is offline   Reply With Quote

Old   June 21, 2012, 11:37
Default
  #17
New Member
 
Kyle
Join Date: Jun 2012
Posts: 12
Rep Power: 13
hippiekyle is on a distinguished road
I made a fin I want to flap by subtracting the volume from the domain. So it's not an actual volume. More of a void with no slip boundary conditions. Since it has no volume, I should use GRID_MOTION? Or should I remake the the fin with a volume? I want it to be rigid, but I'm not taking gravity into account.
hippiekyle is offline   Reply With Quote

Old   September 1, 2015, 06:48
Default DEFINE_CG_MOTION for flapping flight
  #18
New Member
 
Amit soni
Join Date: Jul 2015
Posts: 10
Rep Power: 10
Amit soni is on a distinguished road
I am doing flapping wing motion in 3-d but I am not able to see the wings flapping after simulation. I am using this udf code
#include "udf.h"
DEFINE_CG_MOTION(wing_mov , dt , vel , omega ,time , dtime)
{

omega[0] = 3*cos(1.2*time);
omega[1] = 0;
omega[2] = 0;
}

would suggest if something I have to define in code and how to give the dynamic meshing boundary condition.

I used this condition.

Last edited by Amit soni; September 1, 2015 at 06:53. Reason: Problem not clearly defined
Amit soni is offline   Reply With Quote

Old   May 14, 2016, 14:23
Default curve fitting
  #19
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 194
Rep Power: 14
arunraj is on a distinguished road
Hi everyone,

Can somebody please tell me how to write omega[2] equation for asymmetric function. The angles are in degree but in fluent it will be implemented in radians.

alpha(t)=30+sin(2*pi()*f*t)*30.

If we differentiate this function the constant would be zero which is not correct. Pleas let me know how to include this 30 degree. Its bit confusing as there is no explanation.

or is it easy to keep my aerfoil initially at 30 degree. But I am not sure whether i have keep in clockwise or anticlockwise.
arunraj is offline   Reply With Quote

Old   May 14, 2016, 14:34
Default
  #20
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 194
Rep Power: 14
arunraj is on a distinguished road
Hi all,

I understood the logic now. Basically we have convert a sin curve which has constant into another sin curve without constant by adding phase difference. I doesnt seem to be a easy task. What is the best way to do this.
arunraj is offline   Reply With Quote

Reply

Tags
ansys fluent, define_cg_motion, flapping wing, udf


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
DEFINE_CG_MOTION for flapping wing UDF xyzch001 Fluent UDF and Scheme Programming 0 December 14, 2011 08:39
flapping wing udf a serious doubt doctsh Fluent UDF and Scheme Programming 0 February 17, 2011 12:05
UDF for sweeping wing aamer Main CFD Forum 0 December 16, 2010 07:35
ask help about flapping wing UDF aeropeng Fluent UDF and Scheme Programming 0 December 24, 2009 22:09
udf for 3d wing giorgio FLUENT 0 October 8, 2004 09:13


All times are GMT -4. The time now is 23:11.