
[Sponsors] 
July 26, 2010, 16:43 
CG Motion Absolute coordinates

#1 
Member
Join Date: Jul 2010
Posts: 38
Rep Power: 13 
I'm having a little trouble with the Define_CG_Motion macro. I'm trying to do a simulation of a wing that is both flapping and pitching. The flapping is a rotation about the xaxis and the pitching is a rotation about the zaxis.
The problem is, it seems that the coordinate system for the CG remains relative to the hooked zone at all times. This makes the wing rotate about the (absolute) yaxis as well if I just define an omega_x and omega_z, because as time advances the flapping motion rotates the wing's relative coordinate system. Is there any way to define the CG location in absolute coordinates, or do I just have to rework my functions to account for the rotation? 

July 30, 2010, 10:34 
flapping and pitching

#2 
Member
ahmad
Join Date: Jul 2010
Posts: 57
Rep Power: 13 
Hi, everybody...
I am having this same problem.but in my udf i want to rotate one of edges only about on coordinate,I've been working on it for two weeks but i didnt find any similar problem,if u found any solution for this kind of problems let me know please thank you in advance my email: almostafa67@gmail.com 

July 30, 2010, 10:45 

#3 
Member
Join Date: Jul 2010
Posts: 38
Rep Power: 13 
I haven't had any luck either. I tried doing a coordinate transformation to transform rotations about the reference x, y, and z axes to rotations about the moving body x, y, and z axes. It gets the motion closer to what I want but still not right. Adding to the frustration is the fact that Fluent's "Display Zone Motion" doesn't work right, so I have to do "Preview Mesh Motion" every time just to check.


July 30, 2010, 11:27 

#4 
Member
ahmad
Join Date: Jul 2010
Posts: 57
Rep Power: 13 
hi dear montag...
this the case that i want to simulate it, i hope that u could help me with this. 

July 30, 2010, 12:27 

#5 
Member
Join Date: Jul 2010
Posts: 38
Rep Power: 13 
Another question. In the Fluent User's manual it says you can check a moving body's center of gravity position and orientation in the dynamic mesh box by pressing 'Update.' See here:
http://my.fit.edu/itresources/manual...ug/node455.htm It would be useful if I could my motion UDF could check the orientation at each time step. Does anyone know how to do that within the UDF? 

August 2, 2010, 16:14 

#6 
Member
Join Date: Jul 2010
Posts: 38
Rep Power: 13 
For posterity, I figured out how to solve my problem. Use the Euler rate transformations in the UDF in order to convert between body and stationary velocities. You'll also need to use the current zone orientation at each time step using the DT_THETA(dt) macro. Just be careful because it seems to return the orientation in degrees, not radians, so you must convert it to use in trig expressions.


August 3, 2010, 02:03 
rotation about z axis

#7 
Member
ahmad
Join Date: Jul 2010
Posts: 57
Rep Power: 13 
hi dear montag dp...
i worked a lot on my case,but unfortunately see no progress,i sent you the image of the case that i simulated it in gambit and the udf file that i use to rotate small circle about center of bigger circle,(kind of peristaltic pump),would you be so kind as to think about it and explain your udf and if you have any have any advice for me to write my udf file... the udf file that i use: # include "udf.h" # include "dynamesh_tools.h" DEFINE_CG_MOTION(pump,dt,vel,omega,time,dtime) { Thread *t; real freq_t; NV_S(vel,=,0.0); NV_S(omega,=,0.0); if(!Data_Valid_P()) return; freq_t = 4.0; t= DT_THREAD((Dynamic_Thread*)dt); vel[0] = 0.0; vel[1] = 0.0; vel [2] = 0.0; omega [0] = 0.0; omega [1] = 0.0; omega [2] = freq_t; } Thank you in advance for any help you can provide. looking forward to ur help... 

August 3, 2010, 09:36 

#8 
Member
Join Date: Jul 2010
Posts: 38
Rep Power: 13 
Almostafa,
First off, it looks like you could simplify your code down to just: # include "udf.h" # include "dynamesh_tools.h" DEFINE_CG_MOTION(pump,dt,vel,omega,time,dtime) { real freq_t; omega [2] = freq_t; } But I don't think it really matters if you do or not. What exactly is going wrong with your mesh? Perhaps you should make your own thread about it. Anyway, if you are using a Dynamic Mesh I believe you should just use triangular cells (or tetrahedral for 3D). That may be your issue. 

August 3, 2010, 09:51 
rotation about z axis

