CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Viv 2dof

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 15, 2024, 06:25
Default Viv 2dof
  #1
New Member
 
Mahesh
Join Date: Apr 2024
Posts: 1
Rep Power: 0
Mahesh_M is on a distinguished road
Hello Everyone,
I am trying to simulate VIV in 2dof of a circular cylinder and is using overset meshing and the dynamic mesh with the help of the UDF. The fluid is air and the time step size is 0.05s. I tried so many times but the negative cell volume error is still showing. Can anyone please help me identify and correct the mistake I have been doing? I am attaching the UDF code below:
#include "udf.h"
#include "sg_mem.h"
#include "dynamesh_tools.h"
#include "unsteady.h"
#define mass 0.1
#define md 0.00962
#define fn 0.0261
#define z 0.002
#define ZONE_ID1 7
static real v_prev1, v_prev0;
static int i;
static real Fx, Fy;
static real wn, k, c, dv;
FILE *fout, *fout1;
DEFINE_EXECUTE_AT_END(vel)
{
Thread *t;
Dynamic_Thread *dt;
Domain *d = Get_Domain(1);

real vel[3], x_cg[3], force[3], moment[3];
real time, dtime;
real X[100000];
real Y[100000];
wn = 2*M_PI*fn;
k = (mass+md)*wn*wn;
c = 2*(mass+md)*wn*z;
t = Lookup_Thread(d, ZONE_ID1);

Compute_Force_And_Moment(d, t, x_cg, force, moment, TRUE);
Fx = force[0]; /* force[0] in x direction*/
Fy = force[1];

/* compute the updating position*/
i = N_TIME; /* set i = time step number*/
X[0] = 0;
X[1] = 0;

dtime = CURRENT_TIMESTEP; // Set dtime = timestep/
time = CURRENT_TIME; // time = current time/
X[i+1] = (Fx + X[i]*((2*mass/dtime*dtime)-k)+X[i-1]*((c/2*dtime)-(mass/dtime*dtime)))*(1/((mass/dtime*dtime)+(c/2*dtime)));
X[i+1] = (Fy + Y[i]*((2*mass/dtime*dtime)-k)+Y[i-1]*((c/2*dtime)-(mass/dtime*dtime)))*(1/((mass/dtime*dtime)+(c/2*dtime)));

v_prev1 = (X[i+1] - X[i-1]) / (2*dtime); // inline velocity/
v_prev0 = (Y[i+1] - Y[i-1]) / (2*dtime); // crossflow velocity/
}
/* Update velocity using CG_MOTION Macro*/
DEFINE_CG_MOTION(cylinder, dt, vel, omega, time, dtime)
{
vel[1] = v_prev1; // update crossflow velocity/
vel[0] = v_prev0; // update inline velocity/
fout = fopen("results.txt", "a");
fprintf(fout, "%g %g %g \n", time, DT_CG(dt)[1], DT_CG(dt)[0]);
fclose(fout);
}
Mahesh_M is offline   Reply With Quote

Reply

Tags
2dof, cfd, fdm, 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
UDF Code for VIV of Cylinder using Newmark-Beta Algorithm moj.aerospace Fluent UDF and Scheme Programming 0 August 11, 2023 11:00
VIV Simulation Issue by using the pimpleDyMFoam (openFoam plus) sz617896964 OpenFOAM Running, Solving & CFD 0 November 7, 2019 21:40
Which transition model for VIV on risers? jordan.c Main CFD Forum 0 May 5, 2015 04:34
Turbulence model / Boundary layers on a cylinder (VIV with 2DOF) peatmac FLUENT 3 April 16, 2012 15:23
VIV Sham FLUENT 0 December 14, 2006 23:13


All times are GMT -4. The time now is 03:35.