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

Having difficulties in writing udf define_CG_motion for a piston

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 2 Post By Jessica.S
  • 1 Post By pakk
  • 2 Post By feel

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 20, 2009, 18:35
Default Having difficulties in writing udf define_CG_motion for a piston
  #1
New Member
 
antonio santos
Join Date: May 2009
Posts: 2
Rep Power: 0
tonisantos is on a distinguished road
Please can someone help me write a udf to define CG_motion for a piston inside a cilinder.
the equation for the position is Y=27*cos(A)+sqrt(100^2 - (27^2)*sin^2(A))

Thank you so much everybody
tonisantos is offline   Reply With Quote

Old   May 5, 2012, 22:32
Default
  #2
New Member
 
Jessica Simberg
Join Date: Mar 2012
Posts: 18
Rep Power: 14
Jessica.S is on a distinguished road
hope it's not too late....

DEFINE_CG_MOTION(piston,dt,vel,omega,time,dtime)
{
real Y = ;
real A = ;

/* reset velocities */
NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);

if (!Data_Valid_P()) /* Do nothing if gradient isn’t allocated yet. */
return;

Y = 27*cos(A)+sqrt(100^2 - (27^2)*sin^2(A));

/* sets the components of velocity */
vel[0] = 0;
vel[1] = Y;
vel[2] = 0;
}

this udf is for the speed not the position.....
Jessica.S is offline   Reply With Quote

Old   February 20, 2015, 07:02
Default
  #3
Member
 
Join Date: Oct 2011
Posts: 80
Rep Power: 15
tsram90 is on a distinguished road
Quote:
Originally Posted by Jessica.S View Post
hope it's not too late....

DEFINE_CG_MOTION(piston,dt,vel,omega,time,dtime)
{
real Y = ;
real A = ;

/* reset velocities */
NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);

if (!Data_Valid_P()) /* Do nothing if gradient isn’t allocated yet. */
return;

Y = 27*cos(A)+sqrt(100^2 - (27^2)*sin^2(A));

/* sets the components of velocity */
vel[0] = 0;
vel[1] = Y;
vel[2] = 0;
}

this udf is for the speed not the position.....

There are many UDFs available for velocity. But I don't know the equation for velocity. I have equation of displacement. How do I implement that?
tsram90 is offline   Reply With Quote

Old   February 20, 2015, 08:30
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Quote:
Originally Posted by tsram90 View Post
There are many UDFs available for velocity. But I don't know the equation for velocity. I have equation of displacement. How do I implement that?
If you have the equation of displacement, it should be easy to derive the equation for velocity, don't you think?

So if I were you, I would go for the easy solution, and use the equation of velocity.
feel likes this.
pakk is offline   Reply With Quote

Old   April 7, 2015, 07:14
Default
  #5
New Member
 
umair
Join Date: Mar 2015
Posts: 1
Rep Power: 0
feel is on a distinguished road
hi friends,
I have a piston sinusoidal motion code ...


#include "udf.h"
#include <stdio.h>

DEFINE_CG_MOTION(piston_mov, dt, vel, omega, time, dtime)
{
real a, w, pi;

pi = 3.1415;

/* define motion variables */
a = 0.007; /* 0.012m movement amplitude */
w = 2 * pi * 30; /* 30Hz (1800rpm) frequency */

/* define object movement law */
vel[0] = 0;
vel[1] = a * w * sin(w*time);
vel[2] = 0;
}


its working very well.

But i want to set the velocity and displacement as according below mentioned equations

Let suppose

equation of displacement

A=0.0036;
theta=0:360;

Xp=A*sin(theta)+(cos(theta))^0.5

And velocity

Vp=A*w(cos(theta)-sin(theta))^-0.5



Please tell me, how i can modify the above udf according these equations

Thanks
chaitanyaarige and Chakra like this.
feel is offline   Reply With Quote

Old   April 13, 2015, 06:03
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
You should write your equations as functions of time. Currently it is a function of theta (which is probably an angle), but you should specify how the angle depends on time.
pakk is offline   Reply With Quote

Reply

Tags
dynamic mesh, piston, udf


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
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 03:36
[snappyHexMesh] crash sHM H25E OpenFOAM Meshing & Mesh Conversion 11 November 10, 2014 12:27
UDF for Piston movement Harish FLUENT 2 July 23, 2004 07:13
Writing UDF for Robbins Bounday Condition KKLAU FLUENT 1 April 7, 2004 00:58
Macros for writing UDF for porosity umesh FLUENT 1 June 13, 2003 05:20


All times are GMT -4. The time now is 00:20.