Fluids

Fluids

Topics relate to Fluent, CFX, Turbogrid and more

Door opening due to pressure force

    • navarag kk
      Subscriber

      i am trying to simulate a door opening due to fluid pressure. The inlet condition is velocity inlet of 10m/s. the udf code is compiling. the MI is constant. but I am not getting the door opening motion even after hooking the udf code and Define_adjust code.

       

      the code is

      #include "udf.h"
      #include
      static real omega_calc = 0.0;
      static real theta=1.082104136;/*need to check*/
      /*extern real omega_out=0.0; */
      real torque_p;

      DEFINE_ADJUST(torque_calculation,domain)
      {
      /* Variables used by serial, host, node versions */
      int surface_thread_id=9;/*door surface id from fluent*/
      real total_area=0.0;
      torque_p=0.0;
      Thread* thread;
      face_t face;
      real area[ND_ND];
      real NV_VEC(A);
      real w[ND_ND];
      thread = Lookup_Thread(domain,surface_thread_id);

      begin_f_loop(face,thread)
      /* If this is the node to which face "officially" belongs,*/
      /* get the area vector and pressure and increment */
      /* the total area and total force values for this node */

      {
      F_AREA(area,face,thread);
      total_area += NV_MAG(area);
      F_AREA(A,face,thread);
      F_CENTROID(w,face,thread);
      torque_p += F_P(face,thread)*NVD_DOT(A,w[1],w[0],0);/*need to check -w[1],w[0] as per geometry*/
      }
      end_f_loop(face,thread)
      }


      DEFINE_CG_MOTION(move_flapper,dt,vel,omega,time,dtime)
      {
      NV_S(omega, =, 0.0);
      node_to_host_real_1(torque_p);
      real torque, domega, omega_prev, omega_dot, omega_out;
      const real inertia = 3.2;
      /* Compute the torque due to pressure P and weight W */
      /*-----------------------------------------------------------------------*/
      /*torque_w= -9.1469 * sin(theta); /* -g*L*W*sin(theta) */
      torque= torque_p ;
      domega = dtime * torque / inertia;
      omega_dot= torque / inertia;
      /* Calculate the angular velocity */
      /*-----------------------------------------------------------------------*/
      omega_prev = omega_calc;
      omega_calc = omega_calc + domega;
      omega_out = omega_calc;
      /* Calculate the angle theta (Taylor expansion) */
      /*-----------------------------------------------------------------------*/
      theta=theta + 0.5*dtime*(omega_prev+omega_calc);
      #if !RP_NODE
      Message ("\ntorque_p = %f,", torque_p);

      Message ("\ntorque = %f,", torque);
      Message ("\ndomega = %f,", domega);
      Message ("\nomega_calc: %f\n", omega_calc);
      Message ("\n---------------------------------------");
      Message ("\ntheta: %f\n", theta);
      #endif
      }
    • SRP
      Ansys Employee

      Hi,

      I suggest you to please check forum discussion on opening and closing of valve which is done using udf: https://forum.ansys.com/forums/topic/how-to-do-a-udf-to-simulate-the-opening-and-closing-of-compressor-valves/

      Hope you will find this useful.

      Thank you.

      • navarag kk
        Subscriber

        I am new to udf and that forum uses other macros which i havent used. Should i change my entire code or can i work on this code?

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