# CG Motion Absolute coordinates

 Register Blogs Members List Search Today's Posts Mark Forums Read

 August 4, 2011, 14:08 #41 Member   Aamer Shahzad Join Date: Mar 2010 Posts: 58 Rep Power: 13 Hello montaq Dp i wrote a udf and performed azimuth rotation of wing in STILL air..... now when i want to post process the case, FLUENT is not displaying the relative velocities to me..... it gives same absolute velocities as relative velocities too.... is there a way to get the relative velocities for such case..? maisui1993 likes this.

 January 4, 2012, 00:59 #42 Member   Aamer Shahzad Join Date: Mar 2010 Posts: 58 Rep Power: 13 Dear Quantum.Tejas, Dave Smith and Montag Dp. From your posts, it looks as if you people have done flapping motion when two angles are considered. Since i am also doing flapping motion taking sweep (psi) and pitch (alpha) into account only, i guess you people can help me resolve my problem . The axis convention is : horizontal is X axis, Vertical is Y axis and out of the desktop is Z- axis. The wing is lying in such away that its chord is in X axis and Span in Z axis. The wing is initially at alpha = 0 degree. I want to do sweeping about Y axis and pitching about Z axis simultaneously. here is my udf . Total time is 2 seconds and the wing is suppose to sweep by 180 degree (3.14 radians) and at the same time pitch by 180 degree (3.14 radian) in total time of 2 seconds. the equations are printing correctly but the motion is very strange. can anybody help me identify the correct values for omega[0], [1] and [2] for present case. #include "udf.h" static real psi_dot = 0.0; /* sweeping velocity */ static real alpha_dot = 0.0; /* pitch velocity */ DEFINE_CG_MOTION(case3d, dt, vel, omega, time, dtime) { Thread *t; face_t f; real psi_dot; /* sweeping velocity */ real psi; /* sweep angle */ real alpha_dot; /* pitch velocity */ real alpha; /* pitch angle */ /*reset velocities*/ NV_S(vel, =, 0.0); NV_S(omega, =, 0.0); if (!Data_Valid_P ()) return; if ((time<= 2)) { alpha_dot= -1.570796; alpha= (-1.570796*time); psi_dot = -1.570796; psi= (-1.570796*time); } Message("time:%f psi_dot:%f alpha_dot:%f\n",time,psi_dot,alpha_dot); omega[0]= (psi_dot)*sin(alpha); omega[1]= (psi_dot)*cos(alpha); omega[2]= (alpha_dot); }

 January 5, 2012, 18:33 #43 Member   joegi Join Date: Nov 2009 Location: genoa Posts: 93 Rep Power: 13 Hi Aamer, Usually when I setup a flapping case I use a sine/cosine function for roll/yaw/pitch but in your udf I dont see that function. It seems that you are trying to define the euler angles, but the arguments (roll/yaw/pitch) are constant, hence you wont get a flapping motion. Also pay attention to the sequence of rotations, it seems that fluent uses the following sequence 1st x-axis (roll) 2nd y-axis (pitch) 3rd z-axis (yaw) So you will need adjust your reference system and euler angles accordingly. I am not a 100% sure about this, but when I use a different reference system or a different sequence of rotation I don't get the desired kinematics. jg

 January 6, 2012, 00:42 #44 Member   Aamer Shahzad Join Date: Mar 2010 Posts: 58 Rep Power: 13 Hello Joegi.geo. Thanks for the reply. I understand that the equations should have sine and cosine functions and i have even tried those equations too but no success. Can you write some similar flapping udf here for reference or email me the udf (aamer58@gmail.com)?????. I believe that the problem is with assigning omega[0], [1] and [2]. Actually i am not clear about how to calculate the equations for Omega [0], omega [1] and omega [2] so do you have any reference material on it or can you guide me how to find correct transformation for omega[0], [1] and [2] . I will be grateful.

 January 6, 2012, 01:10 #45 Member   joegi Join Date: Nov 2009 Location: genoa Posts: 93 Rep Power: 13 For acoupled motion (roll+pitch). Something like this should work roll=amplituderoll*sin(2*pi*frequencyroll*time) droll=2*pi*frequencyroll*amplituderoll*cos(2*pi*fr equencyroll*time) pitch=amplitudepitch*sin(2*pi*frequencypitch*time) dpitch=2*pi*frequencyputch*amplitudepitch*cos(2*pi *frequencypitch*time) omega0=droll omega1=dpitch*cos(roll) omega2=dpitch*sin(roll) You need to derive the angular velocities from the euler angles. This should work for the following sequence of rotations rotation about x (roll) rotation about y (pitch) rotation about z (yaw)

 January 6, 2012, 01:57 #46 Member   Aamer Shahzad Join Date: Mar 2010 Posts: 58 Rep Power: 13 Hello. Now lets try to replicate the steps for my case. i have X axis in horizontal, Y axis in vertical and Z axis, coming out of the desktop. The coupled motion is (pitch+yaw). The sequence of rotation is: rotation about x (roll) ..... there is no rolling in my case. rotation about z (pitch) rotation about y (yaw) pitch=amplitudepitch*sin(2*pi*frequencypitch*time) dpitch=2*pi*frequencyputch*amplitudepitch*cos(2*pi *frequencypitch*time) yaw=amplitudeyaw*sin(2*pi*frequencyyaw*time) dyaw=2*pi*frequencyyaw*amplitudeyaw*cos(2*pi*frequ encyyaw*time) omega0= ????? omega1= ????? omega2= ????? Can you please identify omega0, omega1 and omega2 for this case. i have identified them as : omega0= dyaw*sin(pitch) omega1= dyaw*cos(pitch) omega2= dpitch But they are not giving me desired motion. Regards

 January 6, 2012, 12:11 #47 Member   joegi Join Date: Nov 2009 Location: genoa Posts: 93 Rep Power: 13 To get omega(0-1-2), look for that on the web or get a good book on solid mechanics from your library, I won't do your homework/research/thesis. You just need to get the euler angles and the corresponding angular velocites for a sequence of rotations x(roll), y(pitch) and z(yaw) (the rotations seem to be hardwired in fluent).

