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

UDF code

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 27, 2012, 04:27
Post UDF code
  #1
New Member
 
Yahya Azizi
Join Date: Jul 2012
Posts: 8
Rep Power: 5
yahya_azizi is on a distinguished road
How should I define two rotations for a moving wing?

This code only simulates the roll but when I add pitch the motion becomes completely wrong.

#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(code, 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+pi/2);
dpitch = w*Apitch*cos(w*time+pi/2);

/*euler angles initial frame mod 1*/

omega[0] = droll;
omega[1] = 0;
omega[2] = 0;

Message("time:%f omegax:%f omegay:%f omegaz:%f \n", time, omega[0], omega[1],omega[2]);

}
Attached Images
File Type: png wing.png (18.9 KB, 18 views)
yahya_azizi is offline   Reply With Quote

Old   July 27, 2012, 09:03
Default
  #2
Senior Member
 
duri
Join Date: May 2010
Posts: 130
Rep Power: 7
duri is on a distinguished road
Quote:
Originally Posted by yahya_azizi View Post

droll = w*Aroll*cos(w*time + pi/2);
dpitch = w*Apitch*cos(w*time+pi/2);

}
I hope both droll and dpitch is droll/dt and dpitch/dt, looks to be direct differentiation. You need to use droll*dtime and dpitch*dtime to determine delta omega.
Make sure that the cg location is correct because rotation takes place about cg and not about the origin.
duri is offline   Reply With Quote

Old   July 27, 2012, 14:27
Post
  #3
New Member
 
Yahya Azizi
Join Date: Jul 2012
Posts: 8
Rep Power: 5
yahya_azizi is on a distinguished road
It still doesn't work. The problem is that when I use roll or pitch separately the wing motion is ok but when I consider both of them simultaneously the motion becomes wrong.
yahya_azizi is offline   Reply With Quote

Old   August 6, 2012, 07:59
Default
  #4
New Member
 
santhosh
Join Date: Aug 2012
Posts: 3
Rep Power: 5
santhosh kumar k is on a distinguished road
t=DT_THREAD((Dynamic_Thread*)dt);

I found error in line 21 (t=DT_THREAD((Dynamic_Thread*)dt)

Can any one find solution to this.My problem is 2D and i m applying only rolling motion.
santhosh kumar k is offline   Reply With Quote

Old   August 6, 2012, 08:06
Default Aerofoil rolling UDF
  #5
New Member
 
santhosh
Join Date: Aug 2012
Posts: 3
Rep Power: 5
santhosh kumar k is on a distinguished road
Structure reference is not implemented is error showing in line21( posted previously)
santhosh kumar k is offline   Reply With Quote

Reply

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
The FOAM Documentation Project - SHUT-DOWN holger_marschall OpenFOAM 242 March 7, 2013 13:30
Dynamic Mesh UDF Qureshi FLUENT 1 December 2, 2009 01:27
Brownian Motion UDF Code Confuser FLUENT 1 November 1, 2005 11:37
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


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