
[Sponsors] 
December 14, 2011, 09:51 
DEFINE_CG_MOTION for flapping wing UDF

#1 
New Member
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 7 
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! 

December 15, 2011, 04:47 

#2 
Member

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. 

December 15, 2011, 09:38 

#3 
New Member
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 7 
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).


December 15, 2011, 10:04 

#4 
Member

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 timestep you have t ,so you can calculate the theta and the angular velocity with those formula. 

December 15, 2011, 10:28 

#5 
New Member
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 7 
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.


December 15, 2011, 13:15 

#6 
Member

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 timestep=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 cgmotion 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. 

December 15, 2011, 14:14 

#7 
New Member
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 7 
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


December 16, 2011, 05:40 

#8 
Member

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. 

December 16, 2011, 05:57 

#9 
New Member
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 7 
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!!


December 16, 2011, 06:45 

#10 
Member

in this case you must move your flap smoothly to theta=10 deg with different function and UDF with Cgmotion macro , without solve the flow equation. that's means you must hook your cgmotion 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 timestep=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 timestep 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. 

December 18, 2011, 15:45 

#11 
New Member
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 7 
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! 

January 12, 2012, 00:10 

#12 
Member
aerosapien
Join Date: Sep 2010
Posts: 59
Rep Power: 8 
can this be simulated in STAR CCM+ ??


January 12, 2012, 06:48 

#13 
New Member
xyzch001
Join Date: Dec 2011
Posts: 10
Rep Power: 7 
Hi, I don't know STAR CCM+, but I think you can do it.


March 30, 2012, 11:46 

#14 
New Member
irfan khan
Join Date: Aug 2011
Posts: 11
Rep Power: 7 
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. 

June 20, 2012, 12:35 

#15 
New Member
Kyle
Join Date: Jun 2012
Posts: 12
Rep Power: 6 

June 21, 2012, 11:37 

#17 
New Member
Kyle
Join Date: Jun 2012
Posts: 12
Rep Power: 6 
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.


September 1, 2015, 06:48 
DEFINE_CG_MOTION for flapping flight

#18 
New Member
Amit soni
Join Date: Jul 2015
Posts: 10
Rep Power: 3 
I am doing flapping wing motion in 3d 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 

May 14, 2016, 14:23 
curve fitting

#19 
Member
Arun raj.S
Join Date: Jul 2011
Posts: 72
Rep Power: 7 
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. 

May 14, 2016, 14:34 

#20 
Member
Arun raj.S
Join Date: Jul 2011
Posts: 72
Rep Power: 7 
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. 

Tags 
ansys fluent, define_cg_motion, flapping wing, udf 
Thread Tools  
Display Modes  


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