|
[Sponsors] |
Creating a 3D parabolic velocity profile in a rectangular pipe.. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 26, 2021, 14:00 |
Creating a 3D parabolic velocity profile in a rectangular pipe..
|
#1 |
New Member
Join Date: Oct 2021
Posts: 15
Rep Power: 5 |
I'm wondering if anyone can help me. I'm currently writing a UDF to impose a parabolic velocity profile for fluid flow through a rectangular pipe. I have created a parabolic function for the z-direction (vertical plane) and the y-direction (normal to the direction of fluid flow).
I've used the UDF tutorial as a starting point, and have seen one other similar question, but my problem is different in that the width of the pipe is greater than the height of the pipe. I have defined height as h and width as w, and maximum velocity as u_max. Velocity profile in the y-direction is defined as: u_y = -0.01.*(x[1]*x[1]-w*x[1]+0.25*w*w)+u_max Velocity profile in the z-direction is defined as: u_z = -0.062.*(x[2]*x[2]-h*x[2]+0.25*h*h)+u_max I got to the stage where I had to write the F_PROFILE and realised I was mistaken in my technique as I was defining y as u_y and z as u_z. Please see the code below: #include "udf.h" DEFINE_PROFILE(inlet_x_velocity, thread, position) { real x[ND_ND]; /* this holds a position vector */ real y, w; real z, h; real u, u_max; face_t f; h = 2; /* inlet height in mm */ w = 5; /* inlet width in mm */ u_max = 0.062; /* maximum velocity at centre of the pipe in m/s*/ begin_f_loop(f, thread) { F_CENTROID(x, f, thread); y = x[1]; z = x[2]; F_PROFILE(f, thread, position) = ... } end_f_loop(f, thread) } What I think is required is that I need to create a vector using the F_PROFILE that uses a vector [w,h], and [x[1],x[2]], as well as [0.01, 0.062] and u_max. My issues are: 1. I'm not sure how to implement this in C and also check the velocity profile quickly using ansys FLUENT. 2. The coefficients in the expressions for the velocity profiles in the two directions are rounded to two decimal places and do not give exactly 0 at the walls; can I use a rounding function within the code that is compatible with the ANSYS compiler and solver? |
|
October 27, 2021, 01:10 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
to define profile in several directions you need several define-profile macros
Code:
DEFINE_PROFILE(inlet_x_velocity) DEFINE_PROFILE(inlet_y_velocity) u_y = -0.01.*(x[1]*x[1]-w*x[1]+0.25*w*w)+u_max DEFINE_PROFILE(inlet_z_velocity) u_z = -0.062.*(x[2]*x[2]-h*x[2]+0.25*h*h)+u_max
__________________
best regards ****************************** press LIKE if this message was helpful |
|
October 27, 2021, 05:53 |
|
#3 |
New Member
Join Date: Oct 2021
Posts: 15
Rep Power: 5 |
Hi Alexander. Thank you for your suggestions.
Is it necessary to create a profile for each component of the velocity? I have found a similar problem here that used a circular pipe, and for their solution it was suggested that only one DEFINE_PROFILE is necessary. In case my original question was unclear; what I am after is the velocity in the x-direction, but this velocity changes with dy and dz as described by the functions I derived for my geometry. Velocity in the x-direction should be a component of the velocity in the y and z directions. What makes my problem (seemingly) more complicated is that y>z, so d_u/d_y ≠ d_u/d_z. Thank you |
|
October 27, 2021, 15:17 |
|
#4 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
That y>z is really not relevant, if y=z then your approach would also not work. You need to find out how to make a "parabolic" profile on a rectangle.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
||
October 29, 2021, 11:40 |
|
#5 |
New Member
Join Date: Oct 2021
Posts: 15
Rep Power: 5 |
I think you misunderstood what I wrote; I know these do not represent velocity in the x-direction; I never said that they did! These are velocity profiles in the y and z-plane. If these functions are plotted with a surface plot using Matlab, it would produce a parabola that represents the velocity front at a single point in time.
|
|
October 29, 2021, 14:52 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Your terminology is not standard, that makes it difficult...
You talk about "Velocity profile in the y-direction", where you mean "velocity profile in the x-direction at z=0". Agreed? "I know these do not represent velocity in the x-direction; I never said that they did!" Well, you should have said so, because they are in the x-direction and they are velocity profiles. It's just that they are 1d, where you need 2d. You have to make an equation that combines the 1d profiles into a 2d. You, not Fluent. "If these functions are plotted with a surface plot using Matlab, it would produce a parabola..." The functions are 1d, a surface plot is 2d,and a parabola is 1d. I don't understand how you see this. Maybe you can show the surface plot that you talk about? "... that represents the velocity front at a single point in time. " In time? Is your profile transient? Everything until now suggested a steady-state situation... Do you really mean it like that? If so, you also need to tell us how your profile should change over time.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error with UDF in Fluent - UDF for parabolic developed velocity profile. | Arun_Prasath_M | Main CFD Forum | 1 | October 20, 2022 21:46 |
Velocity profile in pipe is not parabolic, chtMultiRegionFoam | JeffFoam | OpenFOAM Running, Solving & CFD | 1 | February 22, 2021 16:02 |
Transient parabolic 3D velocity profile | mattialupo | Fluent UDF and Scheme Programming | 1 | October 15, 2019 08:35 |
Plot velocity profile along longitudinal axis of pipe | jorgelmilan | EnSight | 8 | July 7, 2018 15:30 |
Terrible Mistake In Fluid Dynamics History | Abhi | Main CFD Forum | 12 | July 8, 2002 10:11 |