CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Change the energy Eq. (https://www.cfd-online.com/Forums/fluent/87964-change-energy-eq.html)

m.reza May 4, 2011 03:53

Change the energy Eq.
 
I write this udf and when I run it in fluent I have this error:
" Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: ()
"
and my udf is:
#include "udf.h"
#define C_teta 0.3
#define P_t 0.85

enum
{
source1,
source2,
source3,
source4
};

DEFINE_SOURCE(source_energy , cell, thread, dS, eqn)
{
real coord[ND_ND];
real source,y,T,nu_t,S11,S12,S22;

C_CENTROID(coord,cell, thread);
y = coord[1];

nu_t = C_MU_T(cell,thread)/C_R(cell,thread);
T = C_K(cell, thread)/C_D(cell, thread);


S11 = 0.5*(C_DUDX(cell,thread)+C_DUDX(cell,thread));
S12 = 0.5*(C_DUDY(cell,thread)+C_DVDX(cell,thread));
S22 = 0.5*(C_DVDY(cell,thread)+C_DVDY(cell,thread));

C_UDSI(cell, thread,source1) = T*(2*C_K(cell, thread)/3-2*nu_t*S11)*C_T_G(cell,thread)[0]+T*(-2*nu_t*S12)*C_T_G(cell,thread)[1];
C_UDSI(cell, thread,source2) = T*(-2*nu_t*S11)*C_T_G(cell,thread)[0]+T*(2*C_K(cell, thread)/3-2*nu_t*S22)*C_T_G(cell,thread)[1];
C_UDSI(cell, thread,source3) = nu_t*C_T_G(cell,thread)[0]/P_t;
C_UDSI(cell, thread,source4) = nu_t*C_T_G(cell,thread)[1]/P_t;

source = 0.4*C_teta*C_R(cell,thread)*C_CP(cell,thread)*((C_ UDSI_G(cell, thread,source1)[0])+(C_UDSI_G(cell, thread,source2)[1])-(C_UDSI_G(cell, thread,source3)[0])-(C_UDSI_G(cell, thread,source4)[1]));

dS[eqn] = 0.0;

return source;
}


plz help me.


All times are GMT -4. The time now is 19:44.