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/)
-   -   particle temperature stay low after employing UDF (https://www.cfd-online.com/Forums/fluent-udf/185846-particle-temperature-stay-low-after-employing-udf.html)

ZJUXJK April 4, 2017 01:59

particle temperature stay low after employing UDF
 
Hello everyone!
i have employed the UDF about coal devolatilization model with DEFINE_DPM_LAWS and DEFINE_DPM_SOURCE. All parameters in my UDF have been printed out and seem to be okay except the coal particle temperature.The coal particle temperature stays about 420K, and did not get burned finnaly. I am confused about it, any suggestions would be welocomed.

best wishes
zjuxjk

pakk April 4, 2017 05:10

If you want us to help you see what is wrong with your UDF, you have to share the UDF.

ZJUXJK April 5, 2017 22:26

Quote:

Originally Posted by pakk (Post 643603)
If you want us to help you see what is wrong with your UDF, you have to share the UDF.

#include "udf.h"
#include "dpm.h"
#include "dpm_laws.h"
#include "dpm_types.h"
#include "math.h"
#include "sg_udms.h"
#include "mem.h"
#include "stdio.h"

DEFINE_DPM_LAW(Devolatilization_rate,p,ci)
{
real dtemp;
real temp1,temp2;
real e1,k1,v1,e2,k2,v2;
real dt;
real volate_yield1, volate_yield2;
real volate_rate1,volate_rate2;

cell_t c= P_CELL(p);
Thread *t= P_CELL_THREAD(p);
real flow_time = CURRENT_TIME;


if (P_TIME(p) < 0.003)
{
P_USER_REAL(p,3)=0.0;
P_USER_REAL(p,4)=0.0;
P_USER_REAL(p,5)=303;
}
else
{
temp1=P_USER_REAL(p,5);

temp2=P_T(p);

dt = P_DT(p); /*颗粒时间步长*/

dtemp= (temp2-temp1)/dt;

printf("dtemp=%f\n")

/*记录上一个时刻温度,并计算出瞬时升温速率*/

volate_yield1 =P_USER_REAL(p,3);

volate_yield2 =P_USER_REAL(p,4);


if (dtemp > 0.0)
{

e1=14543250000.0;

e2=342553.3258955158*pow(dtemp,0.045354296);

k2=7.33134539849e-32*pow(e2,6.85504718)*pow(dtemp,1.0);

k1=395093626.7*pow(dtemp,0.367176979442845);

v1=0.11602141*pow(dtemp,0.0313245);

v2=0.385354371*pow(dtemp,-0.017575075);

}

else
{
e1=1435000.0;

e2=3543512.3258955158*pow(100000.0,0.0453296);

k2=7.33419849e-32*pow(e2,6.85504718)*pow(100000.0,1.0);

k1=3950453626.7*pow(100000.0,0.345369735845);

v1=0.11602141*pow(100000.0,0.4313245);

v2=0.3849071*pow(100000.0,-0.3575075);
}

volate_rate1=(v1-volate_yield1 )*k1*exp(-e1/8.314/temp2);

volate_rate2=(v2-volate_yield2 )*k2*exp(-e2/8.314/temp2);

volate_yield1 = volate_yield1 + volate_rate1*dt ;

volate_yield2 = volate_yield2 + volate_rate2*dt ;

P_MASS(p)=P_INIT_MASS(p)*(0.974-0.848*(volate_yield1+volate_yield2));

P_USER_REAL(p,0)=volate_yield1;
P_USER_REAL(p,1)=volate_yield2;
P_USER_REAL(p,2)=temp2;
C_UDMI(c,t,0)=P_T(p);
}
}

DEFINE_DPM_SOURCE(dpm_source,c,t,S,strength,p)
{
real mvf_dot;

mvf_dot=(P_MASS0(p)-P_MASS(p))*strength;

if((P_T(p) > 400.0) && (P_MASS(p)>0.534536*P_INIT_MASS(p)))
{
S->species[0] += mvf_dot;
S->energy += mvf_dot*15354000.0;
C_UDMI(c,t,1)= mvf_dot;
}
}

DEFINE_DPM_SCALAR_UPDATE(dpm_scalar,c,t,initialize ,p)
{
if (P_TIME(p) < 0.003)
{
P_USER_REAL(p,3)=0.0;
P_USER_REAL(p,4)=0.0;
P_USER_REAL(p,5)=303;
}
else
{
P_USER_REAL(p,3)=P_USER_REAL(p,0);
P_USER_REAL(p,4)=P_USER_REAL(p,1);
P_USER_REAL(p,5)=P_USER_REAL(p,2);
}
}

this is my UDF code, thanks for your suggestions!


All times are GMT -4. The time now is 06:18.