CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   UDF Define_Init velocity profile (

windguy June 9, 2013 07:06

UDF Define_Init velocity profile
1 Attachment(s)
Hi everyone,

I really need your help for a scholar modeling. I want to create as an initial condition on inlet, a velocity profile quite simple : if y<2.5 then U=0, else U=2*y.

The problem is that I never used C language in my life and so as a complete rookie I'm quite lost...

Below you'll find what I've tried to write by copying other examples found on the net.

Thanks a lot for every little help you could give me (and sorry for my english)

Best Regards

Mahboobe365 June 14, 2013 21:03

do you still need help? I can help you

windguy June 19, 2013 01:19

It's a bit too late for my scholar deadline but nevertheless, I'm really interested to know how should I have done this ! So I welcome your help if it's still possible.

Mahboobe365 June 19, 2013 13:45

I guess the problem is due to this part:

you need to define real y[ND_ND];
so your x coordinate will be y[0] and y coordinate will be y[1]
#include "udf.h"
cell_t c;
Thread *t;
real x[ND_ND];
real y;

/* loop over all cell threads in the domain */
/* loop over all cells */
begin_c_loop_all (c,t)
if y>2.5


All times are GMT -4. The time now is 02:54.