#9 
Member
ahmad
Join Date: Jul 2010
Posts: 57
Rep Power: 13 
dear montag dp...
my udf really worked but i faced new problem small circle has been locked in its end points!(look at the images) how can i tell fluent move small cylinder and let its end be free???? 

August 3, 2010, 09:52 

#10 
Member
ahmad
Join Date: Jul 2010
Posts: 57
Rep Power: 13 
sorry forgot attach images


August 3, 2010, 12:05 
Ok, now really confused

#11 
Member
Join Date: Jul 2010
Posts: 38
Rep Power: 13 
I thought I had this right, but now I'm just more confused. I'm trying to just get motion about the x and y axes. I thought the Euler rate equations would help do this, but then I realized I'm still getting rotation about z. I didn't think it was a big deal because Fluent reported it to be less than 1 degree.
It looked like a lot more though, so I tried testing it again without the Euler angles in there. The motion looks exactly the same. But now Fluent reports there to be 0 angle about z after previewing mesh motion. I'm positive that when I tried this before without the Euler angles business it reported the zangle to be about what it looked like ~20 degrees). I'm so confused. And almostafa, I really think you'd get more responses if you just made your own thread instead of constantly changing the subject in mine. Your problem is not really even related to mine. I've helped you all I can, in this thread and my other thread and via PM. Please only post in my threads if you can help out with the problems I'm having. EDIT: So, in all it seems my assumption about CG rotational speed being relative to the moving body axes at all times may be wrong. I really don't know. Perhaps the rotation is actually relative to the stationary frame at all times? In that case why is my wing rotating about the zaxis when I specify 0 rotational velocity about z? I'm very confused about this whole thing. Last edited by montag dp; August 3, 2010 at 16:07. 

August 3, 2010, 16:24 

#12 
Member
Join Date: Jul 2010
Posts: 38
Rep Power: 13 
For reference, here is a copy of my code. The first would define flapping + pitching motion, assuming the rotations are defined relative to the stationary axes:
Code:
#include "udf.h" DEFINE_CG_MOTION(wing, dt, vel, omega, time, dtime) { real a1, a2, w, pi; pi = 3.141592654; /* define motion variables */ a1 = 30 * pi / 180; /* 30 degree flapping amplitude */ a2 = 30 * pi / 180; /* 30 degree feathering amplitude */ w = 2 * pi * 25; /* 25 Hz frequency */ /* define wing rotational motion in stationary coordinates */ omega[0] =  a1 * w * cos(w*time); /* flapping speed */ omega[1] = a2 * w * sin(w*time); /* feathering speed */ omega[2] = 0; } Code:
#include "udf.h" DEFINE_CG_MOTION(wing, dt, vel, omega, time, dtime) { real a1, a2, thxdot, thydot, thzdot, w, pi, thx, thy; pi = 3.141592654; /* define motion variables */ a1 = 30 * pi / 180; /* 30 degree flapping amplitude */ a2 = 30 * pi / 180; /* 30 degree feathering amplitude */ w = 2 * pi * 25; /* 25 Hz frequency */ /* define motion in reference axes */ thx = DT_THETA (dt)[0] * pi/180; /* flapping angle  set by orientation macro DT_THETA */ thy = DT_THETA (dt)[1] * pi/180; /* feathering angle  set by orientation macro DT_THETA */ thxdot=  a1 * w * cos(w*time); /* flapping speed */ thydot = a2 * w * sin(w*time); /* feathering speed */ thzdot = 0; /* yawing (spinning) speed */ /* define wing rotational motion in body coordinates */ omega[0] = thxdot  thzdot * sin(thy); omega[1] = thydot * cos(thx) + thzdot * cos(thy) * sin(thx); omega[2] = thzdot * cos(thy) * cos(thx)  thydot * sin(thx); } Dan 

February 1, 2011, 11:11 

#13 
New Member
Dave Smith
Join Date: Jul 2010
Posts: 27
Rep Power: 13 
Hi
Have you found a solution to your problem I really need some help. I dont unuderstand the rotational method in Fluent it does not make sense. I am trying to model a flapping wing in 3D and I cant seem to understand whats wrong. I am very confused. I choose to rotate about the x(flapping) and z(pitching) axis and set this up via UDF and even my profile coordinates and there is motion about the y axes all the time. Then to make matters worse, if I rotate about the x(flapping), y(deviation), and z(pitching) axes at the same time the x axes rotation is fine, but the wing seems to rotate about the y axis in a way that it wants to and rotates about the z axis with some form of accuracy, basically I think the rotation axis in fluent maybe set in a certain way, but I dont understand what it is and how I can solve my problem(s). Could someone please help with this, I have tried so many times to solve this but cannot do it. Please help Dave 

