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

UDF for Vortex-Induced Vibrations debug

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By Entwistle

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 7, 2014, 08:54
Default UDF for Vortex-Induced Vibrations debug
  #1
New Member
 
AFM
Join Date: Nov 2013
Posts: 14
Rep Power: 13
Entwistle is on a distinguished road
Hello to everybody;

Now I am investigating about VIV using tappered cylinders (3D); I am using 2-way FSI but the calculations are so slow (LES-WALE model in CFD and non-linear calculation in Transient Structural). I really need to do these calculations faster, so I think in use an UDF for VIV.

Searching in the web, I found the next code, originally for a 2D problem:

Quote:
#include "udf.h"
static real v_prev = 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;
real mass = 0.022;
real wn = 3.0;
real k = mass*wn*wn;
real c = 2*mass*wn*0.0; /*no damping*/
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];

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]);
}

DEFINE_CG_MOTION(osc_inert, dt, vel, omega, time, dtime)
{
vel[0] = 0.0;
vel[1] = v_prev;
}
First of all, when I try to interpret this UDF in my 3D problem the debugger send me a parse error on the line 2; I think that it is not possible to have any error on this line (I wrote all the code by myself using the original file as a reference, so I think that there is not any syntax bug), so it will be greatfull if any could help me about this point.

The second issue is a simple question: Is it possible to use this code in my 3D problem, or I will have to adapt the code?

Thank you very much.

Bests regards.
zhaomu67 and Naeem.rahman47 like this.
Entwistle is offline   Reply With Quote

Old   February 22, 2016, 06:50
Default
  #2
Member
 
N B Khan
Join Date: Jan 2014
Posts: 39
Rep Power: 12
bestniaz is on a distinguished road
Quote:
Originally Posted by Entwistle View Post
Hello to everybody;

Now I am investigating about VIV using tappered cylinders (3D); I am using 2-way FSI but the calculations are so slow (LES-WALE model in CFD and non-linear calculation in Transient Structural). I really need to do these calculations faster, so I think in use an UDF for VIV.

Searching in the web, I found the next code, originally for a 2D problem:

First of all, when I try to interpret this UDF in my 3D problem the debugger send me a parse error on the line 2; I think that it is not possible to have any error on this line (I wrote all the code by myself using the original file as a reference, so I think that there is not any syntax bug), so it will be greatfull if any could help me about this point.

The second issue is a simple question: Is it possible to use this code in my 3D problem, or I will have to adapt the code?

Thank you very much.

Bests regards.
Dear Friend
I am also looking for UDF for 2D and 3D case... If you found the solution please share... n_bkhan@yahoo.com
Thanks
Regards
Niaz
bestniaz is offline   Reply With Quote

Old   March 15, 2016, 19:07
Default
  #3
New Member
 
esho
Join Date: Mar 2016
Posts: 1
Rep Power: 0
esho_adelaide is on a distinguished road
Hi, I know this is an old problem, but the problem you may have had is trying to interpret the udf. Some macros such as those for dynamic meshes do not interpret, but rather are compiled.
On that note, if you got it to work, could you please share your UDF with me?
I am attempting this problem as well to get familiar with dynamic meshing.
Thank you in advance.
esho_adelaide is offline   Reply With Quote

Old   March 16, 2016, 00:02
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 esho_adelaide View Post
Hi, I know this is an old problem, but the problem you may have had is trying to interpret the udf. Some macros such as those for dynamic meshes do not interpret, but rather are compiled.
On that note, if you got it to work, could you please share your UDF with me?
I am attempting this problem as well to get familiar with dynamic meshing.
Thank you in advance.
Thanks dear for your response.


I used the UDF

#include "udf.h"

static real v_prev = 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;
real mass = 0.2;
real wn = 12.0;
real k= mass * wn*wn;
real c = 2*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];

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]);
}


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



Yes you are right the issue is with the intrepret. I successfully run the udf using compiler for 2D problem but i dont know whether it will run on 3D or not. I have 2 more questions
1. how to change the above UDF to forced oscillation to find VIV forces

2. How to measure amplitude and forces... I know the above mentioned UDF calculate the forces(printf("Computed force: %g \n", force[1];
printf("Velocity: %g \n", vel[1]) but I dont know where it will be available in FLUENT ...

I am also very beginner to the dynamic mesh study. My problem is exactly same like your problem.

We can share study with each other if you agree.
My name is niaz and email n_bkhan@yahoo.com

Thanks in advance.
Best Regards
Niaz
bestniaz is offline   Reply With Quote

Old   May 19, 2016, 03:49
Default
  #5
New Member
 
Rahil
Join Date: Mar 2016
Posts: 5
Rep Power: 10
rahilvalani is on a distinguished road
Hi esho_adelaide, were you able to get this working? I am trying this udf for VIV of a 2D cylinder but the cylinder is not moving?
rahilvalani is offline   Reply With Quote

Old   November 23, 2017, 14:46
Default
  #6
New Member
 
Naeem Ur Rahman
Join Date: Nov 2017
Posts: 6
Rep Power: 9
Naeem.rahman47 is on a distinguished road
Quote:
Originally Posted by Entwistle View Post
Hello to everybody;

Now I am investigating about VIV using tappered cylinders (3D); I am using 2-way FSI but the calculations are so slow (LES-WALE model in CFD and non-linear calculation in Transient Structural). I really need to do these calculations faster, so I think in use an UDF for VIV.

Searching in the web, I found the next code, originally for a 2D problem:

First of all, when I try to interpret this UDF in my 3D problem the debugger send me a parse error on the line 2; I think that it is not possible to have any error on this line (I wrote all the code by myself using the original file as a reference, so I think that there is not any syntax bug), so it will be greatfull if any could help me about this point.

The second issue is a simple question: Is it possible to use this code in my 3D problem, or I will have to adapt the code?

Thank you very much.

Bests regards.
Sir how you are simulating this project with fluent and transient structural. If so then what constraint are you using for transient structural for fsi?

Thanks, please help me
Naeem.rahman47 is offline   Reply With Quote

Reply

Tags
3d problem, fsi, udf, viv


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
Particle Injection induced from a UDF Peter023 Fluent UDF and Scheme Programming 3 November 26, 2018 04:55
FSI including flow induced vibrations in porous models oj.bulmer FLUENT 6 October 15, 2013 13:16
FSI including flow induced vibrations in porous models oj.bulmer CFX 2 October 9, 2013 18:38
Request for UDF code for forced vibrations jagadeesh putta FLUENT 0 November 21, 2007 22:43
Debug of UDF in FLUENT summer FLUENT 1 August 29, 2006 18:54


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