Sunteți pe pagina 1din 8

hello everybody and welcome to our new

tutorial today in which we will be

dealing with flow in 2d pipe but before

entering into the tutorial let me

introduce you to user-defined function

or simply saying UDF because we will be

using it in our tutorial so what's a UDF

file IO D a file or a user-defined

function as a function that you write as

a program and can be dynamically loaded

with the fluent solver in order to

enhance the standard features of the

code so why do we use IDF file because

it allows us to customize fluent to fit

our particular modeling needs but what

does all this mean for example if you

want to assign a sinusoidal velocity for

a sinusoidal pressure to your Inlet

boundary instead of the constant value

which is the only value offered by

fluent you will be writing a PDF file

and simply to write the UDF file you

will need to know the basics of the C

programming language and after you have

written your UDF file you will either

interpret it or compile it now I'll not

get deep into this but I'll tell you

when to use each one interpret your file

when you have small straightforward

functions however compile it when you


use complex functions now this is what

the UDF file looks like and in a moment

I will be explaining each statement on

each line what it means now you can

write the UDF file in a text editor such

as notepad but when you save it don't

forget to put dot C as you see here the

name is unsteady dot C now here this is

a note if you want to write a note in

you're inside your code you should put

it in this manner and the following

manner in order not to affect your code

so this is a note specifying what the

code is about what the UDF file is about

and as you see it's a transient velocity

profile boundary condition coming to the

first statement it already identifies

itself every DF file must start with it

include you DF - coming to the second

statement define underscore profile

means that you are defining a function

that varies with respect to space

coordinates such as X or Y or with

respect to time now define alone as you

see here define alone is a macro which

must be used to define your EDF but

what's a macro macro is just a fragment

of code which has been given a name now

coming to the arguments in parentheses


the first one is the UDF name unsteady

underscore velocity and this is the name

that you will choose when you are

assigning the boundary condition at the

inlet now the next argument is a past

time variable thread thread which means

here it is the boundary condition zone

ID you can think of it as a boundary

maybe a wall for example the third

argument and which is the second

variable the second passed and variable

is the index that identifies the

variable that is to be defined in this

case it is the position now the third

statement is the face thread index keep

in mind that each control volume of a

solid or a fluid is called a cell in

fluent

and the data structure for cell phases

is typed as follows it is face

underscore t f which is the face thread

index the fourth statement is as simple

as it looks like it's defining a real

number for the current time flow and

seconds and it's written in the

following manner

real T equal current underscore time

current underscore time it is a

statement known for ANSYS fluent coming

to the fifth statement our objective is


to assign our equation or our function

to every face and the thread therefore

we will we will want to calculate the

equation at every face of the boundary

therefore we open a loop which is begin

underscore f underscore loop and we give

it an argument F comma thread F is the

face and thread is the whole boundary

now the sixth statement exists inside

the loop and it stores a boundary

condition in memory for every face and

our tutorial this is the function or the

equation of the velocity that we will

use and here we arrive at the last

statement which is closing the loop we

began so we close it in this manner now

let's take a look here at this section

of the 2-d pipe that we will see in our

tutorial this is the meshed part this is

a mesh the part of the 2d pipe now what

the UDF is exactly doing it is

calculating for each face the equation

we assigned for it so here is the inlet

boundary we are calculate the UDF is

calculating on each face

the equation we assigned to it so these

are the faces and as you see they are

parts of the whole cell this is a cell

and this is a node and we will all see


this in the tutorial now let's move on

to start our tutorial for 2d pipe flow

simulation okay so now let's start our

analysis by going to a fluid flow fluent

and dragging it to our workbench let's

call it I will call it tutorial don't

forget to change the analysis type to 2d

right click on geometry and let's go to

design modular to sketch our domain so

here we click on XY plane then we click

on Zed and don't forget the unit's put

it in meter and go to sketch we will

just make a simple sketch and let's give

it dimension so here let's give it 15

meters and let's give it a width of

[Music]

let's say 0.5 meters let's go to concept

surface from sketches you can click on

one of these or you can click on this

sketch here and apply generate save and

let's go to mesh and we will not we will

not take much time in meshing because

this tutorial is not about meshing so we

will just generate an acceptable mesh

and proceed with our analysis so here

let's go to the global mesh let's put it

let's say 60 millimeters let's go to

geometry and let's let's click on edges

and assign names create named selection

for each edge now this one is the inlet


the back one is the

outlet the upper one is the PI pole or

just simply call it wall and the bottom

is the axis since we are dealing with a

symmetric problem now let's generate

measure you can just click on mesh and

update so that it will the mesh will be

generated and it will be taken directly

to fluent okay it's successfully sent to

fluent now go to setup let's choose

double precision processes for and let's

go and start our analysis now here in

general we must choose transient since

the velocity is changing with time okay

now in setting up physics so you can put

energy equation if you are dealing with

heat transfer or temperature and for the

boundary conditions now for the

materials I will leave the same default

air and aluminum and for the boundary

conditions you can double click on Inlet

and it is by default assigned to be

velocity Inlet but you as you can see as

I told you it's only constant values

that is offered by the software so what

we do here is we go to parameters and

customization we right click on

user-defined functions and we go to

interpret the duty FS in order to browse


and to select our file here is the C

file I call it the unsteady click okay

and interpret and you will see four

lines that looks the same as this when

it's interpreted and when it's

interpreted here it is just click close

go back to boundary conditions inlet and

the choose here it is the UDF unsteady

velocity which is the UDF name click OK

and let's go to initialization let's

initialize from

Inlet okay and let's click on initialize

okay and now for solving let's choose

the number of steps to be let's say 50

and let's go to create an animation and

let's make it contour and let's make it

velocity and let's see what it looks

like on the in the interior surface body

make it filled and smooth okay this is

at first and let's close click again on

contour and click OK and start your

before we start your calculation if you

want some reports which are related to

time you can go to surface reports area

weighted average and you can see that

you can make the velocity where's the

velocity here mm-hmm just keep it area

weighted and the field variable u here

you put velocity and for example you

choose to monitor the velocity on the


inlet for example let's say choose

report file report block and print the

console in order to see it when you are

generating the when you are calculating

when you are performing calculations now

click OK and let's go to calculate okay

now here you see it's being calculated

with the and here is the default plot

and here you see it's taking a

sinusoidal shape well not so perfect not

a perfect shape but it's taking us

inside the one and this is the unlit

velocity this is what it looks like and

this is the function that we assigned to

the velocity here is the velocity

magnitude meter per second and it is and

with respect to time and here are the

contours that are being generated by

calculation and here are the magnitudes

of the velocity now you can wait for it

all at the ends I will stop here and

thank you very much for watching and see

you in later tutorials

thank you so much for watching I hope

you benefited from this video and please

subscribe if you like my videos

S-ar putea să vă placă și