|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Douaa Al-Assaad
Join Date: Feb 2017
Posts: 9
Rep Power: 9 ![]() |
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 |
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
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 |