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 Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 13, 2018, 17:02
Default UDF velocity inlet. Different values (compile - Fluent)
  #1
New Member
 
South Yorkshire
Join Date: May 2018
Posts: 3
Rep Power: 2
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

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF for inlet velocity alongwith UDF for properties akshayy224 FLUENT 0 February 1, 2018 09:17
How to solve UDF compilation problems in Fluent. pakk Fluent UDF and Scheme Programming 15 January 4, 2018 20:01
UDF inlet velocity profile mismatch with Fluent ChristineL Fluent UDF and Scheme Programming 15 November 25, 2016 06:45
UDF - Inlet Velocity Profile (Ansys Fluent) vinayak4399 Fluent UDF and Scheme Programming 0 August 2, 2015 08:18
(UDF) Sinusoidal inlet velocity in Fluent star Fluent UDF and Scheme Programming 1 December 19, 2013 16:23


All times are GMT -4. The time now is 02:30.