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

Problem with UDF for CG Circular Motion

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 15, 2016, 15:21
Default Problem with UDF for CG Circular Motion
  #1
New Member
 
Luthfilaudri Nadhira
Join Date: Sep 2016
Posts: 4
Rep Power: 9
luthlau is on a distinguished road
Hi Everyone,

I am quite new in C++ programming, especially in UDF for Fluent. I have tried writing a UDF for circular motion for a solid body with radius "R" (0.05 meter) and constant rotational speed "rpm" (3000 rpm) on x-z plane in clockwise direction.

Below is the UDF I wrote:

===============================================

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

DEFINE_CG_MOTION(circl, dt, vel, omega, time, dtime)

{
real rpm, pi, R, theta;

pi = 3.14159265;
rpm = 2*pi*3000/60;
R = 0.05;
NV_S(vel, = , 0.0);
NV_S(omega, = , 0.0);
vel[0] = R*rpm*sin(rpm*time);
vel[2] = -R*rpm*cos(rpm*time);
theta = rpm*time*180/pi;

Message("time:%f vel0:%f vel2:%f theta:%f \n", time, vel[0], vel[2], theta);
}

===============================================

The problem that I have is the preview motion of the UDF is different for different time step that I used. I believe that different time step should not change the trajectory of the motion, right? It should only affect the smoothness of the motion. I don't what is wrong with my UDF. Does anyone know what is the problem with my UDF?

Thanks in advance!
luthlau is offline   Reply With Quote

Old   September 16, 2016, 02:08
Default
  #2
D.M
Member
 
Davoud Malekian
Join Date: Jan 2016
Posts: 53
Rep Power: 10
D.M is on a distinguished road
Hello,
i give you an example here so maybe we can understand your motion better:
assume that you want to calculate vel[0] for these time steps: 0.1s & 0.25s
until you reach 1 second.
the results are listed below:

for time_step=0.1s *******************for time_step=0.25s
0.1s vel[0]=-129.9******************** 0.25s vel[0]=75
0.2s vel[0]=-129.9
0.3s vel[0]=0
0.4s vel[0]=129.9
0.5s vel[0]=129.9******************** 0.5s vel[0]=129.9
0.6s vel[0]=0
0.7s vel[0]=-129.9
0.8s vel[0]=-129.9********************0.75s vel[0]=150
0.9s vel[0]=0
1s vel[0]=129.9******************** 1s vel[0]=129.9


as you can see in the results, for the time_step=0.25 we didnt get any negative(minus) velocity nor zero velocity, but when the time_step is 0.1s we have zero and negative velocities, the only thing that can be said about your project is that by reducing the time_step your motion can be simulated more accurately but by increasing time_step your motion will be just an approximation of your real motion and it won't be that accurate(so many fluctuations and ... will be dismissed) and one more thing, i think(not sure) your code is ok.

regards,
D.M is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
CG Motion UDF Problem leoarmas Fluent UDF and Scheme Programming 17 February 14, 2023 08:59
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 06:05
problem in definition of secondary phase volume fraction in UDF hadii FLUENT 9 July 20, 2016 04:46
UDF for Airfoil in Circular motion (2D) sohail_27 Fluent UDF and Scheme Programming 4 October 4, 2010 13:36
UDF PROBLEM anant FLUENT 2 January 17, 2007 00:15


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