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

DEFINE_SOURCE and DEFINE_VR_RATE

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 24, 2015, 04:04
Default DEFINE_SOURCE and DEFINE_VR_RATE
  #1
Member
 
Tleja
Join Date: Sep 2013
Posts: 40
Rep Power: 12
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 what different between using DEFINE_SOURCE and DEFINE_VR_RATE.

I need someone help me which method i should go with.

At the moment, i try to write UDF source term code and hook to mass source in fluent. I could interpret my UDF to fluent and calculate but i have problem that product C didn't generate. I don't know how to solve my problem.
Should i use DEFINE_VR_RATE?

My UDF code is shown as below:

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,rho_B,mw_B;
real Kp,PreKp;
mw_B=104;
rho_B=850;
PreKp = 4.4e8; /*Pre-exponential m^3/kmols*/
real T_prim = C_T(c,tp); /* gas phase Temperature*/
real T_sec = C_T(c,ts); /* solid phase Tenperature*/
Kp=PreKp*exp(-Ea/(R*C_T(c,ts)));
source=-Kp*C_YI(c,tp,0)*rho_B/mw_B*C_YI(c,ts,0)*C_R(c,ts,0);
dS[eqn]=-Kp*C_YI(c,tp,0)*rho_B/mw_B;

return source;
}

If someone have any idea, Please let me know
I really need your help. I have solved this problem for many week.

Thank you
Tleja

Last edited by Tleja; February 24, 2015 at 09:33.
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 20:59.