CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Floating Point Error (https://www.cfd-online.com/Forums/fluent/49159-floating-point-error.html)

Nuno September 1, 2008 18:00

Floating Point Error
 
Hi folks. Im trying to apply a x-velocity profile and a x-momentum source. So i made a file when i put the profile and the source code. When Fluent iterate it given an error: Error: Floatng point erro: invalid number How I can fix that? Thanks for all help

#include "udf.h" /* must be at the beginning of every UDF you write */

#define C2 0.2 #define a 2.0

DEFINE_PROFILE(x_velocity,thread,index) { real x[ND_ND]; /* this will hold the position vector */ real y; face_t f;

begin_f_loop(f,thread) /* loops over all faces in the thread passed

in the DEFINE macro argument */

{

F_CENTROID(x,f,thread);

y = x[1];

F_PROFILE(f,thread,index) = 1.5*pow(y/42,0.14);

} end_f_loop(f,thread) }

DEFINE_SOURCE(xmom_source, c, t, dS, eqn) { real x[ND_ND]; real con, source; C_CENTROID(x, c, t);

con = C2*a*0.5*C_R(c, t)*x[1]; source = -con*sqrt(C_U(c, t)*C_U(c, t)+C_V(c, t)+C_V(c, t))*C_U(c, t); dS[eqn] = -2.*con*sqrt(C_U(c, t)*C_U(c, t)+C_V(c, t)+C_V(c, t));

return source; }



All times are GMT -4. The time now is 13:41.