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

Adding damping to UDF

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By peatmac

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 19, 2012, 10:48
Post Adding damping to UDF
  #1
New Member
 
Peter
Join Date: Jan 2012
Posts: 29
Rep Power: 14
peatmac is on a distinguished road
Hello,

Below is my UDF for a cylinder undergoing VIV with 2DOF -

#include "udf.h"

static real v_prev = 0.0;
static real v_prev2 = 0.0;

DEFINE_CG_MOTION(osc,dt,vel,omega,time,dtime)
{
Thread *t;
Domain *d = Get_Domain(1);
real x_cg[3], force[3], moment[3];
real accl, dv, accl2, dv2;
real mass = 181.823;
real wn = 1;
real k= mass * wn*wn;
real c = 2*mass*wn*0.00;
real c2 = 4*mass*wn*0.00;
int i;

NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
t = DT_THREAD(dt);
for(i=0;i<3;i++)
x_cg[i]=DT_CG(dt)[i];

Compute_Force_And_Moment(d, t, x_cg, force, moment, TRUE);
force[1] += -k*x_cg[1] - c*vel[1] - c2*vel[1];
force[0] += -k*x_cg[0] - c*vel[0] - c2*vel[0];

accl = force[1]/mass;
dv = accl*dtime;
v_prev+=dv;
vel[1] = v_prev;
printf("Computed force: %g \n", force[1]);
printf("Velocity: %g\n", vel[1]);

accl2 = force[0]/mass;
dv2 = accl2*dtime;
v_prev2+=dv2;
vel[0] = v_prev2;
printf("Computed force: %g \n", force[0]);
printf("Velocity: %g\n", vel[0]);
}


DEFINE_CG_MOTION(osc_inert,dt,vel,omega,time,dtime )
{
vel[0] = 0.0;
vel[1] = v_prev;
}

END

So far this UDF is producing some reasonable results for me, however I want to include structural and fluid damping. Please refer to the two attached images. Currently the cylinder is oscillating under the governing equations in image 1. Is it possible to write a UDF to allow the cylinders to freely oscillate, using the equations in image 2 (in the dimensionless state).
By allowing the cylinders to oscillate under these equations this will introduce structural damping, am I right? Also how would I include fluid damping?

Many thanks in advance.

Peter
Attached Images
File Type: png 1.png (34.6 KB, 126 views)
File Type: png 2.png (28.4 KB, 96 views)
Sudheesh1979 likes this.
peatmac is offline   Reply With Quote

Old   April 23, 2012, 21:34
Default
  #2
New Member
 
Join Date: Oct 2009
Posts: 2
Rep Power: 0
colopolo70 is on a distinguished road
Quote:
Originally Posted by peatmac View Post
Hello,

Below is my UDF for a cylinder undergoing VIV with 2DOF -

#include "udf.h"

static real v_prev = 0.0;
static real v_prev2 = 0.0;

DEFINE_CG_MOTION(osc,dt,vel,omega,time,dtime)
{
Thread *t;
Domain *d = Get_Domain(1);
real x_cg[3], force[3], moment[3];
real accl, dv, accl2, dv2;
real mass = 181.823;
real wn = 1;
real k= mass * wn*wn;
real c = 2*mass*wn*0.00;
real c2 = 4*mass*wn*0.00;
int i;

NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
t = DT_THREAD(dt);
for(i=0;i<3;i++)
x_cg[i]=DT_CG(dt)[i];

Compute_Force_And_Moment(d, t, x_cg, force, moment, TRUE);
force[1] += -k*x_cg[1] - c*vel[1] - c2*vel[1];
force[0] += -k*x_cg[0] - c*vel[0] - c2*vel[0];

accl = force[1]/mass;
dv = accl*dtime;
v_prev+=dv;
vel[1] = v_prev;
printf("Computed force: %g \n", force[1]);
printf("Velocity: %g\n", vel[1]);

accl2 = force[0]/mass;
dv2 = accl2*dtime;
v_prev2+=dv2;
vel[0] = v_prev2;
printf("Computed force: %g \n", force[0]);
printf("Velocity: %g\n", vel[0]);
}


