
[Sponsors] 
August 4, 2011, 14:08 

#41 
Member
Aamer Shahzad
Join Date: Mar 2010
Posts: 58
Rep Power: 7 
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..? 

January 4, 2012, 01:59 

#42 
Member
Aamer Shahzad
Join Date: Mar 2010
Posts: 58
Rep Power: 7 
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, 19:33 

#43 
Member
joegi
Join Date: Nov 2009
Location: genoa
Posts: 67
Rep Power: 7 
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 xaxis (roll) 2nd yaxis (pitch) 3rd zaxis (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, 01:42 

#44 
Member
Aamer Shahzad
Join Date: Mar 2010
Posts: 58
Rep Power: 7 
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, 02:10 

#45 
Member
joegi
Join Date: Nov 2009
Location: genoa
Posts: 67
Rep Power: 7 
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, 02:57 

#46 
Member
Aamer Shahzad
Join Date: Mar 2010
Posts: 58
Rep Power: 7 
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, 13:11 

#47 
Member
joegi
Join Date: Nov 2009
Location: genoa
Posts: 67
Rep Power: 7 
To get omega(012), 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, 06:02 

#48  
Member
sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 6 
Quote:
I cant understand how fluent is comprehending my udf. 

March 13, 2012, 09:22 

#49 
Member
joegi
Join Date: Nov 2009
Location: genoa
Posts: 67
Rep Power: 7 
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. A udf like this should do the trick: #include "udf.h" #include "dynamesh_tools.h" real w, pi, Aroll, Apitch, roll, droll, pitch, dpitch, yaw, dyaw, frequency, T; real Ar, Ap, Ay; DEFINE_CG_MOTION(asymflap, dt, v_cg, omega, time, dtime) { Thread *t; NV_S(v_cg, =, 0.0); NV_S(omega, =, 0.0); if (!Data_Valid_P()) { Message("Wrong\n"); return; } t=DT_THREAD((Dynamic_Thread*)dt); frequency = 3.0; pi = 3.141592654; /* define motion variables */ Ar = 30.0; /*roll amplitude*/ Ap = 5.0; /*pitch amplitude*/ Ay = 0.0; /*yaw amplitude*/ Aroll = Ar*pi/180.0; /*conversion to radians*/ Apitch = Ap*pi/180.0; /*conversion to radians*/ w=2.0*pi*frequency; /*omega (radians)*/ T=1.0/frequency; roll = Aroll*sin(w*time + pi/2); droll = w*Aroll*cos(w*time + pi/2); pitch = Apitch*sin(w*time); dpitch = w*Apitch*cos(w*time); /*euler angles initial frame mod 1*/ omega[0] = droll; omega[1] = dpitch*1.0*cos(roll); omega[2] = dpitch*1.0*sin(roll); Message("time:%f omegax:%f omegay:%f omegaz:%f \n", time, omega[0], omega[1],omega[2]); } Just be careful about your reference system, if I well recall to use this udf your body should roll about the x axis, pitch about the y axis and yaw about the z axis. If you still don't get anything running contact your regional costumer support to ask for assistance. jg 

March 13, 2012, 11:57 

#50  
Member
sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 6 
Quote:
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.cfdonline.com/Forums/att...esdh_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 13, 2012, 17:06 

#51 
Member
joegi
Join Date: Nov 2009
Location: genoa
Posts: 67
Rep Power: 7 
I dont have the paper at hand, try to google it I think you can download it from somewhere for free.
Regarding your case, if you are confuse try to start with a simple kinematics, that will make things easier. One thing, remember that you need to input the angular velocities, so you will loose your constants in your roll and pitch equations, be careful with that. And as I told you before, fluent uses the euler angles, so you need toexpress your angular velocites in term of the euler angles. The udf i sent you before sold work flawless. jg 

March 14, 2012, 12:30 

#52  
Member
sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 6 
Quote:
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 13:26. 

March 14, 2012, 15:45 

#53 
Member
joegi
Join Date: Nov 2009
Location: genoa
Posts: 67
Rep Power: 7 
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, 08:49 

#54  
Member
sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 6 
Quote:
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, 16:45 

#55 
Member
joegi
Join Date: Nov 2009
Location: genoa
Posts: 67
Rep Power: 7 
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, 16:52 

#56  
Member
sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 6 
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:


March 16, 2012, 06:56 

#57 
Member
sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 6 
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. 

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: 31
Rep Power: 7 
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 defineinterface 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: 5 
I am new at using fluent.I want rotational motion in a rectangular cylinder(2D).Can anyone help me with the UDF.thanks in advance


Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Moving mesh  Niklas Wikstrom (Wikstrom)  OpenFOAM Running, Solving & CFD  122  June 15, 2014 06:20 
Specify radial mesh motion in CFX  Jonas  CFX  2  April 23, 2008 02:54 
Convergence moving mesh  lr103476  OpenFOAM Running, Solving & CFD  30  November 19, 2007 15:09 
tank motion on boat  Tim  FLUENT  0  May 23, 2007 11:50 
large scale mesh motion  sb  FLUENT  1  April 27, 2007 22:23 