CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   why results different for Compile and Interpret? (https://www.cfd-online.com/Forums/fluent/33395-why-results-different-compile-interpret.html)

Joey April 5, 2004 01:38

why results different for Compile and Interpret?
 
Now, I'm trying to learn how to compose UDF file. I encounter this strange problem. Please help me to solve it. I use the UDF file from the HELP file, and I just add two lines to print out the Re and Cd in the console window. If I interpret this UDF, everything is OK, a lot of Re and Cd numbers are shown in the console window. But when I compile this UDF, UDF can be used and particle can be tracked, but numbers for Re and Cd don't print now. Why this happen? and how to solve this problem? Please help me, thanks a lot!! The UDF is shown below:

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

UDF for computing particle drag coefficient (18 Cd Re/24)

curve as suggested by R. Clift, J. R. Grace and M.E. Weber

"Bubbles, Drops, and Particles" (1978) ************************************************** **********************/

#include "udf.h"

DEFINE_DPM_DRAG(particle_drag_force, Re, p) { real w, drag_force;

printf ("Re is %6.3f\n", Re); if (Re < 0.01)

{

drag_force=18.0;

printf("Cd is %6.3f\n", drag_force);

return (drag_force);

} else if (Re < 20.0)

{

w = log10(Re);

drag_force = 18.0 + 2.367*pow(Re,0.82-0.05*w) ;

printf("Cd is %6.3f\n", drag_force);

return (drag_force);

} else

/* Note: suggested valid range 20 < Re < 260 */

{

drag_force = 18.0 + 3.483*pow(Re,0.6305) ;

printf("Cd is %6.3f\n", drag_force);

return (drag_force);

} }

ap April 5, 2004 15:12

Re: why results different for Compile and Interpre
 
Try to use Message instad of printf. See the UDF manual under Additional macros.

Also, when you print a "real" data, use "%g" instead of "%f".

Hi :)

ap

Joey April 5, 2004 22:26

Re: why results different for Compile and Interpre
 
Thanks very much. Now I get it. :)

ap April 6, 2004 18:19

Re: why results different for Compile and Interpre
 
You're welcome

ap


All times are GMT -4. The time now is 04:34.