DEFINE_CG_MOTION(osc_inert,dt,vel,omega,time,dtime )
{
vel[0] = 0.0;
vel[1] = v_prev;
}

END

So far this UDF is producing some reasonable results for me, however I want to include structural and fluid damping. Please refer to the two attached images. Currently the cylinder is oscillating under the governing equations in image 1. Is it possible to write a UDF to allow the cylinders to freely oscillate, using the equations in image 2 (in the dimensionless state).
By allowing the cylinders to oscillate under these equations this will introduce structural damping, am I right? Also how would I include fluid damping?

Many thanks in advance.

Peter
Hi, I also have similar problem. Could you kindly let me know how to compute displacement of cylinder in your udf?

Have a nice day.
colopolo70 is offline   Reply With Quote

Old   August 7, 2012, 02:17
Default
  #3
New Member
 
saurav
Join Date: Jul 2012
Posts: 2
Rep Power: 0
saurav2012 is on a distinguished road
hi , have u soved the above udf and validated the results with some journal ???
saurav2012 is offline   Reply With Quote

Old   February 23, 2016, 22:49
Default
  #4
Member
 
N B Khan
Join Date: Jan 2014
Posts: 39
Rep Power: 12
bestniaz is on a distinguished road
Quote:
Originally Posted by peatmac View Post
Hello,

Below is my UDF for a cylinder undergoing VIV with 2DOF -

#include "udf.h"

static real v_prev = 0.0;
static real v_prev2 = 0.0;

DEFINE_CG_MOTION(osc,dt,vel,omega,time,dtime)
{
Thread *t;
Domain *d = Get_Domain(1);
real x_cg[3], force[3], moment[3];
real accl, dv, accl2, dv2;
real mass = 181.823;
real wn = 1;
real k= mass * wn*wn;
real c = 2*mass*wn*0.00;
real c2 = 4*mass*wn*0.00;
int i;

NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
t = DT_THREAD(dt);
for(i=0;i<3;i++)
x_cg[i]=DT_CG(dt)[i];

Compute_Force_And_Moment(d, t, x_cg, force, moment, TRUE);
force[1] += -k*x_cg[1] - c*vel[1] - c2*vel[1];
force[0] += -k*x_cg[0] - c*vel[0] - c2*vel[0];

accl = force[1]/mass;
dv = accl*dtime;
v_prev+=dv;
vel[1] = v_prev;
printf("Computed force: %g \n", force[1]);
printf("Velocity: %g\n", vel[1]);

accl2 = force[0]/mass;
dv2 = accl2*dtime;
v_prev2+=dv2;
vel[0] = v_prev2;
printf("Computed force: %g \n", force[0]);
printf("Velocity: %g\n", vel[0]);
}


DEFINE_CG_MOTION(osc_inert,dt,vel,omega,time,dtime )
{
vel[0] = 0.0;
vel[1] = v_prev;
}

END

So far this UDF is producing some reasonable results for me, however I want to include structural and fluid damping. Please refer to the two attached images. Currently the cylinder is oscillating under the governing equations in image 1. Is it possible to write a UDF to allow the cylinders to freely oscillate, using the equations in image 2 (in the dimensionless state).
By allowing the cylinders to oscillate under these equations this will introduce structural damping, am I right? Also how would I include fluid damping?

Many thanks in advance.

Peter
Dear Friend
I am also looking for the same code,, IF you found the solution please share it... Thanks alot

Regards,
Niaz
bestniaz 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
HELP! adding a mass source to VOF eqn. by UDF??? ROOZBEH FLUENT 5 December 3, 2016 17:53
error about adding Constant damping coefficient stickjohnson ANSYS 0 January 25, 2012 03:49
adding Au (A is a constant) term to the momentum equation via udf shahri20 FLUENT 0 November 29, 2011 05:03
Adding Van der Waals force by coding UDF Long Sang FLUENT 1 June 23, 2008 07:44
How to adding source in UDF? Sam Liu FLUENT 1 November 1, 2005 23:59


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