UDF Data Structure Fluent 6
UDF Data Structure Fluent 6
UDF Data Structure Fluent 6
UDF
face
Domain
cell cell
Domain Thread
Cell Cell
Cell
The Domain
Domain is the set of connectivity and hierarchy info for the entire data
structure in a given problem. It includes:
all fluid zones (fluid threads)
all solid zones (solid threads)
all boundary zones (boundary threads)
Cell/face - Computational unit, face is one side.
Conservation equations are solved over a cell
Thread - is the collection of cells or faces; defines a
fluid/solid/boundary zone
Note:
FLUENT6 introduces the concept of multi-domain for multiphase
simulations (singlephase simulations uses single domain only)
Each phase has its own Domain-structure
Geometric & common property information will be duplicated among
domains
Multiphase UDF will be discussed later
The Threads
A Thread is a sub-set of the Domain structure
Individual fluid, solid and each boundary zones are identified as
zones and their datatype is maintained as Thread
Zone and Thread terms are often used interchangeably
But Zone/Thread ID and Thread-datatype are different:
Zones are identified at mesh level with an integer ID in the
Define-Boundary_Condition panel
Threads are Fluent-specific datatype that store structured
information about the mesh, connectivity, models, property, etc. all
in one place
Users identify zones through the ID-s
Zone/Thread-ID and Threads are correlated through macro-s
Fluid-1
Fluid-2 Porous Outlet
Inlet
Medium
Domain
of
Solid-2
Analysis
Wall
Corresponding Threads
Data set Wall Solid-2
Fluid-2
Inlet
Domain Outlet
Porous
Medium Fluid-1
Solid-1
Boundary face-thread
Fluid cell-thread the boundary-face ensemble
the Control-volume
ensemble Internal face-thread
the Internal-face ensemble
associated to cell-threads
Nodes
Pointer to a Thread
Given the integer ID of a thread, it is possible to retrieve the pointer to
that thread -
int ID = 1;
Thread *tf = Lookup_Thread(domain, ID);
Conversely, given the pointer to a thread, it is possible to retrieve the
integer ID of that thread -
int ID = 1;
if (THREAD_ID(tf)==1)...
Usage
int ID = 1; int ID = 1;
Thread *tf = Lookup_Thread(domain,ID); thread_loop_f (tf, domain)
begin_f_loop(f, tf) {
if (THREAD_ID(tf)==1)
{ begin_f_loop(f, tf)
F_CENTROID(FC, f, tf); {
printf("x:%f y:%f",FC[0], FC[1]); F_CENTROID(FC, f, tf);
} printf("x:%f y:%f",FC[0],FC[1]);
end_f_loop(f, tf) }
end_f_loop(f, tf)
}
Face Variables
F_P(f,t) Pressure
F_U(f,t)
F_V(f,t) Velocity components
F_W(f,t)
F_T(f,t) Temperature
F_H(f,t) Enthalpy
F_K(f,t) Turbulent kinetic energy
F_D(f,t) Turbulent energy dissipation
F_YI(f,t,i) Species mass fraction
F_UDSI(f,t,i) User defined scalar
F_PROFILE(f,t,i) Boundary profile storage
Any UDF you might write must use one of the DEFINE_ macro-s from
this udf.h file
Part of the udf.h file from ~/Fluent.Inc/fluentx.y/src directory
#define DEFINE_PROFILE(name, t, i) void name(Thread *t, int i)
#define DEFINE_PROPERTY(name,c,t) real name(cell_t c, Thread *t)
#define DEFINE_SOURCE(name, c, t, dS, i) \
real name(cell_t c, Thread *t, real dS[], int i)
#define DEFINE_INIT(name, domain) void name(Domain *domain)
#define DEFINE_ADJUST(name, domain) void name(Domain *domain)
#define DEFINE_DIFFUSIVITY(name, c, t, i) \
real name(cell_t c, Thread *t, int i)