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

CG Motion Absolute coordinates

Register Blogs Community New Posts Updated Threads Search

Like Tree10Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 4, 2011, 15:08
Default
  #41
Member
 
Aamer Shahzad
Join Date: Mar 2010
Posts: 58
Rep Power: 16
aamer is on a distinguished road
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.
aamer is offline   Reply With Quote

Old   January 4, 2012, 01:59
Default
  #42
Member
 
Aamer Shahzad
Join Date: Mar 2010
Posts: 58
Rep Power: 16
aamer is on a distinguished road
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);
}
aamer is offline   Reply With Quote

Old   January 5, 2012, 19:33
Default
  #43
Senior Member
 
joegi
Join Date: Nov 2009
Location: genoa
Posts: 104
Rep Power: 17
joegi.geo is on a distinguished road
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
joegi.geo is offline   Reply With Quote

Old   January 6, 2012, 01:42
Default
  #44
Member
 
Aamer Shahzad
Join Date: Mar 2010
Posts: 58
Rep Power: 16
aamer is on a distinguished road
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.
aamer is offline   Reply With Quote

Old   January 6, 2012, 02:10
Default
  #45
Senior Member
 
joegi
Join Date: Nov 2009
Location: genoa
Posts: 104
Rep Power: 17
joegi.geo is on a distinguished road
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)
joegi.geo is offline   Reply With Quote

Old   January 6, 2012, 02:57
Default
  #46
Member
 
Aamer Shahzad
Join Date: Mar 2010
Posts: 58
Rep Power: 16
aamer is on a distinguished road
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
aamer is offline   Reply With Quote

Old   January 6, 2012, 13:11
Default
  #47
Senior Member
 
joegi
Join Date: Nov 2009
Location: genoa
Posts: 104
Rep Power: 17
joegi.geo is on a distinguished road
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).
joegi.geo is offline   Reply With Quote

Old   March 13, 2012, 06:02
Default
  #48
Member
 
sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 15
sheth is on a distinguished road
Quote:
Originally Posted by joegi.geo View Post
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.
sheth is offline   Reply With Quote

Old   March 13, 2012, 09:22
Default
  #49
Senior Member
 
joegi
Join Date: Nov 2009
Location: genoa
Posts: 104
Rep Power: 17
joegi.geo is on a distinguished road
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
arunraj, sheth, jiec827 and 1 others like this.
joegi.geo is offline   Reply With Quote

Old   March 13, 2012, 11:57
Default
  #50
Member
 
sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 15
sheth is on a distinguished road
Quote:
Originally Posted by joegi.geo View Post
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.
sheth is offline   Reply With Quote

Old   March 13, 2012, 17:06
Default
  #51
Senior Member
 
joegi
Join Date: Nov 2009
Location: genoa
Posts: 104
Rep Power: 17
joegi.geo is on a distinguished road
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
joegi.geo is offline   Reply With Quote

Old   March 14, 2012, 12:30
Default
  #52
Member
 
sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 15
sheth is on a distinguished road
Quote:
Originally Posted by joegi.geo View Post
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
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 13:26.
sheth is offline   Reply With Quote

Old   March 14, 2012, 15:45
Default
  #53
Senior Member
 
joegi
Join Date: Nov 2009
Location: genoa
Posts: 104
Rep Power: 17
joegi.geo is on a distinguished road
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
joegi.geo is offline   Reply With Quote

Old   March 15, 2012, 08:49
Default
  #54
Member
 
sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 15
sheth is on a distinguished road
Quote:
Originally Posted by joegi.geo View Post
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.
sheth is offline   Reply With Quote

Old   March 15, 2012, 16:45
Default
  #55
Senior Member
 
joegi
Join Date: Nov 2009
Location: genoa
Posts: 104
Rep Power: 17
joegi.geo is on a distinguished road
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
joegi.geo is offline   Reply With Quote

Old   March 15, 2012, 16:52
Default
  #56
Member
 
sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 15
sheth is on a distinguished road
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 View Post
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
sheth is offline   Reply With Quote

Old   March 16, 2012, 06:56
Default
  #57
Member
 
sheth roh
Join Date: Jul 2011
Posts: 56
Rep Power: 15
sheth is on a distinguished road
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.
sheth is offline   Reply With Quote

Old   April 26, 2012, 12:28
Post translational and rotational movement in UDF code
  #58
New Member
 
arian
Join Date: Apr 2012
Posts: 1
Rep Power: 0
ariina is on a distinguished road
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
ariina is offline   Reply With Quote

Old   May 12, 2012, 07:10
Default
  #59
Member
 
alireza
Join Date: Jul 2009
Posts: 32
Rep Power: 16
alireza_b is an unknown quantity at this point
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
alireza_b is offline   Reply With Quote

Old   June 2, 2012, 07:30
Default
  #60
Member
 
Satish Gupta
Join Date: Jun 2012
Posts: 30
Rep Power: 14
Rahul123 is on a distinguished road
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
Rahul123 is offline   Reply With Quote

Reply


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
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
Specify radial mesh motion in CFX Jonas CFX 2 April 23, 2008 03: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 12:50
large scale mesh motion sb FLUENT 1 April 27, 2007 23:23


All times are GMT -4. The time now is 15:59.