CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

problem of dynamic mesh for a piston model

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

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

Old   April 2, 2009, 00:34
Super Moderator
-mAx-'s Avatar
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 3,243
Rep Power: 34
-mAx- will become famous soon enough
you may use the macro DEFINE_CG_MOTION.
Please refer to chapter 2.6.1 from help

/************************************************** **********
* 1-degree of freedom equation of motion (x-direction)
* compiled UDF
************************************************** **********/

/#include "udf.h"
static real v_prev = 0.0;

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())

/* 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;
force += F_P(f,t) * NV_MAG(A);

/* 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, 14:35
New Member
Join Date: Apr 2010
Posts: 14
Rep Power: 9
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


Thread Tools
Display Modes

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 On
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 04:19
Dynamic mesh problem Karthick FLUENT 1 October 11, 2004 05:47
Boundary conditions for dynamic mesh model lingo FLUENT 4 May 7, 2004 04:02

All times are GMT -4. The time now is 04:50.