How to use C_YI(c,t,i) with Thread_super_thread
Hi everyone!
I'm studying in reaction field.
In my reaction,
A(s)+B(g) ---kp---> C(s) ;;SourceA= -Kp[A][B] ,SourceB= -Kp[A][B], SourceC= +Kp[A][B]
According to my reaction,I think UDF can solve my problem,I read fluent UDF tutorial many time and I still confused about meaning of Thread_super_thread in ANSYS help.
At the moment, i try my best to write UDF source term code and hook to mass source in fluent. I have problem that specie A in solid and specie B in gas do not react with each other. I already make sure that rate parameter(Ea,k) should use well.
System consists of gas (B,N2) and solid (A,C).
My UDF code is shown as below:
Code:
DEFINE_SOURCE(source_A,c,t,dS,eqn)
{
Thread *mt=THREAD_SUPER_THREAD(t);
Thread **pt = THREAD_SUB_THREADS(mt);
Thread *tp = pt[0]; /* Thread for gas phase */
Thread *ts = pt[1]; /* Thread for solid phase*/
real source;
real Kp,PreKp;
PreKp = 4.4e7;
real T_prim = C_T(c,tp); /* gas phase Temperature*/
real T_sec = C_T(c,ts); /* solid phase Tenperature*/
Kp=PreKp*exp(-50.23e3/(R*C_T(c,ts)));
source=-Kp*C_YI(c,tp,0)C_YI(c,ts,0);
dS[eqn]=-Kp*C_YI(c,tp,0);
return source;
}
DEFINE_SOURCE(source_B,c,t,dS,eqn)
{
Thread *mt=THREAD_SUPER_THREAD(t);
Thread **pt = THREAD_SUB_THREADS(mt);
Thread *tp = pt[0]; /* Thread for gas phase */
Thread *ts = pt[1]; /* Thread for solid phase*/
real source;
real Kp,PreKp;
PreKp = 4.4e7;
real T_prim = C_T(c,tp); /* gas phase Temperature*/
real T_sec = C_T(c,ts); /* solid phase Tenperature*/
Kp=PreKp*exp(-50.23e3/(R*C_T(c,ts)));
source=-Kp*C_YI(c,tp,0)*C_YI(c,ts,0);
dS[eqn]=-Kp*C_YI(c,ts,0);
return source;
}
DEFINE_SOURCE(source_C,c,t,dS,eqn)
{
Thread *mt=THREAD_SUPER_THREAD(t);
Thread **pt = THREAD_SUB_THREADS(mt);
Thread *tp = pt[0]; /* Thread for gas phase */
Thread *ts = pt[1]; /* Thread for solid phase*/
real source;
real Kp,PreKp;
PreKp = 4.4e7;
real T_prim = C_T(c,tp); /* gas phase Temperature*/
real T_sec = C_T(c,ts); /* solid phase Tenperature*/
Kp=PreKp*exp(-50.23e3/(R*C_T(c,ts)));
source=+Kp*C_YI(c,tp,0)*C_YI(c,ts,0);
dS[eqn]=0;
return source;
}
If someone have any idea, Please let me know
I really need your help. I haven't solved this problem yet for many week.
Thank you
Tleja
|