March 13, 2012, 05:02
#48
Member

sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 12
Quote:
 Originally Posted by joegi.geo To get omega(0-1-2), look for that on the web or get a good book on solid mechanics from your library, I won't do your homework/research/thesis. You just need to get the euler angles and the corresponding angular velocites for a sequence of rotations x(roll), y(pitch) and z(yaw) (the rotations seem to be hardwired in fluent).
I am also performing similar analysis. You mean that the roll,pitch equations should be from some absolute axis on the previous post where you have written example how it can be done. I am having pitch+roll movement where the rolling is done with respect to the the pitching axis, I have got the information on how these angles change with time.

I cant understand how fluent is comprehending my udf.

March 13, 2012, 10:57
#50
Member

sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 12
Quote:
 Originally Posted by joegi.geo Well to get a fairly good explanation of the reference system used by fluent take a look at this paper: Wing Kinematics and aerodynamics of a Hovering Flapping Micro Aerial Vehicle. jg

Wow, thanks a lot for detailed explanation.

In my problem the angles are function of time i.e.

Roll= A-(B*cos((omega*time)-C*deg))-(D*cos((2*omega*time)+E*deg))-(F*deg*cos((3*omegat*time)+H*deg));

Pitch =(A'*deg)-(B'*cos(time*omega));

Additionally, the roll is along the pitching axis which keeps on moving with time. Therefore I followed this guide : http://www.cfd-online.com/Forums/att...es-dh_algo.pdf and converted my roll and pitch to three rotational velocities.

But in the end the three rotational velocity obtained are very less and hence the motion which I get is very small, also as I change my time step motion changes, which shouldn't happen.

I have still not made account on ansys support, so I will contact university on how to register as a student.

Can you please attach or provide link to the paper, I tried searching but it requires subscription.

March 14, 2012, 11:30
#52
Member

sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 12
Quote:
Thanks a lot. I will try the udf as you described. A quick question though, According to equations that describe angles my wing has initial orientation at time=0, although it sounds stupid but shall my geometry be given that initial orientation and then meshing should be done? Let me explain clearly what I want to ask, My geometry when at rest has phi, theta equal to zero. But according to equations that give change of these angles with respect to time at t=0 it has some finite value of phi and theta, so when the initial input the geometry which has that orientation?

EDIT:

Additionally I would like to know if the order of the rotations matter. I mean I tried the code but it doesnt work does that mean fluent accidently makes rotation in false order? As we know that in solids the order in which you make rotation also matters.

Last edited by sheth; March 14, 2012 at 12:26.

 March 14, 2012, 14:45 #53 Member   joegi Join Date: Nov 2009 Location: genoa Posts: 93 Rep Power: 13 Yes, it is highly recommendable that your geometry has the same initial orientation as the kinematics. As a matter of fact I always do like that, so you will avoid highly skewed cells during the first iterations. Regarding to the rotations, in order to have the udf working you will need to rotate the body in the right sequence. For this udf the sequence is: rotation about x (roll) rotation about y (pitch) rotation about z (yaw) so you will need to rotate your domain if it is not oriented according to the previous reference system. Alternatively, find the euler angles and angular velocities to your reference system. jg out

March 15, 2012, 07:49
#54
Member

sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 12
Quote:
 Originally Posted by joegi.geo Yes, it is highly recommendable that your geometry has the same initial orientation as the kinematics. As a matter of fact I always do like that, so you will avoid highly skewed cells during the first iterations. Regarding to the rotations, in order to have the udf working you will need to rotate the body in the right sequence. For this udf the sequence is: rotation about x (roll) rotation about y (pitch) rotation about z (yaw) so you will need to rotate your domain if it is not oriented according to the previous reference system. Alternatively, find the euler angles and angular velocities to your reference system. jg out
