CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Debugging 3d parabolic udf (http://www.cfd-online.com/Forums/fluent/36906-debugging-3d-parabolic-udf.html)

david June 10, 2005 00:00

Debugging 3d parabolic udf
 
Hi all,

I am just starting my first 3d case and I am having problems with this UDF posted in another thread. I use it for a 3d laminar pipe flow. I was wondering if someone had encountered difficulty using this UDF. The imposed velocity profile should be imposed on the face perpendicular to the z-axis right?

When interpreting I get the following error message. Find below the UDF in question.

Error: GENERAL-CAR-CDR: invalid argument [1]: improper list Error Object: #f

Best Regards, David

---------------------------------------------

DEFINE_PROFILE(z_velocity, thread, position)

{

float r, x[2];

face_t f;

begin_f_loop(f, thread)

{

F_CENTROID(x,f,thread);

/* 3D: r = sqrt(pow(x[0]-xc, 2)+pow(x[1]-yc, 2)); */

/* here: r means not radius but distance from the centerline or symmetryline */ r = x[0]-xc;

F_PROFILE(f,thread,position)=2*umean*(1-pow(r/radius,2));

/* ************************************************** ***** */

/* controle output

printf("x=%.6f\t r=%.6f\t

u=%.5f\n",x[0],r,2*umean*(1-pow(r/radius,2))); */

/************************************************** *******/

}

end_f_loop(f, thread)

}


dirk June 10, 2005 06:37

Re: Debugging 3d parabolic udf
 
Hello David,

I just tried this UDF. You forgot to declare some variables. After doing this it works well.

Dirk

david June 10, 2005 15:51

Re: Debugging 3d parabolic udf
 
Hi Dirk,

Thanks for your response. You were right, I had forgotten to declare some variables. But I now have another problem. Consider the UDF posted which was adapted from the original. I include printf commands to see if UDF executes properly. It appears that the UDF interprets correctly but it seems that FLUENT avoids the code starting from

"begin_f_loop(f, thread)" downward. Do you have any clues why this is happening?

Best Regards David

--------------------------------------------------- #include "udf.h"

/* coordinates of the inlet center */

#define xc 0.

#define yc 0.

/* here: radius means half slit with or distance from the symmetryline to the wall */

#define radius 0.0014

/*mean velocity: (Ufree=Ucenter!!) */

#define umean 0.232

/*================================================= =================*/

DEFINE_PROFILE(z_velocity, thread, position)

{

float r, x[2];

face_t f;

begin_f_loop(f, thread)

{

F_CENTROID(x,f,thread);

r = sqrt(pow(x[0]-xc, 2)+pow(x[1]-yc, 2)); printf("r=%.6f\n",r);

/* here: r means not radius but distance from the centerline or symmetryline */ r = x[0]-xc;

F_PROFILE(f,thread,position)=2*umean*(1-pow(r/radius,2));

printf("x=%.6f\t r=%.6f\t u=%.5f\n",x[0],r,2*umean*(1-pow(r/radius,2)));

}

end_f_loop(f, thread)

}


dirk June 11, 2005 05:07

Re: Debugging 3d parabolic udf
 
This works fine. Just apply the inlet BC, make one iteration and plot the inlet velocity.

david June 13, 2005 14:20

Re: Debugging 3d parabolic udf
 
Hi Dirk, Thank you for responding. I have tried this and it still does not work. I mean it interprets fine but when I apply this profile to my velocity inlet and iterate nothing happens.

I am suspecting that something might be wrong with my mesh itself. Do you have a small 3d mesh file that I could use to test further my UDF as Fluent manual does not provide such mesh files.

If this not possible perhaps I could email my mesh file so you can have a look at it...

Best Regards, David


All times are GMT -4. The time now is 23:06.