CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   UDF. as always. (

DmP December 7, 2009 09:49

UDF. as always.
Hi all!
I am going to gain an understanding of UDF format. The case is the simplest: 2D tube with an actuator disk model inside. I want to use a DEFINE_SOURCE option to add x-momentum source. The disk has been marked as a separate zone in GAMBIT (width X – 1 cell, height Y – 10 cells).
When I use a constant profile like:

#include "udf.h"

#define CON 100.0

DEFINE_SOURCE(cell_x_source, c, t, dS, eqn)
real x[ND_ND];
real source;

C_CENTROID(x, c, t);

source = CON;

dS[eqn] = 0;

return source;

Everything is fine.
But for a linear or parabolic profile like:

#include "udf.h"

real x[ND_ND];
real source, y;

y = x[1];

source = 100. - 100.*((.7-y)/.5)*((.7-y)/.5);

dS[eqn] = 0.0;

return source;

It doesn’t work – profile is not parabolic after calculations. (y-coordinate changes from 0.2 to 1.2 ).
Could you help me with such stupid problem? Thanks!

All times are GMT -4. The time now is 10:36.