# Accelarating of a cylinder UDF

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

 December 14, 2007, 13:40 Accelarating of a cylinder UDF #1 Ashutosh 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 x-component of velocity */ vel[0] = v_prev; }

 December 19, 2007, 21:03 Accelarating of a cylinder UDF #2 Natasha 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 x-component of velocity */ vel[0] = v_prev; }

 December 20, 2007, 05:49 Re: Accelerating of a cylinder UDF #3 szz 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 if-condition 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 x-component of velocity */ vel[0] = v_prev; }

 December 20, 2007, 06:43 Re: Accelarating of a cylinder UDF #4 szz 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
#5
Member

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)
{

real freq_t;
NV_S(vel,=,0.0);
NV_S(omega,=,0.0);
if(!Data_Valid_P())
return;
freq_t = 4.0;
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..
Attached Images
 1.JPG (68.2 KB, 10 views) 2.JPG (79.1 KB, 8 views)

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Andrew Fluent UDF and Scheme Programming 5 March 7, 2016 04:38 colopolo FLUENT 3 February 22, 2016 07:11 w-coche Fluent UDF and Scheme Programming 4 October 19, 2012 07:25 imharoon1 FLUENT 3 August 28, 2011 01:46 Ken FLUENT 1 January 1, 2011 16:27

All times are GMT -4. The time now is 15:25.