CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Issues with UDF for ball movement inside a valve

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

LinkBack Thread Tools Search this Thread Display Modes
Old   July 29, 2015, 14:04
Red face Issues with UDF for ball movement inside a valve
New Member
Ahmed Jalal
Join Date: Mar 2015
Posts: 22
Rep Power: 11
A.Jalal is on a distinguished road
Hello All,

I am trying to simulate motion of a ball in a valve. The model I created is a simple 2D half model of the cross-section of a hypothetical valve. There is an attachment of the model.

I have created a UDF file to define motion of the ball due to velocity using the 6DOF solver. The symmetry line should also be deforming. I have a few questions.

1) Do I need to run a case without any Dynamic Mesh before compiling the code?

2) I keep getting an error that says: Unable to read motion history file

3) Can you please let me know if there are any suggestions to make to the UDF.

Here is the UDF for the motion:

#include "udf.h"

DEFINE_SDOF_PROPERTIES(Lightweight_ball, prop, dt, time,dtime)




prop[SDOF_MASS] = 1e-3;

prop[SDOF_IXX] = 1.92e-8;
prop[SDOF_IYY] = 1.92e-8;
prop[SDOF_IZZ] = 1.92e-8;


And someone suggested I do a changing time step UDF as well:

#include "udf.h"
#include "dx.h"
#include "grid.h"
#include "var.h"
#include "mem.h"
#include "dynamesh_tools.h"

int z_ID =5;
real urf = 0.5;
real mydx=1e-5;
real maxT= 1e-3;
real minT= 1e-10;

real time_step;
real my_vel;
real TS1;

Dynamic_Thread *ndt = NULL;

Thread *ball_ft = Lookup_Thread(d,z_ID);
ndt = THREAD_DT(ball_ft);

my_vel = DT_VEL_CG(ndt)[1];

TS1 = ABS(urf*mydx/(my_vel+0.00000001));
//Message("\n My TS1 %f",TS1);

time_step = MIN(TS1,maxT);
//Message("\n My Time Step1 %f",time_step);

time_step = MAX( time_step, minT);
Message("\n My Time Step %f",time_step);

return time_step;

Attached Images
File Type: png Valve Snippet.PNG (12.0 KB, 7 views)
A.Jalal is offline   Reply With Quote

Old   July 30, 2015, 01:11
Senior Member
Join Date: May 2012
Location: Melbourne
Posts: 161
Rep Power: 14
Steffen595 is on a distinguished road
maybe it doesn't save the backup/results/convergence plot files, but no idea, how to make it do it.
Steffen595 is offline   Reply With Quote


6dof, dynamic mesh, mesh motion, udf, valve

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
About UDF compiling issues: 'nmake' Haoyin Shan Fluent UDF and Scheme Programming 15 November 4, 2019 18:05
UDF loading issues xinquanzhoucn Fluent UDF and Scheme Programming 1 February 10, 2013 18:53
Consulting for some issues of FLUENT UDF and UDS wjl163 Fluent UDF and Scheme Programming 2 November 12, 2012 03:24
DEFINE_GRID_MOTION UDF issues quantum.tejas FLUENT 0 June 29, 2011 01:31
UDF issues ehooi FLUENT 4 May 13, 2011 05:21

All times are GMT -4. The time now is 05:46.