# problem of dynamic mesh for a piston model

 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 1, 2009, 11:16 problem of dynamic mesh for a piston model #1 New Member   pipin Join Date: Apr 2009 Posts: 20 Rep Power: 10 Hi, I have to model a problem of a piston in a cylinder and i want to make an UDF in order to move the piston 2 mm before then 6 mm behind. have you any idea about the UDF to do this? and any advices for this kind of problem? Thanks

 April 2, 2009, 00:34 #2 Super Moderator     Maxime Perelli Join Date: Mar 2009 Location: Switzerland Posts: 3,243 Rep Power: 34 you may use the macro DEFINE_CG_MOTION. Please refer to chapter 2.6.1 from help ************* Example: /************************************************** ********** * 1-degree of freedom equation of motion (x-direction) * compiled UDF ************************************************** **********/ /#include "udf.h" static real v_prev = 0.0; DEFINE_CG_MOTION(piston,dt,vel,omega,time,dtime) { Thread *t; face_t f; real NV_VEC(A); real force, dv; /* reset velocities */ NV_S(vel, =, 0.0); NV_S(omega, =, 0.0); if (!Data_Valid_P()) return; /* get the thread pointer for which this motion is defined */ t = DT_THREAD(dt); } /* compute pressure force on body by looping through all faces */ force = 0.0; begin_f_loop(f,t) { F_AREA(A,f,t); force += F_P(f,t) * NV_MAG(A); } end_f_loop(f,t) /* compute change in velocity, i.e., dv = F * dt /mass velocity update using explicit Euler formula */ dv = dtime * force / 50.0; v_prev += dv; Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev, force); /* set x-component of velocity */ vel[0] = v_prev; }

 August 2, 2010, 14:35 #3 New Member   Zdeth Join Date: Apr 2010 Posts: 14 Rep Power: 9 Can anyone explain to me the use of resetting the velocity? "NV_S (vel, =, 0.0);" I am also trying to model a simple piston in a tube but am having problems with the motion/results

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post David FLUENT 3 March 15, 2012 06:02 Sar_mech FLUENT 1 November 27, 2008 22:17 Hila FLUENT 0 August 19, 2006 04:19 Karthick FLUENT 1 October 11, 2004 05:47 lingo FLUENT 4 May 7, 2004 04:02

All times are GMT -4. The time now is 07:28.