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 specify to the reaction by UDF?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes
  • 1 Post By luonghungtruyen
  • 1 Post By khaledhmz
  • 1 Post By luonghungtruyen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 22, 2016, 10:00
Default How to specify to the reaction by UDF?
  #1
New Member
 
luong hung truyen
Join Date: Sep 2016
Posts: 8
Rep Power: 6
luonghungtruyen is on a distinguished road
Dear everyone!
I am writing udf code for 2step-reaction of methane-air. When I compiled, the FLuent announced the parse error at line 18 (if (STREQ(0)) . It means that I used the wrong command to specify the first reaction.
I'd like to post my udf code as below.
Would you please teach me how to write a command to specify to the reaction?
I am very thankful to you so much!

"
#include "udf.h"
DEFINE_VR_RATE(vol_reac_rate, c, domain, r, mw, yi, rate,rr)
{
Thread *c_thread;

real cCH4,cO2,cCO,cCO2,cH2O;
thread_loop_c(c_thread, domain)
{

/* Calculate Arrhenius reaction rate */

begin_c_loop(c,c_thread)
{

/* specify 1st step: CH4+3/2O2=CO+2H2O */
if (STREQ(0))
{
cCH4 = C_R(c,c_thread) * C_YI(c,c_thread,0) / mw[0];
cO2 = C_R(c,c_thread) * C_YI(c,c_thread,1) / mw[1];
*rate = 2.8e9* exp( - 2.025e8/ (8314.459848 * C_T(c,c_thread))) * pow(cCH4,-0.3) *pow(cO2,1.3);
*rr = *rate;
}
/* specify 2nd step: CO+1/2O2=CO2 */
else (STREQ(1))
{
cO2 = C_R(c,c_thread) * C_YI(c,c_thread,1) / mw[1];
cCO = C_R(c,c_thread) * C_YI(c,c_thread,2) / mw[2];
cH2O = C_R(c,c_thread) * C_YI(c,c_thread,3) / mw[3];
*rate = 2.23e12* exp( - 1.67e8/ (8314.459848 * C_T(c,c_thread))) *cCO* pow(cH2O,0.5) *pow(cO2,0.25);
*rr = *rate;
}
}
end_c_loop(c,c_thread)
}
}

"
khaledhmz likes this.
luonghungtruyen is offline   Reply With Quote

Old   October 7, 2019, 18:25
Smile Question
  #2
New Member
 
abdo
Join Date: Apr 2018
Posts: 17
Rep Power: 4
khaledhmz is on a distinguished road
hello dear
I would to ask you if your problem solved or not yet

thank you
luonghungtruyen likes this.
khaledhmz is offline   Reply With Quote

Old   July 1, 2020, 00:01
Default
  #3
New Member
 
luong hung truyen
Join Date: Sep 2016
Posts: 8
Rep Power: 6
luonghungtruyen is on a distinguished road
Not Yet!
If anyone knows the solution, please help us!

Sincerely,
khaledhmz likes this.
luonghungtruyen is offline   Reply With Quote

Reply

Tags
multiple reaction, reaction rate, udf code

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
surface reaction UDF jeniuswx Fluent UDF and Scheme Programming 2 August 8, 2017 12:06
UDF for volumetric reaction rate Boniface Omar Fluent UDF and Scheme Programming 0 July 25, 2016 02:39
Help! reaction udf for multiphase m_amiri Fluent UDF and Scheme Programming 2 January 15, 2015 09:54
surface reaction UDF jeniuswx Fluent UDF and Scheme Programming 2 April 11, 2013 03:33
UDF : Chemical Reaction in Catalytic Converter adhimac FLUENT 1 March 27, 2001 14:04


All times are GMT -4. The time now is 05:34.