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

Accelarating of a cylinder UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 14, 2007, 13:40
Default 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;

}
  Reply With Quote

Old   December 19, 2007, 21:03
Default 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;

}
  Reply With Quote

Old   December 20, 2007, 05:49
Default 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;

}

  Reply With Quote

Old   December 20, 2007, 06:43
Default 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
  Reply With Quote

Old   August 3, 2010, 07:52
Default rotation about z axis
  #5
Member
 
ahmad
Join Date: Jul 2010
Posts: 57
Rep Power: 16
almostafa67 is on a distinguished road
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..
Attached Images
File Type: jpg 1.JPG (68.2 KB, 20 views)
File Type: jpg 2.JPG (79.1 KB, 16 views)
almostafa67 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 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 w-coche Fluent UDF and Scheme Programming 4 October 19, 2012 08:25
UDF of flow over oscillating cylinder 2D case imharoon1 FLUENT 3 August 28, 2011 02:46
[Earn cash] UDF For freely vibrating cylinder Ken FLUENT 1 January 1, 2011 16:27


All times are GMT -4. The time now is 16:20.