|
[Sponsors] |
April 1, 2009, 12:16 |
problem of dynamic mesh for a piston model
|
#1 |
New Member
pipin
Join Date: Apr 2009
Posts: 20
Rep Power: 17 |
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, 01:34 |
|
#2 |
Super Moderator
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 3,297
Rep Power: 41 |
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, 15:35 |
|
#3 |
New Member
Zdeth
Join Date: Apr 2010
Posts: 14
Rep Power: 16 |
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic mesh update problem. | David | FLUENT | 3 | March 15, 2012 06:02 |
CFD-3D flow problem using Dynamic mesh method. | Sar_mech | FLUENT | 1 | November 27, 2008 22:17 |
Dynamic Mesh Problem - please help! | Hila | FLUENT | 0 | August 19, 2006 05:19 |
Dynamic mesh problem | Karthick | FLUENT | 1 | October 11, 2004 06:47 |
Boundary conditions for dynamic mesh model | lingo | FLUENT | 4 | May 7, 2004 05:02 |