CFD Online URL
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

rotating and pitching UDF help/check

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 8, 2014, 12:00
Cool rotating and pitching UDF help/check
  #1
New Member
 
sam daysley
Join Date: Feb 2013
Posts: 28
Rep Power: 3
daysley is on a distinguished road
Hi everyone,

I'm looking to simulate a turbine (see attached pic) with airfoils that rotate about an axis and change angle of attack at the same time (in a sinusoidal sense). Currently i have three zones, the large stationary zone, the rotating turbine zone and then the airfoil zones. i thought if i set the turbine zone rotating at x rad/s and then set up a udf motion for the airfoil zone relative to the turbine zone it would allow me to change the angle of attack whilst rotating? however this doenst happen, so i wanted to know whether im using the correct udf macro? should i be using DEFINE_CG_MOTION() i.e. dynamic zone? or is my code wrong?

here is what i have as my code:

Code:
 
#include "udf.h"
 
DEFINE_ZONE_MOTION(sine_motion,omega,axis,origin,velocity,time,dtime)
{
    real posx, posy, rad, angle, angvel, pi;
    
    
    rad = 0.4572;
    pi = 3.141592654;
    angvel = 10;

        angle = angvel * time * (180 / pi );
        *omega = cos(10 * time);
        posx = rad * cos(angle); 

/*where posx and posy are the position of the airfoils rotational origin as the turbine rotates*/

        posy = rad * sin(angle);
    
        origin = (posx, posy, 0);
        

    return;
}
what i aim for this to do is "flap" the airfoil about its quarter chord, whilst rotating around a fixed global axis. so i thought the "origin = (posx, posy, 0);" would allow the rotation origin to change as the mesh rotated but it doesnt?


thanks in advance for the help
Attached Images
File Type: jpg Capture.JPG (87.5 KB, 36 views)
daysley is offline   Reply With Quote

Old   March 17, 2014, 09:43
Arrow Re: Rotating and Pitching UDF
  #2
New Member
 
Mahdi Torabi Asr
Join Date: Dec 2013
Posts: 10
Rep Power: 3
mahditorabiasr is on a distinguished road
Here It is a UDF for simultaneous Rotating and Pitching.
be noticed that the UDF should be set for the blades (considering initial angular its position)
and the "Releative specification" option should be set to the rotor's rotating frame.



#include "udf.h"

DEFINE_ZONE_MOTION(pitching_blade,omega,axis,origi n,velocity,time,dtime)
{
real theta0, thetap1, omegac, omegar, radius, pi;

pi = 3.141592654;
omegar = 10;
/* pitching velocity of blade [radians/s] */
omegac = 5;
/* angular velocity of rotor [radians/s] */
theta0 = pi/2.; /* initial angular position of blade origin [radians] */
radius = .5; /* radius of rotor [m] */
thetap1 = omegac*(time+dtime); /* angular change from initial position at t+dt */
*omega = omegar; /*
pitching velocity of blade */

/* time-varying origin of the local rotor zone coordinates in meters */
origin[0] =
radius*cos(theta0+thetap1);
origin[1] =
radius*sin(theta0+thetap1);
origin[2] = 0.0;
}



In your case *omega variable should represent the sinusoidal time function.
mahditorabiasr is offline   Reply With Quote

Old   April 7, 2014, 18:16
Default
  #3
New Member
 
sam daysley
Join Date: Feb 2013
Posts: 28
Rep Power: 3
daysley is on a distinguished road
Thank you mahditorabiasr

I will try this method now so thanks in advance
daysley is offline   Reply With Quote

Old   April 8, 2014, 01:06
Default
  #4
New Member
 
Mahdi Torabi Asr
Join Date: Dec 2013
Posts: 10
Rep Power: 3
mahditorabiasr is on a distinguished road
Welcome daysley,
please let me know if I can be of any further help.
mahditorabiasr is offline   Reply With Quote

Old   April 12, 2014, 14:18
Default
  #5
New Member
 
sam daysley
Join Date: Feb 2013
Posts: 28
Rep Power: 3
daysley is on a distinguished road
Quote:
Originally Posted by mahditorabiasr View Post
Welcome daysley,
please let me know if I can be of any further help.
Hi Mahditorabiasr