I tried out with my code, the code is working but not giving the motion as I expected, I think how fluent is comprehending these code is very important because after some time the motion goes random.

So, I will try and update my problem here because I think this is very common problem for most of people working with such motions.

I tried a lot but couldn't find paper so I request if you can please send me one, or provide link where I can find. As understanding fluent reference system is key issue in my problem.

Additionally as my angle vs time equations are far too complex :

Roll= A-(B*cos((omega*time)-C*deg))-(D*cos((2*omega*time)+E*deg))-(F*deg*cos((3*omegat*time)+H*deg));

Pitch =(A'*deg)-(B'*cos(time*omega));

Can you suggest some other theta vs time equations which resemble bird flight.

 March 15, 2012, 15:45 #55 Member   joegi Join Date: Nov 2009 Location: genoa Posts: 93 Rep Power: 13 uff, ok this is my last reply, I think you have enough information to tackle your problem. The udf as it is, is fully working, it simulates rolling about the traveling axis and pitching about an axis perpendicular to the traveling axis. This one simulates a symmetric motion, so starting from this simple one you can get very complex kinematics, just have in mind to use the right reference system and to set the right initial position of the body. Regarding to your roll and pitch equations, which I assume describe the angle evolution, as I told you before, be carefull with the constants because you will loose them when you derive the equation to get the angular velocities, which are the inputs for fluent. I have used equations far way much complex so it is not a problem. Try to look for zoology and biology papers, there are a few of them where they describe the kinematics of different birds wings, but I like to use kinematics that involves a mixture of error functions, sine function and exponential functions. jg out

March 15, 2012, 15:52
#56
Member

sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 12
Thanks a lot jg. I am sorry for the idiotic questions but I hope that by performing some trials I will be able to get right motion.

Thanks again.

Quote:
 Originally Posted by joegi.geo uff, ok this is my last reply, I think you have enough information to tackle your problem. The udf as it is, is fully working, it simulates rolling about the traveling axis and pitching about an axis perpendicular to the traveling axis. This one simulates a symmetric motion, so starting from this simple one you can get very complex kinematics, just have in mind to use the right reference system and to set the right initial position of the body. Regarding to your roll and pitch equations, which I assume describe the angle evolution, as I told you before, be carefull with the constants because you will loose them when you derive the equation to get the angular velocities, which are the inputs for fluent. I have used equations far way much complex so it is not a problem. Try to look for zoology and biology papers, there are a few of them where they describe the kinematics of different birds wings, but I like to use kinematics that involves a mixture of error functions, sine function and exponential functions. jg out

 March 16, 2012, 05:56 #57 Member   sheth roh Join Date: Jul 2011 Posts: 56 Rep Power: 12 Hey JG, I finally got it working. Thanks for all your help. The constants in equation were not the issue, even with the constants it went well. The wing just bends slightly so I think I need to set dynamic parameters so it doesn't happen. For those who are trying here is what to follow: 1. Use Euler angles to define angles (Theta, Phi... etc in Euler Angles) 2. Orient Geometry As it shall be at time t=0. 3. In dynamic mesh, when you define dynamic zone, mention CG properly (Very IMP), In my case I wrote the Cg position x,y,z and I didn't mention the cg orientation when defining dynamic mesh zones. 4. Follow the order X, Y, and then Z, i.e. The first rotation will be about X axis, second will be about Y axis, and third will be about Z axis. 5. The UDF that JR has provided works perfectly, its in this thread itself, so many thanks to JG for that. 6. If your motion is not proper, then play with positive negative sign, I had to do this in my case also. Try changing signs of equations, and you may get proper motion. lev likes this.

 April 26, 2012, 11:28 translational and rotational movement in UDF code #58 New Member   arian Join Date: Apr 2012 Posts: 1 Rep Power: 0 hi guys i have problems in writing udf code that i simulate one booster that has translation in x axes and rotational about cg(clockwise) in one time.any body helps me?thanks alot

 May 12, 2012, 06:10 #59 Member   alireza Join Date: Jul 2009 Posts: 32 Rep Power: 13 Hi Dear users. I write a UDF for flapping wing for fluent and compiled it and dont have any problem. But i can not use dynamic mesh? can you help me. 1- in gambit creat a zone aroud airfoil and implement a interface boundary condition. 2- in fluent i use define-interface 3- enable dynamic mesh with layering and smoothing. 4- selected airfoil and use UDF. But airfoil is fixed and dont move! albeit: fluent have this error: cg motion is incorrect

 June 2, 2012, 06:30 #60 Member   Satish Gupta Join Date: Jun 2012 Posts: 30 Rep Power: 11 I am new at using fluent.I want rotational motion in a rectangular cylinder(2-D).Can anyone help me with the UDF.thanks in advance