6 DOF udf

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

 September 15, 2005, 13:48 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

 September 16, 2005, 01:13 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.

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

 April 6, 2017, 13:58 #4 Senior Member   Have a nice time! Join Date: Feb 2016 Location: mech.eng.ahmedmansour@gmail.com Posts: 291 Rep Power: 11 Hello , could you tell me the basics of using the 6 DOF?

 June 26, 2017, 21:36 #5 Senior Member   Join Date: Jun 2014 Location: Taiwan Posts: 100 Rep Power: 11 The codes seemed OK. But it's for DEFINE_CG_MOTION. Are the codes applicable for DEFINE_SDOF_PROPERTIES? Thank you!