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: Invalid number (https://www.cfd-online.com/Forums/fluent/73991-floating-point-error-invalid-number.html)

psb March 22, 2010 04:54

Floating point error: Invalid number
 
Hello,

I am getting the error 'floating point error :Invalid number' immediately after I click 'iterate' for the following udf:

DEFINE_SOURCE(species_sieving, c, t, dS, eqn)

{ real source, con1, con2;
real xf[ND_ND],xc[ND_ND],xd,yd;

cell_t c0, c1;
Thread *tc0, *tc1, *ft;
face_t f;
int n;
c_face_loop(c,t,n)
{
f = C_FACE(c,t,n);
ft = C_FACE_THREAD(c,t,n);
c0 = F_C0(f,ft);
tc0= THREAD_T0(ft);
c1 = F_C1(f,ft);
tc1= THREAD_T1(ft);

C_CENTROID(xc,c,t);
F_CENTROID(xf,f,ft);

xd = xf[0]-xc[0];
yd = xf[1]-xc[1];

C_UDMI(c,t,0)=(C_U(c,t)*C_YI(c,t,0)-C_U(c0,tc0)*C_YI(c0,tc0,0))/xd;

C_UDMI(c,t,1)=(C_V(c,t)*C_YI(c,t,0)-C_V(c0,tc0)*C_YI(c0,tc0,0))/yd;

C_UDMI(c,t,2)=C_UDMI(c,t,0)+C_UDMI(c,t,1);

}

con1=0.8660;
con2=0.4275e-4;
source=con1*C_UDMI(c,t,2)-con2*C_YI(c,t,0);
dS[eqn]=0;
return source;
}


Does anyone know how to debug this code?
Thank you.


All times are GMT -4. The time now is 16:56.