CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF error (https://www.cfd-online.com/Forums/fluent-udf/107297-udf-error.html)

er.mkumar September 23, 2012 09:29

UDF error...after compilation
 
Hello All,

here is my UDF for source term of scalar eqn.

#include"udf.h"

#define DELTA_S 107.2
#define DELTA_H 28000
#define k_a 75
#define R_u 8.314
#define phi_s 0.35
#define phi_o 0.15
#define phi 0.2
#define PI 3.14159265359

DEFINE_SOURCE(uds_source,c,t,ds,eqn)
{
real tp;
real rate;
real P_eq;
real arg;
real hys;

arg = PI*(C_UDSI_M1(c,t,0) - 0.5);
hys = tan (arg);
tp = C_T(c,t);
C_UDMI(c,t,2)=tp;
P_eq = pow(2.72,((DELTA_S/R_u)-(DELTA_H/(R_u*tp))+((phi_s+phi_o)*hys)+(phi/2)))*pow(10,5);
C_UDMI(c,t,3)= P_eq;
rate = k_a*pow(2.72,(-E_a/(R_u*tp)))*((P_i-P_eq)/P_eq)*(1-C_UDSI_M1(c,t,0));
C_UDMI(c,t,4)=rate;
return rate;
}

This code is compiling and not showing any error BUT as soon as I run it for iterations: the very first message is

"error: floating point error : Invalid no"

Observation: when I didn't incorporated the ' tan(arg) ' part (along with phi_s, phi_o, phi, arg) it will iterate well.

Could anyone please figure what could be the reason as without incorporating these I won't get the correct result.

here is my actual eqn for P_eq as attachment for your refernce.



Thanking in advance.
----------------
Regards,
Mukesh


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