CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

How to use C_YI(c,t,i) with Thread_super_thread

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2015, 08:30
Default How to use C_YI(c,t,i) with Thread_super_thread
  #1
Member
 
Tleja
Join Date: Sep 2013
Posts: 40
Rep Power: 13
Tleja is on a distinguished road
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
Tleja is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 16:52.