February 1, 2011, 13:24 

#14 
Member
Join Date: Jul 2010
Posts: 38
Rep Power: 13 
Dave,
In the end I was able to get rotations in two axes to work as follows. Nomenclature: Phi: flapping angle (about global Zaxis) theta: pitching angle (about global Xaxis) Definitions: flapping velocity: dPhi = d(Phi)/dt (user selected, I use a sinusoid) pitching velocity: dtheta = d(theta)/dt Transformation to body coordinates: body xrotational velocity omega[0] = dTheta*cos(Phi) body yrotational velocity omega[1] = dTheta*sin(Phi) body zrotational velocity omega[2] = dPhi You should be able to use a similar approach if your axes are set up differently. Also, these are a simplified version assuming the stroke plane deviation is zero. If you include that you'll have a third velocity and the transformation will be more complicated, but I haven't worked that out. Actually, if you do work out the the threerotation transformation, would you be so kind as to post it here? Thanks. Dan 

February 1, 2011, 13:37 

#15 
New Member
Dave Smith
Join Date: Jul 2010
Posts: 27
Rep Power: 13 
Hi Dan
I can get the motion around two axes, thats ok, its adding a third axis which fluent has a problem with. I have thought about this many times and its really just geometry, but I think that fluent has not set up the rotations around an axis properly. If the user sets a rotation about each axis this is what should occur, if a body is flat along the xz plane through the z axis and a rotation occurs about the x, y and z axis this should be simply possible as the rotations are around a fixed global axis, but this was not the case as fluent is coupling the motions about z and y axis always. I dont understand how it does that, because that seems to be more complex than the motion I am asking fluent to do. I will let you know if I find a solution, please let me know if you find a solution friend. Dave 

February 1, 2011, 13:41 

#16  
Member
Join Date: Jul 2010
Posts: 38
Rep Power: 13 
Quote:
I was puzzled over this for a long time, and still am to some extent, because it seems like the required transformation is not the standard type that uses Euler angles. And oddly enough, there is no information anywhere in Fluent's documentation that I've been able to find about the correct transformation. Even talking with someone from a CFD consulting firm didn't help. 

February 1, 2011, 14:15 

#17 
Member
Join Date: Jul 2010
Posts: 38
Rep Power: 13 
Actually, here's something that someone sent me. This guy did a flapping simulation of a dragonfly in fluent, which you should be able to find easily on youtube. I asked him how he did his coordinate transformations and he responded with the attached pdf. It is quite detailed and allows for threeaxis rotation.
Thanks to Jakub K. for this. 

February 2, 2011, 08:04 

#18 
New Member
Dave Smith
Join Date: Jul 2010
Posts: 27
Rep Power: 13 
Thanks for the attachment, will have a look through.
It is very odd if they have chosen a time dependent axis system, I dont think they have configured the dynamics correctly. A global coordinate system would be the best possible one to use. Anyway, I will let you know if I progress in this rather weird problem, please let me know if you find any more information. 

February 6, 2011, 10:53 

#19 
Member
Aamer Shahzad
Join Date: Mar 2010
Posts: 58
Rep Power: 13 
Dear Montag Dp...
in the pdf that you have given in your comments. it mentions an ebook in tht.... will u be kind enough, to send me that ebook.... i want to understand the tranformations in more detail..... my email is aamer58@gmail.com. looking forward to your help. 

February 6, 2011, 11:57 
how to do coordinate transformation in udf

#20 
Member
Aamer Shahzad
Join Date: Mar 2010
Posts: 58
Rep Power: 13 
Hello all.....
i am a student of cfd and trying to sweep a simple wing from 0 to pi radians (azimuth angle) and assuming a constant angle of attack. When i make a 2D airfoil in gambit, it is in xy plane. now if i want to make a wing out of it, i have to extend it in z direction. so the wing is formed in such away that its span is in z direction and airfoil in xy plane. but in fluent, in order to mimic insect sweeping, i want the same wing to transform its axes in such away that its span is in x direction and airfoil is in yz plane....... How can this coordinate transformation be achieved in UDF ???? @dear montag Dp...... looking at your previous threads, i think your guidance can serve the purpose. ..... thanks 

Thread Tools  Search this Thread 
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 14: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 