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   July 26, 2010, 17:43
Default CG Motion Absolute coordinates
  #1
Member
 
Join Date: Jul 2010
Posts: 38
Rep Power: 16
montag dp is on a distinguished road
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 x-axis and the pitching is a rotation about the z-axis.

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) y-axis 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 re-work my functions to account for the rotation?
montag dp is offline   Reply With Quote

Old   July 30, 2010, 11:34
Default flapping and pitching
  #2
Member
 
ahmad
Join Date: Jul 2010
Posts: 57
Rep Power: 16
almostafa67 is on a distinguished road
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
almostafa67 is offline   Reply With Quote

Old   July 30, 2010, 11:45
Default
  #3
Member
 
Join Date: Jul 2010
Posts: 38
Rep Power: 16
montag dp is on a distinguished road
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.
montag dp is offline   Reply With Quote

Old   July 30, 2010, 12:27
Default
  #4
Member
 
ahmad
Join Date: Jul 2010
Posts: 57
Rep Power: 16
almostafa67 is on a distinguished road
hi dear montag...
this the case that i want to simulate it, i hope that u could help me with this.
Attached Images
File Type: jpg peristaltic.JPG (13.1 KB, 486 views)
almostafa67 is offline   Reply With Quote

Old   July 30, 2010, 13:27
Default
  #5
Member
 
Join Date: Jul 2010
Posts: 38
Rep Power: 16
montag dp is on a distinguished road
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?
montag dp is offline   Reply With Quote

Old   August 2, 2010, 17:14
Default
  #6
Member
 
Join Date: Jul 2010
Posts: 38
Rep Power: 16
montag dp is on a distinguished road
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.
montag dp is offline   Reply With Quote

Old   August 3, 2010, 03:03
Default rotation about z axis
  #7
Member
 
ahmad
Join Date: Jul 2010
Posts: 57
Rep Power: 16
almostafa67 is on a distinguished road
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...
Attached Images
File Type: jpg 1.JPG (68.2 KB, 408 views)
File Type: jpg 2.JPG (79.1 KB, 296 views)
almostafa67 is offline   Reply With Quote

Old   August 3, 2010, 10:36
Default
  #8
Member
 
Join Date: Jul 2010
Posts: 38
Rep Power: 16
montag dp is on a distinguished road
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.
montag dp is offline   Reply With Quote

Old   August 3, 2010, 10:51
Default rotation about z axis
  #9
Member
 
ahmad
Join Date: Jul 2010
Posts: 57
Rep Power: 16
almostafa67 is on a distinguished road
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????
almostafa67 is offline   Reply With Quote

Old   August 3, 2010, 10:52
Default
  #10
Member
 
ahmad
Join Date: Jul 2010
Posts: 57
Rep Power: 16
almostafa67 is on a distinguished road
sorry forgot attach images
Attached Images
File Type: jpg problem.JPG (22.7 KB, 274 views)
File Type: jpg problem 2.JPG (8.9 KB, 213 views)
almostafa67 is offline   Reply With Quote

Old   August 3, 2010, 13:05
Default Ok, now really confused
  #11
Member
 
Join Date: Jul 2010
Posts: 38
Rep Power: 16
montag dp is on a distinguished road
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 z-angle 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 z-axis 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 17:07.
montag dp is offline   Reply With Quote

Old   August 3, 2010, 17:24
Default
  #12
Member
 
Join Date: Jul 2010
Posts: 38
Rep Power: 16
montag dp is on a distinguished road
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;                    
}
And here is the code for the case where I assume the angular rates are relative to the moving body axes at all times. Notice the transformation from body rates to reference frame rates in the omega[] terms:

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);                    
}
The issue is, the last I checked these two udfs actually gave me the same (incorrect) motion, hence the confusion. The real issue in all of this is I'm getting significant rotation about the reference z axis when none is desired. Please fill me in if you have any insight on this.

Dan
montag dp is offline   Reply With Quote

Old   February 1, 2011, 12:11
Default
  #13
New Member
 
Dave Smith
Join Date: Jul 2010
Posts: 27
Rep Power: 16
davesmith_01 is on a distinguished road
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
davesmith_01 is offline   Reply With Quote

Old   February 1, 2011, 14:24
Default
  #14
Member
 
Join Date: Jul 2010
Posts: 38
Rep Power: 16
montag dp is on a distinguished road
Dave,

In the end I was able to get rotations in two axes to work as follows.

Nomenclature:
Phi: flapping angle (about global Z-axis)
theta: pitching angle (about global X-axis)

Definitions:
flapping velocity: dPhi = d(Phi)/dt (user selected, I use a sinusoid)
pitching velocity: dtheta = d(theta)/dt

Transformation to body coordinates:

body x-rotational velocity
omega[0] = dTheta*cos(Phi)

body y-rotational velocity
omega[1] = dTheta*sin(Phi)

body z-rotational 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 three-rotation transformation, would you be so kind as to post it here? Thanks.

Dan
Danil Yusupov likes this.
montag dp is offline   Reply With Quote

Old   February 1, 2011, 14:37
Default
  #15
New Member
 
Dave Smith
Join Date: Jul 2010
Posts: 27
Rep Power: 16
davesmith_01 is on a distinguished road
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
davesmith_01 is offline   Reply With Quote

Old   February 1, 2011, 14:41
Default
  #16
Member
 
Join Date: Jul 2010
Posts: 38
Rep Power: 16
montag dp is on a distinguished road
Quote:
Originally Posted by davesmith_01 View Post
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
It certainly seems like it would be simplest if they just used a global coordinate system for the rotation, but it seems they have it defined based on the local body axes, which change orientation with time. That's why you need a transformation.

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.
montag dp is offline   Reply With Quote

Old   February 1, 2011, 15:15
Default
  #17
Member
 
Join Date: Jul 2010
Posts: 38
Rep Power: 16
montag dp is on a distinguished road
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 three-axis rotation.

Thanks to Jakub K. for this.
Attached Files
File Type: pdf dh_algo.pdf (91.4 KB, 865 views)
Danil Yusupov likes this.
montag dp is offline   Reply With Quote

Old   February 2, 2011, 09:04
Default
  #18
New Member
 
Dave Smith
Join Date: Jul 2010
Posts: 27
Rep Power: 16
davesmith_01 is on a distinguished road
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.
davesmith_01 is offline   Reply With Quote

Old   February 6, 2011, 11:53
Default
  #19
Member
 
Aamer Shahzad
Join Date: Mar 2010
Posts: 58
Rep Power: 16
aamer is on a distinguished road
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.
aamer is offline   Reply With Quote

Old   February 6, 2011, 12:57
Question how to do coordinate transformation in udf
  #20
Member
 
Aamer Shahzad
Join Date: Mar 2010
Posts: 58
Rep Power: 16
aamer is on a distinguished road
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 x-y 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 x-y 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 y-z 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
aamer 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 16:07.