UDFF task report

Name of associated manuals : fluent.htm
Planned / Effective working schedule.  Back to index

Report of

Frederic Deghetto(mfn04), Said Ghalimi(mfn06) and Egil Borge(cshp02)

Subject : Use UDF in Fluent to define boundary and initialization conditions.

We defined boundary conditions and initialization creating C files in which differents functions are used to describe velocity, temperature.... We also defined initilazation conditions with Custom Field Function which allows to define simples condtions. For further information you can consulte the manual.

  1. Parabolic profile for inlet velocity.
  2. Parabolic profile for inlet velocity with a time dependance.
  3. Simple initialization using Custom Field Function.
  4. Initilization using User Defined Function.



Parabolic profile for inlet velocity :

Using constant velocity inlet we obtain :

Using UDF we can define a parabolic inlet velocity profile. The C file needed is :

#include "udf.h"

void inlet_x_velocity(Thread *t, /* thread */

int nv) /* variable number */

{

Face *f;

float y, xv;

/* loop over each of the faces of this zone */

for (f = thread_face(t); f != NULL; f = face_next(f))

{ y = face_centroid_y(f);

xv = 5.0*y/0.01*(0.02-y)/0.01;

set_face_var(f,nv, xv);

}

}

The result is :

Return


Parabolic profile for inlet velocity with a time dependance :

Then we added a time dependance boundary condition. The C file used is :

#include "udf.h"

void inlet_x_velocity_periodique(Thread *t, int nv)

{

Face *f;

float tm, xv;

for (f=thread_face(t); f !=NULL; f=face_next(f))

{

tm=flow_time();

xv=5.0*cos(3.14/2.*tm);

set_face_var(f,nv,xv);

}

}

The result is :

t=0s

t= 2s

Return


Simple initialization using Custom Field Function :

It is possible to define easly initial conditions making use of Custom Field Function. But the number of mathematical functions is very limited.

Return


Initilization using User Defined Function :

We used initialization gived in Rayleigh-Benard. The sintax in C file is :

#include "udf.h"

void initialize()

{

Thread *t;

Cell *c;

float x,y,v;

float A,B,C,D,pi;

A=0.1; B=1.0; C=1.0;D=4.0;

pi=3.141592653898;

t = domain_cellthread(global_domain());

for (c=thread_cell(t) ; c != NULL; c=cell_next(c))

{

x=cell_centroid_x(c);

y=cell_centroid_y(c);

v=A*sin(pi*y/0.02)*(cos(D*pi*x/0.04)+B*cos(C*pi*x/0.04));

set_cell_y_velocity(c,v);

set_cell_x_velocity(c,0.0);

}

}

We obtained :

______________________________________________________________________________

Return

Back to report index