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

Oscillating liquid piston with known frequency and amplitude

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 8, 2018, 21:18
Default Oscillating liquid piston with known frequency and amplitude
  #1
New Member
 
Beric Anissa
Join Date: May 2018
Posts: 5
Rep Power: 8
Anissa A is on a distinguished road
Hello,



I'm trying to modelize an oscillating liquid piston. I want to study the surface of the liquid according to the frequency and the amplitude of the piston. I need to use a dynamic mesh and create a sine motion for the piston. I want to use the following C code to program this motion:


#include "udf.h"
DEFINE_PROFILE(unsteady_velocity, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) = 0.05*sin(3.14*t);
}
end_f_loop(f, thread)
}


However, I'm not sure of the units of the amplitude and the frequency I'm using. How can I know if 0.05 is in mm, cm, m ?
Also my simulation is not working well and I haven't seen if the piston is really moving up and down following a sine wave. Is the code correct ?



Thanks for your help
Anissa A is offline   Reply With Quote

Old   July 9, 2018, 20:05
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Fluent uses SI base units and therefore length scales are in metres and time is in seconds. The DEFINE_PROFILE macro is used for changing flow variables such as velocity to impose on a boundary condition (e.g. inlet). The dynamic mesh uses a different set of macros, see "Dynamic Mesh DEFINE Macros" in the UDF manual for reference.
`e` is offline   Reply With Quote

Old   July 9, 2018, 22:27
Default
  #3
New Member
 
Beric Anissa
Join Date: May 2018
Posts: 5
Rep Power: 8
Anissa A is on a distinguished road
Thank you for your reply,



I've checked all the possible macros and maybe you think that DEFINE_CG_MOTION is more suitable to define a piston motion ?
Anissa A is offline   Reply With Quote

Old   July 9, 2018, 23:25
Default
  #4
New Member
 
Beric Anissa
Join Date: May 2018
Posts: 5
Rep Power: 8
Anissa A is on a distinguished road
As I am working in 2D, if the piston motion is given by: y=A*sin(wt), the code will be:


#include "udf.h"

DEFINE_CG_MOTION(piston_motion, dt, vel, omega, time, dtime)
{
real A, w, pi;
pi = 3.14;

NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);


A = 0.005;
w = 2 * pi * 1; /* 1Hz frequency */


vel[0] = 0;
vel[1] = A * sin(w*time);
}


Is that correct ?
Anissa A is offline   Reply With Quote

Old   July 10, 2018, 04:39
Default
  #5
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Is y a position or velocity? The DEFINE_CG_MOTION uses velocities. For an example of using this macro for a piston motion, see: CG Motion UDF Problem
`e` 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
Amplitude spectrum of temperature fluctuations selvam2487 CFX 0 March 16, 2014 13:59
FSI oscillating plate spatialtime CFX 4 April 29, 2009 15:04
urgent! amplitude and frequency Sheila FLUENT 3 June 22, 2006 11:23


All times are GMT -4. The time now is 19:59.