Fluids

Fluids

dynamic meshing in piston cyllinder

    • rshukla786
      Subscriber

      i have to provide the motion to two pistons inside cylinder in fluent. two cylinders are connected via a pipe. how to write udf to give motion to both the pistons. I attached the 2D geometry made in ansys 19 modeler. Please help me in to move both the piston and also help me writing the udf its very urgent. I am attaching the image also which I imported in fluent.image of the arrangement

    • Keyur Kanade
      Ansys Employee

      Hello rshukla786,


       


      You can do it by using profile or by using udf. 


      For profile, please see following link. 


      https://www.sharcnet.ca/Software/Fluent6/html/ug/node446.htm


      For udf, you may need to use define_cg_motion macro. Please check its details at following link. 


      https://www.sharcnet.ca/Software/Ansys/17.0/en-us/help/flu_udf/flu_udf_sec_define_cg_motion.html


      Regards,


      Keyur

    • rshukla786
      Subscriber

      thanx for the reply Keyur. the prroblem I am facing is that both pistons have to provide the motion simultaneously. I have got one udf but getting negative volume cell error, I am not familiar very much about udf . This is udf I am using for both pistons but not getting results. There is no compilation error. I am attaching both the udf here you check what modification is required its very urgent please help. I am writing the udf in mthe next reply post, please go through and help if possible.


      Regards


      Rohit Shukla

    • rshukla786
      Subscriber

      UDF for piston 1


      #include "udf.h"


      #define r 0.005  /* i n m et e r */


      #define l .03850 /* i n m et e r */


      #define omega_0 41.88790205 /* Constant rpm for cranking */


      #define I 0.000008596 /* Mass moment of Inertia kg m^2 */


      #define A_1 0.00557923 /* Area of P i s t o n */


      #define A_2 0.00204 /* Area of P i s t o n */


      static real th_n=0.715584993;


      static real omega_n=0;


      DEFINE_CG_MOTION(p1,dt,vel,omega,time,dtime)


      {


      face_t f;


      Thread *t;


      real omega_np1,th_np1,force1,Pressure;


      float stroke;


      if(!Data_Valid_P( ))


      return; /* Donot compute force if the solution is not initialized */


      t = DT_THREAD (dt);


      /* get the thread pointer(dt) corresponding to piston p1 for which the motion is defined */


      /* Compute for ce on thr piston p1 using pressure and area */


      begin_f_loop(f,t)


      {


      Pressure = F_P(f,t);


      }


      end_f_loop(f,t)


      force1 = -(Pressure-101325)*A_1 ;


      if(time<100000)


      {


      omega_n = omega_0;


      th_np1 = th_n+omega_n*dtime;


      }


      else


      {


      omega_np1 = omega_n+Pressure*r*dtime/I*(A_1*sin(th_n)+A_2*sin(th_n+100*M_PI/180)) ;


      th_np1=th_n+omega_n*dtime;


      Message("Pressure=%f,Force1=%fn",Pressure,force1);


      }


      stroke=sqrt(pow(l,2)-pow(r*sin(th_n),2)) ;


      vel[0] = - r*sin(th_n)*(1+r*cos(th_n)/stroke)*(th_np1 -th_n)/dtime;/* Specify y velocity for piston 1*/


      th_n = th_np1;


      omega_n=omega_np1;


      }


       

    • Keyur Kanade
      Ansys Employee

      Hello, 


      Along with udf, you need to select correct smoothing, remeshing, laryering options in dynamic mesh. Usually negative volume comes because of wrong remeshing settings. 


      Please check following for general information about dynamic mesh.


      https://www.sharcnet.ca/Software/Fluent6/html/ug/node444.htm


       


      Regards,


      Keyur

    • rshukla786
      Subscriber

      @keyur I tried everything its not moving. I have to complete this project otherwise i will not get my degree. Please help me. my whatsapp no is  8171385762

    • Keyur Kanade
      Ansys Employee

      Hello, 


      What kind of mesh you are using? Is it tri or quad? Please use structured quad mesh with which you can effectively use layering option in dynamic mesh. 


      You may want to check 


      Other users can chime in to check your udf. 


      Regards,


      Keyur

    • rshukla786
      Subscriber

      okay i will try, i was using triangular till now.

Viewing 7 reply threads
  • You must be logged in to reply to this topic.