# UDF velocity inlet. Different values (compile - Fluent)

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

 July 13, 2018, 18:02 UDF velocity inlet. Different values (compile - Fluent) #1 New Member   South Yorkshire Join Date: May 2018 Posts: 17 Rep Power: 2 Hi all, I am trying to make a UDF file for the inlet velocity of my flow. The flow needs to follow a stepped function: 0 to 0.5 m/s - 0 to 1 second constant 0.5 m/s - 1 to 2 second 0.5 - 1 m/s - 2 to 3 seconds, and so on. Looking tutorials around I made this UDF: Code: ```#include "udf.h" DEFINE_PROFILE(Vinlet, t, i) { real velocity,ct,m; int NN; int N=1; real tstop[7] = {0,1,2,3,4,5,6}; real Vstop[4] = {0,0.2,0.4,0.6}; ct = CURRENT_TIME; face_t f; if (N % 2 != 0) { NN = N*0.5+0.5; m = (Vstop[NN]-Vstop[NN-1])/(tstop[N+1]-tstop[N]); velocity = Vstop[NN-1] + m*(ct-tstop[N-1]); } else { if (N == 2) { velocity = Vstop[1]; } else { velocity = Vstop[NN]; } } if (ct <= tstop[N]+0.001 && ct >= tstop[N]-0.001) { N = N+1; } begin_f_loop(f,t) { F_PROFILE(f,t,i) = velocity; } end_f_loop(f,t) }``` I compile it on an on-line compiler and the velocity follows correctly a stepped function. The problem is that when I try this UDF on FLuent, the velocity increases linearly with time, showing a completely different behaviour. Anyone knows what could be the reason? thank you,

 Tags fluent - udf, udf