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

lagrange gun UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 16, 2013, 01:04
Default lagrange gun UDF
  #1
New Member
 
mehdi
Join Date: Jan 2013
Posts: 3
Rep Power: 13
aydinkabir88 is on a distinguished road
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.
Attached Images
File Type: jpg piston.JPG (59.0 KB, 22 views)
aydinkabir88 is offline   Reply With Quote

Old   January 21, 2013, 09:42
Default
  #2
Senior Member
 
Marion
Join Date: Jul 2012
Location: France
Posts: 122
Rep Power: 15
Marion is on a distinguished road
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.
Marion is offline   Reply With Quote

Old   January 22, 2013, 09:40
Default
  #3
Senior Member
 
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18
syavash is on a distinguished road
Quote:
Originally Posted by Marion View Post
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
syavash is offline   Reply With Quote

Old   January 23, 2013, 01:05
Default
  #4
New Member
 
mehdi
Join Date: Jan 2013
Posts: 3
Rep Power: 13
aydinkabir88 is on a distinguished road
Quote:
Originally Posted by Marion View Post
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.
aydinkabir88 is offline   Reply With Quote

Old   January 23, 2013, 15:32
Default
  #5
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27
ghost82 will become famous soon enough
Quote:
Originally Posted by aydinkabir88 View Post
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
ghost82 is offline   Reply With Quote

Old   August 9, 2014, 01:34
Default
  #6
New Member
 
arash
Join Date: Aug 2014
Posts: 9
Rep Power: 12
shayegan is on a distinguished road
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?
shayegan 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 UDF Qureshi FLUENT 7 March 23, 2017 08:37
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 07:12
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 22:38
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03


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