# Velocity waveform with UDF

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

 February 10, 2015, 15:59 Velocity waveform with UDF #1 New Member   Luis Join Date: Nov 2013 Posts: 5 Rep Power: 9 Hi all, hope someone can help with this. I am trying to impose a transient boundary condition on an fluid flow problem in ANSYS Fluent. I've searched online and here for solutions to this problem which involve UDF's, however they all seem to include known velocity functions to represent the waveform, which I don't have. I am simulating pulsatile flow; I have my data set which includes time steps with their associated velocities, but these time steps are not all equal. Can someone please advise me on how I can represent this as my velocity inlet BC. Thanks in advance. Luis

 February 10, 2015, 16:37 #2 Member   Anonymous Join Date: Apr 2013 Posts: 34 Rep Power: 10 You can save all your time steps and velocities in individual text files. Place them in the FLUENT folder along with your udf. You can use commands like fopen and fscanf to open and read the values. For unequal time steps, write a 'for' loop that will interpolate the values between the 2 neighboring time steps.

 February 10, 2015, 16:51 #3 New Member   Luis Join Date: Nov 2013 Posts: 5 Rep Power: 9 Hey thanks for the quick reply. I'm afraid I don't know much about writing code. I have found the following UDF: #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.02 + 0.005*sin(100.*t); } end_f_loop(f, thread) } As I don't have a sin function for my waveform, could you show me how to modify this function to read off my saved time and velocity values using the 'fopen' and 'fscanf' commands?. Also could you please show me how to use the 'for' loop for interpolation between two data points? Appreciate the help. Luis