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/)
-   -   Problem with UDF! (https://www.cfd-online.com/Forums/fluent-udf/125238-problem-udf.html)

nikiii October 22, 2013 04:52

Problem with UDF!
 
Hello,
What''s wrong with my UDF?
It compiled successfully and when i track particle it work but UDMI couldn't be updated.
Please help me.
thank you.

#include "udf.h"
#include "mem.h"
#define K 1.38e-23
#define e 1.6e-19
#define T 293
#define ci 240
#define E0 8.854e-12
#define pi 3.141593
#define KP 2.5
#define bi 0.00015

DEFINE_DPM_SCALAR_UPDATE(charge,c,t,initialize,p)
{
real Qs, E, Q, tow, towc, Qp, dQ_dt, dQ;

if (initialize)
{
/* this is the initialization call, set:
* p->user[0] contains the melting index, initialize to 0
* viscosity_0 contains the viscosity at the start of a time step*/
C_UDMI(c,t,3)= 0.;
C_UDMI(c,t,2)=0;
}

else
{

E=sqrt(ND_SUM(pow(C_UDMI(c,t,0),2),pow(C_UDMI(c,t, 1),2)));
Qs=(3*pi*E0*KP*pow(P_DIAM(p),2)*E)/(KP+2);
tow=(4*E0)/(C_UDSI(c,t,1)*bi);
towc=(8*E0*K*T)/(P_DIAM(p)*e*ci*C_UDSI(c,t,1));
Qp=Qs*(P_TIME(p)/(P_TIME(p)+tow))+(2*pi*E0*P_DIAM(p)*K*T/e)*log(1+(P_TIME(p)/towc));
dQ_dt=Qs*(tow/(pow((P_TIME(p)+tow),2)))+(2*pi*E0*P_DIAM(p)*K*T/e)*(1/(towc+P_TIME(p)));
dQ=P_DT(p)*dQ_dt;
C_UDMI(c,t,3)=C_UDMI(c,t,2)+dQ;
/* Update UDMI(c,t,2) for start of next step */
C_UDMI(c,t,2) = C_UDMI(c,t,3);
}
}


All times are GMT -4. The time now is 03:55.