CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

problem of dynamic mesh for a piston model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 1, 2009, 12:16
Default problem of dynamic mesh for a piston model
  #1
New Member
 
pipin
Join Date: Apr 2009
Posts: 20
Rep Power: 17
pipin is on a distinguished road
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
pipin is offline   Reply With Quote

Old   April 2, 2009, 01:34
Default
  #2
Super Moderator
 
-mAx-'s Avatar
 
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 3,297
Rep Power: 41
-mAx- will become famous soon enough
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;
}
-mAx- is offline   Reply With Quote

Old   August 2, 2010, 15:35
Default
  #3
New Member
 
Zdeth
Join Date: Apr 2010
Posts: 14
Rep Power: 16
zdeth is on a distinguished road
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
zdeth is offline   Reply With Quote

Reply


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 10:32.