Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

How to get hydraulic force on a body in UDF code? Ansys fluent.

    • EngGhost
      Subscriber
      Hello I've successfully simulated the closure of a flapper non-return valve as illustrated.
      The inlet velocity increases gradually with a specific acceleration.
      The following UDF is used to specify the motion of the flapper:
      #include "udf.h"
      DEFINE_SDOF_PROPERTIES(flappers_motion, sdof_prop, dt, time, dtime)
      {
      Six_DOF_Object *sdof_obj = NULL;
      sdof_prop[SDOF_MASS] = 2.73e-3; /* flapper's submerged weight */
      sdof_prop[SDOF_IXX] = 2161.86e-9; /* around the hinge */
      sdof_prop[SDOF_IYY] = 367.96e-9;
      sdof_prop[SDOF_IZZ] = 2471.27e-9;
      real m= sdof_prop[SDOF_MASS];
      real L= 0.024479 ;
      sdof_prop[SDOF_LOAD_M_X] = 0 ;
      sdof_prop[SDOF_LOAD_M_Y] = 0.0;
      sdof_prop[SDOF_LOAD_M_Z] = 0.0;
      real th_deg = theta * 180 * 7 / 22 ; /* valve opening angle, in degree */
      sdof_obj = Get_SDOF_Object(DT_PU_NAME(dt));
      if (NULLP(sdof_obj))
      {
      /* Allocate_SDOF_Object must be called with the same name as the udf */
      sdof_obj = Allocate_SDOF_Object(DT_PU_NAME(dt));
      SDOFO_1DOF_R_P(sdof_obj) = TRUE; /*1DOF rotation*/
      SDOFO_DIR(sdof_obj)[0] = 1.0;
      SDOFO_DIR(sdof_obj)[1] = 0.0;
      SDOFO_DIR(sdof_obj)[2] = 0.0;
      SDOFO_CENTER_ROT(sdof_obj)[0] = 0.0;
      SDOFO_CENTER_ROT(sdof_obj)[1] = 0.0;
      SDOFO_CENTER_ROT(sdof_obj)[2] = 0.0;
      SDOFO_CONS_P(sdof_obj) = TRUE; /* constrained motion */
      if (SDOFO_CONS_P(sdof_obj))
      {
      SDOFO_LOC(sdof_obj) = 0.0;
      SDOFO_MIN(sdof_obj) = -0.0349 ; /* min allowable angle */
      SDOFO_MAX(sdof_obj) = 1.0471 ; /* max allowable angle */
      SDOFO_INIT(sdof_obj) = SDOFO_LOC(sdof_obj);
      SDOFO_LOC_N(sdof_obj) = SDOFO_LOC(sdof_obj);
      }
      }
      }
      But now I want to simulate the closure of the flapper, taking into account the friction at the flapper's hinge.
      I tried to just assign the friction value to "sdof_prop[SDOF_LOAD_M_X]" ,but the flapper started to move backwards (opening) until the flow increases, which is not correct.
      So I want to get the value of the hydrodynamic torque of the flapper, and compare it to the friction with some kind of "if statement" that may look like this:
      real static_friction=.0.005;
      real kinetic_friction=0.003;
      real hydraulic_torque =??? ;
      If (hydraulic_torque {
      sdof_prop[SDOF_LOAD_M_X]=0
      }
      else
      {
      sdof_prop[SDOF_LOAD_M_X]=-1*kinetic_friction;
      }
      BUT THE PROBLEM IS :
      I don't know the udf code that can get the actual value of the hydraulic_torque on the flapper to compare it to the friction value.
      Your help is highly appreciated.
      Thanks a lot in advance. 
    • EngGhost
      Subscriber
      Anyone can help?
    • Surya Deb
      Ansys Employee

      Hello, 

      You might need to calculate the torque separately or inside an UDF. Check this link [https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v221/en/flu_udf/flu_udf_sec_define_cg_motion.html?q=compute_force_and].

      The above link explains how to calculate pressure force on a body. This can be modifed to calculate torque as well.

      Regards,

      SD

Viewing 2 reply threads
  • The topic ‘How to get hydraulic force on a body in UDF code? Ansys fluent.’ is closed to new replies.