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

Udf sdof

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   Yesterday, 05:43
Default Udf sdof
  #1
New Member
 
Join Date: Sep 2024
Posts: 1
Rep Power: 0
fatihaea is on a distinguished road
Hi,

I´m trying to simulate the flow over a circular cylinder that is free to vibrate in both the direction, I´m using this UDF :

#include "udf.h"

DEFINE_SDOF_PROPERTIES(stage, prop, dt, time, dtime)
{
Thread *t;
Domain *d = Get_Domain(1);
real cg[3], vel[3]; // Arrays to store center of gravity position and velocity
real mass = 0.03575;
real f = 10.25;
real wn = 2 * M_PI * f;
real z = 0; // Introduce a small damping factor
real k = 148.28;
real c = 2 * mass * wn * z;

// Thread pointer for which this motion is defined
t = DT_THREAD(dt);

// Set SDOF properties
prop[SDOF_MASS] = mass;
prop[SDOF_ZERO_TRANS_Z] = TRUE;
prop[SDOF_ZERO_ROT_X] = TRUE;
prop[SDOF_ZERO_ROT_Y] = TRUE;
prop[SDOF_ZERO_ROT_Z] = TRUE;

// Get center of gravity position and velocity
cg[0] = DT_CG(dt)[0]; // x-direction
cg[1] = DT_CG(dt)[1]; // y-direction
cg[2] = DT_CG(dt)[2]; // z-direction

vel[0] = DT_VEL_CG(dt)[0]; // x-direction
vel[1] = DT_VEL_CG(dt)[1]; // y-direction
vel[2] = DT_VEL_CG(dt)[2]; // z-direction

// Calculate loads in y direction with damping
prop[SDOF_LOAD_F_X] = -k * cg[0];
prop[SDOF_LOAD_F_Y] = -k * cg[1];
// Open file for appending
FILE *fout = fopen("motion_x_direction01.txt", "a");
if (fout == NULL) {
Message("Error opening file.\n");
return;
}

// Write data into file
fprintf(fout, "%g %g %g %g %g\n", time, cg[0], cg[1], vel[0], vel[1]);

// Close file
if (fclose(fout) != 0) {
Message("Error closing file.\n");
}
}
The UDF is compiled and loaded correctly and it seems to be working, however, the results of displacement I´m getting are much smaller than the reference values, Does anyone have any idea why this is occurring?
fatihaea 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 for one dimensional linear motion based on force maccheese Fluent UDF and Scheme Programming 2 September 1, 2019 02:18
can anyone help me about the udf of dynamic contact angle in FLUENT? Albert Lee FLUENT 0 July 1, 2018 08:21
Save output of udf in another udf! JuanJoMex FLUENT 0 February 8, 2018 12:43
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 00:53
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 04:01


All times are GMT -4. The time now is 19:22.