I've been playing around with the udf you wrote but i'm having some problems when running it in Ansys. as the turbine rotor rotates, the blades rotate away from their position in the mesh as though the changing origin is incorrectly changing? I don't suppose you have any idea why it would do this do you? everything seems right in the code and the motion is set relative to the rotating zone?

does it have anything to do with the line:

Code:
thetap1 = omegac * (time + dtime)
i dont understand why it is time +dtime?

thanks in advance i've attached my altered code all i have changed is the Pi function and radius etc.

Code:
#include "udf.h"

DEFINE_ZONE_MOTION(pitching_blade,omega,axis,origi n,velocity,time,dtime)
{
real theta0, thetap1, omegac, omegar, radius, pi;

omegar = sin(time) /* arbitrary sine function*/
omegac = 10.94 ; /* pitching velocity of blade [radians/s] */
theta0 = M_PI/2.; /* initial angular position of blade origin [radians] */
radius = .4572; /* radius of rotor */
thetap1 = omegac*(time+dtime); /* angular change from initial position at t+dt */
*omega = omegar; /* pitching velocity of blade */

/* time-varying origin of the local rotor zone coordinates in meters */
origin[0] = radius*cos(theta0+thetap1);
origin[1] = radius*sin(theta0+thetap1);
origin[2] = 0.0;
}
daysley is offline   Reply With Quote

Old   April 15, 2014, 12:58
Default
  #6
New Member
 
Mahdi Torabi Asr
Join Date: Dec 2013
Posts: 10
Rep Power: 3
mahditorabiasr is on a distinguished road
Quote:
Originally Posted by daysley View Post
Hi Mahditorabiasr

I've been playing around with the udf you wrote but i'm having some problems when running it in Ansys. as the turbine rotor rotates, the blades rotate away from their position in the mesh as though the changing origin is incorrectly changing? I don't suppose you have any idea why it would do this do you? everything seems right in the code and the motion is set relative to the rotating zone?

does it have anything to do with the line:

Code:
thetap1 = omegac * (time + dtime)
i dont understand why it is time +dtime?

thanks in advance i've attached my altered code all i have changed is the Pi function and radius etc.

Code:
#include "udf.h"

DEFINE_ZONE_MOTION(pitching_blade,omega,axis,origi n,velocity,time,dtime)
{
real theta0, thetap1, omegac, omegar, radius, pi;

omegar = sin(time) /* arbitrary sine function*/
omegac = 10.94 ; /* pitching velocity of blade [radians/s] */
theta0 = M_PI/2.; /* initial angular position of blade origin [radians] */
radius = .4572; /* radius of rotor */
thetap1 = omegac*(time+dtime); /* angular change from initial position at t+dt */
*omega = omegar; /* pitching velocity of blade */

/* time-varying origin of the local rotor zone coordinates in meters */
origin[0] = radius*cos(theta0+thetap1);
origin[1] = radius*sin(theta0+thetap1);
origin[2] = 0.0;
}
Dear Daysle,
Sorry for late reply.

let me ask whether you have defined separated UDFs or not?
Be sure that you have a UDF for each blade including initial angular position for each ("theta0").
In addition any little difference from the real values in your initial mesh can lead to incorrect position.

Answering your question, "thetap1" returns the angular position in next time step("dtime" is equal to time step which you have set in Fluent).
Code:
thetap1 = omegac*(time+dtime)
mahditorabiasr is offline   Reply With Quote

Reply

Tags
fluent - udf, udf, vawt

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rotating mesh in a moving reference frame mafz1g11 FLUENT 0 March 5, 2014 13:50
2D Pitching Airfoil samcfd Fluent UDF and Scheme Programming 11 February 25, 2014 07:08
How to simulate pitching oscillation? zkdkeen CFX 1 December 11, 2013 17:34
Simulation with a rotating frame within another? siw CFX 0 April 18, 2013 08:13
Blade pitching, butterfly valves, moving mesh Andy Fiedler CFX 6 May 28, 2010 09:55


All times are GMT -4. The time now is 16:55.