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

UDF velocity inlet sinusoidal profile

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 27, 2017, 06:58
Default UDF velocity inlet sinusoidal profile
  #1
New Member
 
Douaa Al-Assaad
Join Date: Feb 2017
Posts: 9
Rep Power: 9
dka14 is on a distinguished road
Hello,

I am assigning to a certain inlet that i have a sinusoidal profile for velocity and everything was working fine,
however i wanted to add a random perturbation to my sine function in the udf to obtain a sinuosoid with some noise.
When i modified my code, fluent did not feel this perturbation much and the profile was still sinusoidal with no noise.

I am attaching my code below:

#include "udf.h"
#include <cstdlib>
#include <ctime>
#include <cmath>
#define w 2.1
#define T 3
#define m 1

DEFINE_PROFILE(inlet_velocity, thread, index)
{
real time = RP_Get_Real("flow-time");
face_t f;
real func;

srand((unsigned int)time(NULL));
double Rnd;
Rnd= rand()%10001/10000.00;
v1 = 2.815+(0.775*sin(2*3.1416*0.5*time));
v2 = 2.765+(0.775*sin(2*3.1416*0.5*time));
noise =(v1-v2)*Rnd;

//face_t f;
//real func;
//real time = RP_Get_Real("flow-time");

if (time<1)
{
func = 0;
}
else
{
func= ((v1+v2)/2)+ pow(-1.0,(floor)(10*Rnd))*noise;
}

begin_f_loop(f, thread) // loop over all faces in the thread passed in the DEFINE_PROFILE macro argument
{
F_PROFILE(f, thread, index) = func;
}
end_f_loop(f, thread)
}

Does anyone have an idea on why it wouldn't take the function that I gave it?

Thank you
dka14 is offline   Reply With Quote

Reply

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
UDF parbolic inlet velocity profile for 3D Ractangular channel flow. srv537 Fluent UDF and Scheme Programming 4 August 10, 2016 09:25
map outlet boundary profile as an inlet condition using UDF Daniel_Khazaei Fluent UDF and Scheme Programming 2 June 20, 2016 11:53
UDF for 3d inlet parabolic velocity profile ? shahzeb irfan Fluent UDF and Scheme Programming 10 March 28, 2016 15:00
simpleFoam: Non-uniform mesh near inlet & outlet causes incorrect velocity profile? Zaphod'sSecondHead OpenFOAM Running, Solving & CFD 0 January 28, 2015 05:17
UDF parallel velocity inlet profile Armengol FLUENT 3 September 30, 2009 15:08


All times are GMT -4. The time now is 19:32.