TAGGED: #fsi-#transient, 2d-cfd, around-the-cylinder, lift-coefficient, oscillating, udf
-
-
May 28, 2025 at 9:11 am
marco.pedata
SubscriberHello Ansys community,
I have a problem similar to a flow around a cylinder in 2D. I expect the cylinder to oscillate due to vortex shedding.
I try to perform a FSI via UDF using DEFINE_CG_MOTION. To solve my desired DGL of motion I need the vertical force on the cylinder. In FLUENT I already created a report file for the lift coefficient. How can I access solution parameters on the cylinder wall inside my UDF file? I already did sth. similar using the DEFINE_SDOF_PROPERTIES function. What are the benefits of solving the DGL inside DEFINE_CG_MOTION myself? Is it also possible using DEFINE_CG_MOTION to specify sourounding cells as Passive inside the Dynamic Mesh tab in FLUENT GUI as it is with DEFINE_SDOF_PROPERTIES?I am looking forward to your ideas and recommendations!
-
May 29, 2025 at 2:06 pm
ashkan.ghafari92
SubscriberHello.
Â
For these types of movements SDOF is the best way since it is designed for it. However, to access the forces you can use Compute_Force_And_Moment command.
-
May 30, 2025 at 9:11 am
marco.pedata
SubscriberHello,
thank you for your reply!I decided on trying both approaches. The SDOF works. As for the DEFINE_CG_MOTION I get the following error when loading the compiled file:Â
ERROR: chip-exec: function "stage::libudf" not found.
Here is a snippet of the udf.c I use:
#include "udf.h"
#include "dynamesh_tools.h"
#include
/* global variables*/static real delta_y_prev = 0.0; Â Â // starting position
static real delta_v_prev = 0.0; Â Â // starting velocity
static real Fy_prev = 0.0; Â Â Â Â // starting vertical force
FILE* fout;/* functions for RK4*/
DEFINE_CG_MOTION(fahrdraht_bewegung, dt, vel, omega, time, dtime) Â Â Â Â Â Â Â Â
{
  Domain* d = Get_Domain(1);
  //Thread * t = Lookup_Thread(d,8);   // gets thread of object with ID (ID from boundary condition in FLUENT GUI)
  Thread * t = DT_THREAD(dt);          // get the thread pointer for which this motion is defined  real force[ND_ND];
  real moment[ND_ND];
  //real cg[ND_ND];  Compute_Force_And_Moment(d, t, NULL, force, moment, FALSE); // Compute_Force_And_Moment(d, t, cg, force, moment, TRUE)
  real Fy = force[1];
  /* System Parameters */
  real rho = 8890.0;    Â
  real area = 1e-4;     Â
  real mass = rho * area;     Â
  real diameter = 12.3e-3;     Â
  real f = 0.8;           Â
  real omega_n = 2 * M_PI * f;    Â
  real z = 0.001;          Â
  real k = mass * omega_n * omega_n;Â
  real c = 2 * mass * omega_n * z; Â
  real rhoFluid = 1.225;    Â  /* External force increment*/
  real deltaP = Fy-Fy_prev;   /* RK4 coefficients */
  /* Calculate change in velocity and position using RK4*/
  real delta_v = delta_v_prev + dtime / 6.0 * (Q1 + 2.0 * Q2 + 2.0 * Q3 + Q4);
  real delta_y = delta_y_prev + delta_v_prev * dtime +
    dtime * dtime / 6.0 * (Q1 + Q2 + Q3);  /* Set Velocitys and Rot */
  vel[0] = 0.0;   Â
  vel[1] += delta_v;  Â  omega[0] = 0.0; Â
  omega[1] = 0.0;  Â  /* Save new values */
  delta_y_prev = delta_y;
  delta_v_prev = delta_v;
  Fy_prev = Fy;
} -
June 2, 2025 at 4:06 am
Rajat Chaudhari
Ansys EmployeeHi Marco,
es, using a Six Degree of Freedom (SDOF) model, you can simulate such scenarios and utilize the
Compute_Force_And_Moment
macro to calculate the forces acting on the body.If you want to move a cell zone such as inflation layers near a wall—while using aÂ
CG_MOTION
UDF, you must apply the same UDF to the cell zone. Alternatively, you can enable the relative motion option and assign zero relative motion to the cell zone with respect to the wall.The error you're encountering may be due to a UDF named "stage" that was previously hooked but is no longer available. To resolve this, either unhook the missing UDF or attach a new one in its place.
-
June 2, 2025 at 9:06 am
marco.pedata
SubscriberHi, thank you for your reply.
The error was indeed due to a previous UDF.
I followed your advise on using relative motion with zeros assigned to the cell zone for the inflation layers. The CG_MOTION approach works now :)SDOF approach: Can you recommend any sources on how the solver works. As for CG_MOTION i can specify the integration method (e.g. explicit Euler or RK4) for my DGL myself. But how is the DGL solved using SDOF?
-
- You must be logged in to reply to this topic.
-
3266
-
1031
-
1004
-
859
-
798
© 2025 Copyright ANSYS, Inc. All rights reserved.