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/)
-   -   UDS programming in porous media (https://www.cfd-online.com/Forums/fluent-udf/143020-uds-programming-porous-media.html)

aravindbpillai October 14, 2014 13:18

UDS programming in porous media
 
#include "udf.h"
#include"sg.h"
enum
{
E,
N_REQUIRED_UDS
};
DEFINE_ADJUST(e_adjust,domain)
{
if (n_uds < N_REQUIRED_UDS)
Internal_Error("not enough user-defined scalars allocated");
}


DEFINE_SOURCE(energy_source_up,c,t,dS,eqn)
{

dS[eqn]= -49574.9 *pow((C_R(c,t)*C_U(c,t))/C_MU_L(c,t), 0.42 );
return 49574.9 *pow((C_R(c,t)*C_U(c,t))/C_MU_L(c,t), 0.42 )*( 400 -C_UDSI(c,t,E));
}
DEFINE_SOURCE(energy_down_source,c,t,dS,eqn)
{
dS[eqn]= -12.45 *pow((C_R(c,t)*C_U(c,t))/C_MU_L(c,t), 0.96 );
return 12.45 *pow((C_R(c,t)*C_U(c,t))/C_MU_L(c,t), 0.96 )*( 400 -C_UDSI(c,t,E));
}

DEFINE_DIFFUSIVITY(e_diffusivity,c,t,i)
{
real X[ND_ND],xp;

C_CENTROID(X,c,t);
xp = X[0];
if(xp <= 0.035)
{
return 0.2 +( 1.772 *pow( 10.0 ,- 10 )*pow(C_UDSI(c,t,E), 3 ));
}
else
{

return 0.1 +( 1.77 *pow( 10.0 ,- 9 )*pow(C_UDSI(c,t,E), 3 ));
}
}
DEFINE_PROFILE(e_profile,t,i)
{
face_t f;
begin_f_loop (f,t)
{
F_PROFILE(f,t,i)= -2.367*pow(10.0 ,-7 )*(pow(F_UDSI(f,t,i), 4 )- pow( 300.0 , 4 ));
}
end_f_loop (f,t)
}

After hooking the above source code in the fluent, I tried for initializing it.then it showing the error that hav noted blow.Please help me.:(


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: #f

aravindbpillai October 14, 2014 13:45

page 197 talking about flux fuction.What will be the error with my defined variables.?help me plz:(


All times are GMT -4. The time now is 14:00.