CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   3-D parabolic velocity Inlet - Steady state - UDF Turbulent Flow (https://www.cfd-online.com/Forums/fluent-udf/152920-3-d-parabolic-velocity-inlet-steady-state-udf-turbulent-flow.html)

mohibanwar May 12, 2015 10:29

3-D parabolic velocity Inlet - Steady state - UDF Turbulent Flow
 
Hello Members,Senior Members,And all others who can help me out,

I am currently seeking help for the 3-D parabolic velocity Inlet UDF for turbulent flow as i have already seen the Fluent User UDF Manual for my case but there i only found a 2d Case and that was not for turbulent inlet velocity profile?
Can any body help me how to fix my problem as i am new User of Fluent and do not know much about UDF and velocity Inlet profiles?

Your Helping Hand will be highly appreciated.

I only found this code but i am not sure whether this will work for my case or not?My case is the velocity Inlet in Negative direction while pipe inlet is 20 mm above XY plane.
Need your Help plzzz.Thanks.

#include "udf.h"

#define PIPE_DIAMETER 10.e-3 // Set here the diameter of your pipe in meters

#define AVG_Z_VELOCITY 1. // Set here the average z velocity at inlet in m/s

DEFINE_PROFILE(paraboloid_velocity, thread, position) { real x[ND_ND];

real coeff,r,v_max;

face_t f;

r = PIPE_DIAMETER/2.; //Calculating radius

v_max = 2.*AVG_Z_VELOCITY; //Calculating paraboloid vertex z (max velocity)

coeff = -v_max/pow(r,2.);

begin_f_loop(f, thread)

{

F_CENTROID(x,f,thread);

F_PROFILE(f, thread, position) = coeff*(pow(x[0],2.) + pow(x[1],2)) + v_max;

} end_f_loop(f, thread) }

mohibanwar May 18, 2015 05:17

Help Required for 3D parabolic Velocity Inlet UDF
 
Hello,
I want to apply a turbulent parabolic velocity inlet for a pipe outlet in 3D which is located 20m above the xy plane along z direction and velocity is in Z-negative direction.I am using power Law for turbulent.
I have manged a code but it has lots of problem?
Can any body can help me to make my code correct i will be really thank ful you guys.I need your helps guys.

CODE is:
#include "udf.h"
#include "math.h"
DEFINE_PROFILE(inlet_z_velocity, thread, index)
{
real xcoord;
real ycoord;
real zcoord;
real a;
real n;
real Umax;
real Umean;
face_t f;
begin_f_loop(f, thread) /*loops over all faces in the thread passed in the DEFINE macro argument*/
{
F_CENTROID(x,f,thread);
xcoord=x[0];
ycoord=x[1];
zcoord=x[2];;

n = 7;
d = 0.001; /* m */
Umean = 15; /* m/s */

Umax = Umean*(((n+1)*(2*n+1))/(2*pow(n,2)));
a = pow((pow(y,2)+pow(z,2)),0.5);
F_PROFILE(f, thread, index) = Umax*pow(1-sqrt(pow(xcoord,2)+pow(ycoord,2))/(d/2),(1/n));
}
end_f_loop(f, thread)
}
Waiting for kind response.

upeksa May 18, 2015 05:31

#include "udf.h"
#include "math.h"
DEFINE_PROFILE(inlet_z_velocity, thread, index)
{
real xcoord;
real ycoord;
real zcoord;
real a;
real n;
real Umax;
real Umean;
real d;
face_t f;
real x[ND_ND];
real y, z;

begin_f_loop(f, thread) /*loops over all faces in the thread passed in the DEFINE macro argument*/
{
F_CENTROID(x,f,thread);
xcoord=x[0];
ycoord=x[1];
zcoord=x[2];;

n = 7;
d = 0.001; /* m */
Umean = 15; /* m/s */
y= ycoord;//¿? I don't know what you mean, could be this?
z=zcoord;//¿?


Umax = Umean*(((n+1)*(2*n+1))/(2*pow(n,2)));
a = pow((pow(y,2)+pow(z,2)),0.5);
F_PROFILE(f, thread, index) = Umax*pow((1-sqrt(pow(xcoord,2)+pow(ycoord,2))/(d/2)),(1/n));//some extra brackets are ok
}
end_f_loop(f, thread)
}

`e` May 18, 2015 05:32

What velocity profile are you expecting from your velocity inlet and what velocity profile are you actually applying with this UDF?

upeksa is correct in that you need to declare the variable "x" if you're using this variable with the F_CENTROID macro.

mohibanwar May 18, 2015 05:45

Hello upeksa and "e",
Thanks a lot for your quick reply and i am really thankful to you.As i am new and i do not know much about UDF what i want is a parabolic velocity profile for a pipe outlet.That round section of that pipe outlet is 20m above the XY plane and my velocity is in negative z direction.So i need to make changes in this code.I have also find another code which is similar to that but i need to make it according to my case?Can you guys can help me?

kindly check this code too:
Thank you so much
#include "udf.h"
#include "math.h"
DEFINE_PROFILE(inlet_x_velocity, thread, index)
{
real x[ND_ND]; /* this will hold the position vector */
real y;
real z;
real a n;
real Umax Umean;
face_t f;
begin_f_loop(f, thread) /*loops over all faces in the thread passed in the DEFINE macro argument*/
{
F_CENTROID(x,f,thread);
y =x[1];
z =x[1];

n = 7;
d = 10; /* cm */
Umean = 3.1; /* m/s */

Umax = Umean*(((n+1)*(2*n+1))/(2*pow(n,2)));
a = pow((pow(y,2)+pow(z,2)),0.5);
F_PROFILE(f, thread, index) = Umax*pow(1-sqrt(pow(x,2)+pow(z,2))/(d/2),(1/n));
}
end_f_loop(f, thread)
}

mohibanwar May 18, 2015 05:55

"e"
 
I need a parabolic velocity Inlet at pipe in Negative Z direction.My case is in 3d the main problem is that so i am not getting help from any where although my problem is not that much complex one?

`e` May 18, 2015 06:56

Are you confusing the inlet and outlet boundary conditions, or are you intending to set a velocity outlet condition?

Have you tried compiling your UDF and what are the results?

pakk May 18, 2015 07:14

You already have a code. You don't tell us what is wrong with it, so it is very difficult to help you.

Does your code compile? If not, what are the error messages?
If it compiles, did it do what you want it to do? If it did not, what did it do wrong?

mohibanwar May 18, 2015 10:08

Quote:

Originally Posted by `e` (Post 546681)
Are you confusing the inlet and outlet boundary conditions, or are you intending to set a velocity outlet condition?

Have you tried compiling your UDF and what are the results?

Hello e actually i do not have VS studio installed in my computer Also some other software.I have put them in torrents for downloading.But to save time i start understanding this code and i want to make changes in the code.
I want velocity Inlet profile in z direction that it.

Thanks a lot for co-ordinating

pakk May 18, 2015 10:15

There is no need to go to torrents to download software to compile UDFs...

You can install the Microsoft Software Development Kit for free, without any legal difficulties.

mohibanwar May 18, 2015 10:34

Quote:

Originally Posted by pakk (Post 546720)
There is no need to go to torrents to download software to compile UDFs...

You can install the Microsoft Software Development Kit for free, without any legal difficulties.

Thanks a lot pakk for being nice.Your Kit help me a lot mine downloads were of 2.8 GBs
Thanks once again


All times are GMT -4. The time now is 18:35.