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

6 DOF udf

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Manoj Kumar

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 15, 2005, 14:48
Default 6 DOF udf
  #1
Manoj Kumar
Guest
 
Posts: n/a
Hi

Can anyone send me 6-dof udf code? Please send me at manoj.me@gmail.com

Thanks

Manoj
  Reply With Quote

Old   September 16, 2005, 02:13
Default Re: 6 DOF udf
  #2
Manoj Kumar
Guest
 
Posts: n/a
I wrote the udf after going through Fluent user guide. Can any one go through it and let me know if I am right in calculating force and moment vectors ..

/*Fluent Six-Degree of freedom User Defined Function (6-DOF udf).*/

#include "udf.h"

/*Define mass */

#DEFINE mass 50

/*Define Moment of Inertia about x-axis*/

#DEFINE Ix 5

/*Define Moment of Inertia about y-axis*/

#DEFINE Iy 5

/*Define Moment of Inertia about z-axis*/

#DEFINE Iz 5

/*Define Center of Gravity*/

#DEFINE cg_x 0

#DEFINE cg_y 0

#DEFINE cg_z 0

static real vx = 0.0;

static real vy = 0.0;

static real vx = 0.0;

static real wx = 0.0;

static real wy = 0.0;

static real wz = 0.0;

DEFINE_CG_MOTION(block,dt,vel,omega,time,dtime)

{ Thread *t;

face_t f;

Node *node;

int n;

real NV_VEC(A);

real Fx, Fy, Fz, Mx, My, Mz;

real dvx, dvy, dvz, dwx, dwy, dwz;

/* reset velocities */

NV_S(vel, =, 0.0);

NV_S(omega, =, 0.0);

if (!Data_Valid_P())

return;

/* get the thread pointer for which this motion is defined */

t = DT_THREAD(dt);

/* compute pressure force on body by looping through all faces */

Fx = 0.0;

Fy = 0.0;

Fx = 0.0;

Mx = 0.0;

My = 0.0;

Mz = 0.0;

begin_f_loop(f,t)

{

f_node_loop(f,t,n)

{

F_AREA(A,f,t);

/* x,y,z - components of Force

x-component of force = Pressure on the face * x-component of Area vector

*/

Fx += F_P(f,t)*A[0];

Fy += F_P(f,t)*A[1];

Fz += F_P(f,t)*A[2];

/* Moment (M) = vector product of Force and Displacement vector (F X r);

F = Fx i + Fy j +Fz k

r = (x - cg_x)i + (y- cg_y)j + (z - cg_z)k

*/

Mx += F_P(f,t)*(A[1]*(NODE_Z(node) - cg_z)-A[2]*(NODE_Y(node) - cg_y));

My += F_P(f,t)*(A[2]*(NODE_X(node) - cg_x)-A[0]*(NODE_Z(node) - cg_z));

Mx += F_P(f,t)*(A[0]*(NODE_Y(node) - cg_y)-A[1]*(NODE_X(node) - cg_x));

}

} end_f_loop(f,t)

/* compute change in velocity, i.e., dv = F * dt / mass

velocity update using explicit Euler formula */

dvx = dtime * Fx / mass;

vx +=dvx;

dvy = dtime * Fy / mass;

vy +=dvy;

dvz = dtime * Fz / mass;

vz +=dvz;

dwx = dtime * Mx / Ix;

wx +=dwx;

dwy = dtime * My / Iy;

wy +=dwy;

dwz = dtime * Mz / Iz;

wz +=dwz;

Message ("time = %f\n", time);

Message ("x_force = %f, y_force = %f, z_force = %f\n", Fx, Fy, Fz); Message ("x_vel = %f, y_vel = %f, z_vel = %f\n", vx, vy, vz);

Message ("x_moment = %f, y_moment = %f, z_moment = %f\n", Mx, My, Mz); Message ("x_omega = %f, y_omega = %f, z_omega = %f\n", wx, wy, wz);

/* set x,y,z-component of velocity */

vel[0] = vx;

vel[1] = vy;

vel[2] = vz;

/* set x,y,z-component of angular velocity */

omega[0]= wx;

omega[1]= wy;

omega[2]= wz;

}
Mad_Ahab likes this.
  Reply With Quote

Old   September 21, 2005, 05:33
Default Re: 6 DOF udf
  #3
Manoj Kumar
Guest
 
Posts: n/a
CG location needs to be updated in the previous code ..

  Reply With Quote

Old   April 6, 2017, 14:58
Default
  #4
Senior Member
 
Have a nice time!
Join Date: Feb 2016
Location: mech.eng.ahmedmansour@gmail.com
Posts: 291
Rep Power: 11
Ahmed Saeed Mansour is on a distinguished road
Hello , could you tell me the basics of using the 6 DOF?
Ahmed Saeed Mansour is offline   Reply With Quote

Old   June 26, 2017, 22:36
Default
  #5
Senior Member
 
Join Date: Jun 2014
Location: Taiwan
Posts: 100
Rep Power: 12
SJSW is on a distinguished road
The codes seemed OK. But it's for DEFINE_CG_MOTION.
Are the codes applicable for DEFINE_SDOF_PROPERTIES?
Thank you!
SJSW 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
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 22:38
Force can not converge colopolo CFX 13 October 4, 2011 23:03
6 DOF udf Manoj Kumar FLUENT 0 October 17, 2005 08:55
Six dof UDF Dr. John Anttonen FLUENT 0 February 22, 2002 15:47


All times are GMT -4. The time now is 21:47.