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

UDF velocity inlet. Different values (compile - Fluent)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 13, 2018, 18:02
Default UDF velocity inlet. Different values (compile - Fluent)
  #1
Member
 
South Yorkshire
Join Date: May 2018
Posts: 33
Rep Power: 8
asking is on a distinguished road
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,
asking is offline   Reply With Quote

Reply

Tags
fluent - udf, udf


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
UDF - Inlet Velocity Profile (Ansys Fluent) vinayak4399 Fluent UDF and Scheme Programming 3 August 25, 2020 15:15
How to solve UDF compilation problems in Fluent. pakk Fluent UDF and Scheme Programming 16 September 10, 2018 03:48
UDF for inlet velocity alongwith UDF for properties akshayy224 FLUENT 0 February 1, 2018 10:17
UDF inlet velocity profile mismatch with Fluent ChristineL Fluent UDF and Scheme Programming 15 November 25, 2016 07:45
(UDF) Sinusoidal inlet velocity in Fluent star Fluent UDF and Scheme Programming 1 December 19, 2013 17:23


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