
[Sponsors] 
December 14, 2007, 13:40 
Accelarating of a cylinder UDF

#1 
Guest
Posts: n/a

I am writing a udf program to accelerate a cylinder in a wind tunnel from 0m/s to 5 m/s in the ve x direction and then keeping its velocity constant to 5 m/s.this udf will be complined in fluent.can anyone please help me write the udf problem. i have written the problem as under
#include "udf.h" #include "dynamesh_tools.h" static real v_prev = 0.0; DEFINE_CG_MOTION(cylinder, dt, vel, time, dtime) { Thread *t; face_t f; real dv; /* reset velocities */ NV_S (vel, =, 0.0); if (!Data_Valid_P ()) return; /* get the thread pointer for which this motion is defined */ t = DT_THREAD ((Dynamic_Thread *)dt); /* compute change in velocity */ dv = dtime * 5 ; v_prev += dv; Message ("time = %f, x_vel = %f, , time, v_prev,); /* set xcomponent of velocity */ vel[0] = v_prev; } 

December 19, 2007, 21:03 
Accelarating of a cylinder UDF

#2 
Guest
Posts: n/a

I am writing a udf program to accelerate a cylinder in a wind tunnel from 0m/s to 5 m/s in the ve x direction and then keeping its velocity constant to 5 m/s.this udf will be complined in fluent.can anyone please help me write the udf problem. i have written the problem as under
#include "udf.h" #include "dynamesh_tools.h" static real v_prev = 0.0; DEFINE_CG_MOTION(cylinder, dt, vel, time, dtime) { Thread *t; face_t f; real dv; /* reset velocities */ NV_S (vel, =, 0.0); if (!Data_Valid_P ()) return; /* get the thread pointer for which this motion is defined */ t = DT_THREAD ((Dynamic_Thread *)dt); /* compute change in velocity */ dv = dtime * 5 ; v_prev += dv; Message ("time = %f, x_vel = %f, , time, v_prev,); /* set xcomponent of velocity */ vel[0] = v_prev; } 

December 20, 2007, 05:49 
Re: Accelerating of a cylinder UDF

#3 
Guest
Posts: n/a

Hi,
your code had two minor errors. Below they are corrected and commented. The program itself works now. Now you still need to define the acceleration. I suggest you use an ifcondition until 5 m/s has been reached: real a = ...; // define acceleration if (v_prev < 5) { dv = 0.5 * a * dtime * dtime; v_prev += dv; } vel[0] = v_prev; Hope this helps with your problem. Regards szz #include "udf.h" #include "dynamesh_tools.h" static real v_prev = 0.0; // omega is a mandatory argument DEFINE_CG_MOTION(cylinder, dt, vel, omega, time, dtime) { Thread *t; face_t f; real dv; /* reset velocities */ NV_S (vel, =, 0.0); if (!Data_Valid_P ()) return; /* get the thread pointer for which this motion is defined */ t = DT_THREAD ((Dynamic_Thread *)dt); /* compute change in velocity */ dv = dtime * 5 ; v_prev += dv; Message ("time = %f, x_vel = %f\n", time, v_prev); // Syntax error corrected /* set xcomponent of velocity */ vel[0] = v_prev; } 

December 20, 2007, 06:43 
Re: Accelarating of a cylinder UDF

#4 
Guest
Posts: n/a

Sorry, I had a mistake in my post: It should be
dv = a * dtime; Greetings szz 

August 3, 2010, 06:52 
rotation about z axis

#5 
Member
ahmad
Join Date: Jul 2010
Posts: 57
Rep Power: 8 
hi everybody...
first please let me brief you my problem,these two image that i sent you are simulated in gambit, both of them are kind of peristaltic pump,i want to rotate two/one small cylinder about z axis,i should write an udf,for this simple movement i used following udf # include "udf.h" # include "dynamesh_tools.h" DEFINE_CG_MOTION(pump,dt,vel,omega,time,dtime) { Thread *t; real freq_t; NV_S(vel,=,0.0); NV_S(omega,=,0.0); if(!Data_Valid_P()) return; freq_t = 4.0; t= DT_THREAD((Dynamic_Thread*)dt); vel[0] = 0.0; vel[1] = 0.0; vel [2] = 0.0; omega [0] = 0.0; omega [1] = 0.0; omega [2] = freq_t; } but it does not work (the small cylinder does not rotate so i can not make an animation to show continuous variation of pressure on it) i will be thankful if you could help me out looking forward to ur help.. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
UDF in Fluent  Andrew  Fluent UDF and Scheme Programming  5  March 7, 2016 04:38 
UDF for free vibration of cylinder  colopolo  FLUENT  3  February 22, 2016 07:11 
Negative volumes when using UDF in VIV in a cylinder  wcoche  Fluent UDF and Scheme Programming  4  October 19, 2012 07:25 
UDF of flow over oscillating cylinder 2D case  imharoon1  FLUENT  3  August 28, 2011 01:46 
[Earn cash] UDF For freely vibrating cylinder  Ken  FLUENT  1  January 1, 2011 16:27 