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

How to define an axis in UDF?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 8, 2018, 11:16
Default How to define an axis in UDF?
  #1
New Member
 
Join Date: Nov 2016
Posts: 10
Rep Power: 9
Larrabee is on a distinguished road
Hi, everyone. I am now working on a problem about a pitching 2D airfoil. I have written my UDF and it makes the airfoil oscillate. However, the airfoil is now oscillating around Z axis and I want to set the axis to be 1/4 of the chord length. What should I do to the UDF?


#include "udf.h"
#define Freq 2.0
#define w 2.0*M_PI*Freq
#define pitch 7.5*M_PI/180

DEFINE_CG_MOTION(shm, dt, cg_vel, omega, time, dtime)
{
real omega;

omega = pitch*w*cos(w*time);

cg_vel[0] = 0.0;
cg_vel[1] = 0.0;
cg_vel[2] = 0.0;

cg_omega[0] = 0.0;
cg_omega[1] = 0.0;
cg_omega[2] = omega;
}
Larrabee is offline   Reply With Quote

Old   May 8, 2018, 21:27
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
cg_omega[0] = 0.0;
cg_omega[1] = 0.0;
cg_omega[2] = omega;
cg_omega[0] means omega across x axis, cg_omega[1] - across y axis, cg_omega[2] - across z axis

if you want some "mix" axis you should find normalized vector your axis you want and put it here, for instance for vector {1,1,1}:
Code:
cg_omega[0] = 1*omega;
cg_omega[1] = 1*omega;
cg_omega[2] = 1*omega;
best regards
AlexanderZ is offline   Reply With Quote

Old   May 9, 2018, 04:44
Default
  #3
New Member
 
Join Date: Nov 2016
Posts: 10
Rep Power: 9
Larrabee is on a distinguished road
But, the rotating axis is still across the origin. I want to set the axis to be ,say line x=1, and rotate at omega_z=1.
Larrabee is offline   Reply With Quote

Old   May 14, 2018, 10:15
Default
  #4
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 11
obscureed is on a distinguished road
Hi Larrabee,

If you combine rotation about the origin with a translational velocity that keeps the axis-point stationary, then you get rotation about the axis-point.

You could also consider shifting the entire geometry until your axis *is* the origin.

Good luck!
Ed
obscureed is offline   Reply With Quote

Old   July 23, 2018, 00:11
Default
  #5
Member
 
Hanye Azimi
Join Date: Oct 2016
Posts: 42
Rep Power: 9
ronak is on a distinguished road
Quote:
Originally Posted by Larrabee View Post
Hi, everyone. I am now working on a problem about a pitching 2D airfoil. I have written my UDF and it makes the airfoil oscillate. However, the airfoil is now oscillating around Z axis and I want to set the axis to be 1/4 of the chord length. What should I do to the UDF?


#include "udf.h"
#define Freq 2.0
#define w 2.0*M_PI*Freq
#define pitch 7.5*M_PI/180

DEFINE_CG_MOTION(shm, dt, cg_vel, omega, time, dtime)
{
real omega;

omega = pitch*w*cos(w*time);

cg_vel[0] = 0.0;
cg_vel[1] = 0.0;
cg_vel[2] = 0.0;

cg_omega[0] = 0.0;
cg_omega[1] = 0.0;
cg_omega[2] = omega;
}
You are simulating a pitching motion in Fluent,yeah?
you could define the pitching axis in Fluent in this way :
Cell Zone Conditions , rotation-axis origin , x=0.25(if Leading Edge is at 0,0)

you may define this point (0.25*chord length) as the centre of gravity location,too.
ronak is offline   Reply With Quote

Old   July 23, 2018, 00:21
Default
  #6
Member
 
Hanye Azimi
Join Date: Oct 2016
Posts: 42
Rep Power: 9
ronak is on a distinguished road
I'm working on a similar case. It's been validated while angle of attack equals zero but the results doesn't match when there is A.O.A and I don't know how to input Alpha(angle of attack) in the UDF
my UDF is:


#include "udf.h"

#define pi 3.141592653589793 //

DEFINE_CG_MOTION(airfoil_pitch, dt, vel, omega, time, dtime)
{
real pitchampl,omg,frequency;

/* reset velocities */
NV_S (vel, =, 0.0);
NV_S (omega, =, 0.0);

/* motion */
frequency=0.06;
omg=2*pi*frequenc;
pitchampl = 15 * pi / 180; /* angular pitch amplitude */

omega[2] = pitchampl *omg* cos(omg * time);
}
ronak 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
Hydrogen storage by metal hydride longbk FLUENT 12 August 1, 2023 20:13
Help! DMFC UDF problems Biao FLUENT 1 November 2, 2020 07:39
An odd ERROR mdakbari Fluent UDF and Scheme Programming 7 April 4, 2016 04:30
Missing math.h header Travis FLUENT 4 January 15, 2009 11:48
Help: using udf to define direction Bo FLUENT 1 July 16, 2008 06:47


All times are GMT -4. The time now is 08:04.