We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

6DOF UDF does not seem to work

TAGGED: 

    • Audy Maulizar
      Subscriber

      Dear all, 

      I would like to ask for help regarding the dynamic simulation of vortex-induced oscillation on a bridge deck as shown below.

      I use the 6DOF solver to calculate displacements of the bridge deck due to the aerodynamic forces and for that I've assigned the properties using a UDF with the DEFINE_SDOF_PROPERTIES function since I want to introduce damping to my model. For the UDF, I used codes shown in https://www.youtube.com/watch?v=7MeHvOrXl8g&t=522s as a reference with some modifications to fit with my case study. My UDF source code is outlined as follows:

      #include "udf.h"
      #include "dynamesh_tools.h"

      FILE *fout;

      DEFINE_SDOF_PROPERTIES(bridge_motion_standard, prop, dt, time, dtime)
      {
          Thread *t;
          Domain *d = Get_Domain(1);
          /*real x_cg[3], force[3], moment[3];*/
          real pos_x, pos_y, pos_theta;
          real cg_x = 0; /*center of gravity x*/
          real cg_y = -0.025; /*center of gravity y*/
          real defo_x, defo_y, rot_z; /*displacement variables*/
          real vel_x, vel_y, rot_vel; /*velocity variable*/
          real Fx, Fy, Mz; /*force*/
          real mass = 33.75; /*bridge deck model*/
          real mom_inertia = 1.73; /*moment inertia*/
          real fh = 9.5; /*heave frequency in Hz*/
          real ft = 20.0; /*torsion frequency in Hz*/
          real fd = 0.8*fh; /*drag frequency in Hz*/
          /*natural frequencies in rad/s*/
          real wh = 2*M_PI*fh;
          real wt = 2*M_PI*ft;
          real wd = 2*M_PI*fd;
          real zeta = 0.005; /*damping ratio*/
          /*stiffness calculation*/
          real kh = mass*wh*wh;
          real kt = mom_inertia*wt*wt;
          real kd = mass*wd*wd;
          /*damping coefficient calculation*/
          real ch = 2*mass*wh*zeta;
          real ct = 2*mom_inertia*wt*zeta;
          real cd = 2*mass*wd*zeta;
          
          t = DT_THREAD(dt);
              
              prop[SDOF_MASS] = mass; /* total mass:total length*/
              prop[SDOF_IZZ] = mom_inertia; /*mass moment inertia*/
              
              prop[SDOF_ZERO_TRANS_X] = FALSE;
              prop[SDOF_ZERO_TRANS_Y] = FALSE;
              prop[SDOF_ZERO_TRANS_Z] = TRUE;
              prop[SDOF_ZERO_ROT_X] = TRUE;
              prop[SDOF_ZERO_ROT_Y] = TRUE;
              prop[SDOF_ZERO_ROT_Z] = FALSE;
              
              pos_x = (DT_CG(dt)[0]);
              pos_y = (DT_CG(dt)[1]);
              pos_theta = (DT_THETA(dt)[2]*M_PI/180);
              
              /*deformation calculation*/
              defo_x = pos_x - cg_x;
              defo_y = pos_y - cg_y;
              rot_z = pos_theta;
              
              vel_x = (DT_VEL_CG(dt)[0]);
              vel_y = (DT_VEL_CG(dt)[1]);
              rot_vel = (DT_OMEGA_CG(dt)[2]);
              
              /*spring force and damping force calculation*/
              prop[SDOF_LOAD_F_X] = -kd*defo_x - cd*vel_x;
              prop[SDOF_LOAD_F_Y] = -kh*defo_y - ch*vel_y;
              prop[SDOF_LOAD_M_Z] = -kt*rot_z - ct*rot_vel;
              
              /*results writing to txt files*/
              fout = fopen("displacement_results.txt", "a"); 
              fprintf(fout, "%g %f %f %f \n", time, defo_x, defo_y, rot_z);
              fclose(fout);

              fout = fopen("velocity_results.txt", "a");
              fprintf(fout, "%g %f %f %f \n", time, vel_x, vel_y, rot_vel);
              fclose(fout);

              fout = fopen("acceleration_results.txt", "a");
              fprintf(fout, "%g %f %f %f \n", time, DT_ACC_CG(dt)[0], DT_ACC_CG(dt)[1], DT_ALPHA_CG(dt)[2]);
              fclose(fout);
      }

       

      I have tried compiling and hooking the UDF and there was no problem with that process, however the analysis results showed that the lift-forces and the displacements of the bridge deck increasing continuously instead of reaching a steady-state condition as predicted by other papers related to VIV on a bridge deck. It just seemed like the resistance forces from spring and damping did not exist. Does anybody have any idea what the problem is? I am afraid that FLUENT somehow was not able to read my UDF and it just ended up getting ignored by the program, but I am not sure.

    • Rob
      Forum Moderator

      I'm not going to debug the code, but you may find posting the vel_x, defo_x etc to UDMs to be helpful. That'll show if the data is there or not. 

Viewing 1 reply thread
  • You must be logged in to reply to this topic.