CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF Parabolic 2D Velocity Profile Issue (https://www.cfd-online.com/Forums/fluent/212165-udf-parabolic-2d-velocity-profile-issue.html)

chrislyn November 27, 2018 12:43

UDF Parabolic 2D Velocity Profile Issue
 
1 Attachment(s)
Hi,

I am trying to specify a fully developed velocity at the inlet of my gradual expansion diffuser. The UDF is below.

/************************************************** ********
udf_parabolicinlet.c
UDF for specifying a steady-state velocity profile boundary condition
************************************************** ********/

#include "udf.h"

DEFINE_PROFILE(inlet_x_xyvelocity, thread, index)
{
real x[ND_ND];
real y;
face_t f;

begin_f_loop(f, thread)

{
F_CENTROID(x,f,thread);
y = x[1];
F_PROFILE(f, thread, index) = .21 - y*y/(.002*.002)*.21;

}
end_f_loop(f, thread)
}


I plotted the equation in MATLAB and got a nice parabolic profile. However, whenever I run this case, I do not get a smooth graph. I get the graph attached.
Attachment 66979

The steps I follow are:
Write Code...save with file extension ".c"
Interpret it in Setup
Use it as the u component of the velocity inlet boundary condition
Run
Check Velocity Profile

Does anyone know what may be happening here?

LuckyTran November 29, 2018 14:45

To get a smooth curve, you simply need more points. Two things to consider:
Make sure your mesh is fine enough so that the curve appears smooth (it will always be jagged as shown).

How do you produce this plot? Using a line probe or what? Check the settings.


Better just, just plot the full velocity field and look at it and see if it makes sense.

chrislyn December 11, 2018 12:11

Quote:

Originally Posted by LuckyTran (Post 717328)
To get a smooth curve, you simply need more points. Two things to consider:
Make sure your mesh is fine enough so that the curve appears smooth (it will always be jagged as shown).

How do you produce this plot? Using a line probe or what? Check the settings.


Better just, just plot the full velocity field and look at it and see if it makes sense.

Thank you so much! The mesh was too coarse in the initial run. Once I ran a mesh independence test, the profile looked how it was supposed to.


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