# lagrange gun UDF

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

January 16, 2013, 01:04
lagrange gun UDF
#1
New Member

mehdi
Join Date: Jan 2013
Posts: 3
Rep Power: 6
I want to simulate a piston which move on the differential pressure force acting on its two surfaces.
The UDF tha I use is:
/************************************************** **********
* 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)
{
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 */
/* 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;
}

thanks.
Attached Images
 piston.JPG (59.0 KB, 20 views)

 January 21, 2013, 09:42 #2 Senior Member   Marion Join Date: Jul 2012 Location: France Posts: 122 Rep Power: 7 Hi, Why don't you use the "Compute_Force_And_Moment" function for the calculation of the force? I've seen it in the 6DOF examples of the tutorials. Marion.

January 22, 2013, 09:40
#3
Senior Member

Ehsan Asgari
Join Date: Apr 2010
Posts: 311
Rep Power: 10
Quote:
 Originally Posted by Marion Hi, Why don't you use the "Compute_Force_And_Moment" function for the calculation of the force? I've seen it in the 6DOF examples of the tutorials. Marion.
Dear Marion,

What tutorial exactly do you refer?! I can't find it among Fluent tutorials. If you'd have such tutorial would you please send it to me?! Me E-mail is
syavash_azna@yahoo.com

Thank you

January 23, 2013, 01:05
#4
New Member

mehdi
Join Date: Jan 2013
Posts: 3
Rep Power: 6
Quote:
 Originally Posted by Marion Hi, Why don't you use the "Compute_Force_And_Moment" function for the calculation of the force? I've seen it in the 6DOF examples of the tutorials. Marion.

Dear Marion
Would you please send me that axample?
aydinkabir88@gmail.com

January 23, 2013, 15:32
#5
Senior Member

Daniele
Join Date: Oct 2010
Location: Italy
Posts: 996
Rep Power: 17
Quote:
 Originally Posted by aydinkabir88 Dear Marion Would you please send me that axample? aydinkabir88@gmail.com thanks in advance.
Hi, I think you can refer to tutorial 'Projectile Moving Inside a Barrel'; search the pdf on google.
This is the same approach I proposed to you in private message.

Daniele

 August 9, 2014, 00:34 #6 New Member   arash Join Date: Aug 2014 Posts: 9 Rep Power: 4 Hi everyone I have been working on moving projectile in a barrel. I need udf for dynamic mesh(Six degree of freedom solver). can anyone help me?

 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 Qureshi FLUENT 7 March 23, 2017 08:37 pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12 shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14 kim FLUENT 3 October 26, 2011 21:38 Luc SEMINEL FLUENT 0 November 25, 2002 05:03

All times are GMT -4. The time now is 03:41.