CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   udf interpretation successful but does't work (http://www.cfd-online.com/Forums/fluent-udf/123875-udf-interpretation-successful-but-doest-work.html)

haoxin September 23, 2013 08:09

udf interpretation successful but does't work
 
Hi,

I need to compile a non-uniform heat flux boundary condition on a cylindrical target. The udf has been successifully interpreted in fluent and I can see the functions listed in the menu of the respecting boundary conditions.

But after I chose them and run the simulation, the results did not present the effects of the B.C. I wonder if i missed some important set-up or if my udf was wrong in some way.

Here are the codes:
/*cylinder wall flux*/
#include "udf.h"
#define a0 0.2262
#define a1 -0.173
#define b1 0.1471
#define a2 -0.04443
#define b2 -0.04578
#define a3 0.009039
#define b3 0.001342
#define a4 0.002360
#define b4 0.006975
#define w 19.87

DEFINE_PROFILE(outwall_flux1, t, i)
{
real x[ND_ND];
real l;
face_t f;
begin_f_loop(f, t)
{
F_CENTROID(x, f, t);
l=x[0];
if(0 <= l <= 0.25)
F_PROFILE(f, t, i)= (1e6)*(a0 + a1*cos(l*w) + b1*sin(l*w) + a2*cos(2*l*w) + b2*sin(2*l*w) + a3*cos(3*l*w) + b3*sin(3*l*w) + a4*cos(4*l*w) + b4*sin(4*l*w));
else
F_PROFILE(f, t, i)=0;
}
end_f_loop(f, t)
}

/*bottom wall flux*/

#include "udf.h"
#define a01 0.3031
#define a11 0.02634
#define b11 -0.02008
#define a21 -0.01549
#define b21 -0.01143
#define a31 -0.003358
#define b31 0.005991
#define w1 32.99
DEFINE_PROFILE(Bottomwall_flux2, t, i)
{
real x[ND_ND];
real y;
real z;
real r;
face_t f;
begin_f_loop(f, t)
{
F_CENTROID(x, f, t);
y=x[1];
z=x[2];
r=sqrt(y*y+z*z);
if(0 <= r <= 0.1)
F_PROFILE(f, t, i)= (1e6)*(a01 + a11*cos(r*w1) + b11*sin(r*w1) + a21*cos(2*r*w1) + b21*sin(2*r*w1) + a31*cos(3*r*w1) + b31*sin(3*r*w1));
else
F_PROFILE(f, t, i)=0;
}
end_f_loop(f, t)
}

I really appreciate it if someone could help!

Best,
Haoxin

kornetka September 23, 2013 15:21

Hi,
I'm not really sure if it will work, but maybe try changing the condition in if statement
Code:

if(0 <= l <= 0.25)
into something like
Code:

if(0 <= l && l <= 0.25)
Though it's only my guess, maybe Fluent has problem with this part of your code.
Cheers,
kornetka

haoxin September 24, 2013 07:25

Quote:

Originally Posted by kornetka (Post 453193)
Hi,
I'm not really sure if it will work, but maybe try changing the condition in if statement
Code:

if(0 <= l <= 0.25)
into something like
Code:

if(0 <= l && l <= 0.25)
Though it's only my guess, maybe Fluent has problem with this part of your code.
Cheers,
kornetka

Hi Kornetka!

It worked! Thanks a lot! I could have never realized this small trick on my own ;).

Cheers,
Haoxin


All times are GMT -4. The time now is 01:49.