CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   lagrange gun UDF (http://www.cfd-online.com/Forums/fluent-udf/111808-lagrange-gun-udf.html)

aydinkabir88 January 16, 2013 01:04

lagrange gun UDF
 
1 Attachment(s)
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)
{
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;
}

But it doesn't work. would you please help me?
thanks.

Marion January 21, 2013 09:42

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.

syavash January 22, 2013 09:40

Quote:

Originally Posted by Marion (Post 403111)
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

aydinkabir88 January 23, 2013 01:05

Quote:

Originally Posted by Marion (Post 403111)
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
thanks in advance.

ghost82 January 23, 2013 15:32

Quote:

Originally Posted by aydinkabir88 (Post 403470)
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

shayegan August 9, 2014 00:34

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?


All times are GMT -4. The time now is 13:51.