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 UDF to deine surface reaction rate

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 14, 2019, 07:49
Default How to use UDF to deine surface reaction rate
  #1
New Member
 
郝晨睿
Join Date: Apr 2019
Posts: 3
Rep Power: 7
kimi_hao is on a distinguished road
I'm following the example in UDF Manual.
The given UDF code is as below:
#include "udf.h"
DEFINE_SR_RATE(my_rate,f,t,r,mw,yi,rr)
{
Thread *t0=t->t0;
cell_t c0=F_C0(f,t);
double sih4 = yi[0]; /* mass fraction of sih4 at the wall */
double si2h6 = yi[1];
double sih2 = yi[2];
double h2 = yi[3];
double ar = yi[4]; /* mass fraction of ar at the wall */
double rho_w = 1.0, site_rho = 1.0e-6, T_w = 300.0;
double si_s = yi[6]; /* site fraction of si_s*/
double sih_s = yi[7]; /* site fraction of sih_s*/
T_w = F_T(f,t);
rho_w = C_R(c0,t0)*C_T(c0,t0)/T_w;
sih4 *= rho_w/mw[0]; /* converting of mass fractions to molar concentrations */
si2h6 *= rho_w/mw[1];
sih2 *= rho_w/mw[2];
h2 *= rho_w/mw[3];
ar *= rho_w/mw[4];
si_s *= site_rho; /* converting of site fractions to site concentrations */
sih_s *= site_rho;
if (STREQ(r->name, "reaction-1"))
*rr = 100.0*sih4;
else if (STREQ(r->name, "reaction-2"))
*rr = 0.1*sih_s;
else if (STREQ(r->name, "reaction-3"))
*rr = 100*si2h6*si_s;
else if (STREQ(r->name, "reaction-4"))
*rr = 1.0e10*sih2;
}


I have finished the compiled and function Hooks

In boundary conditions, I have activated “Reaction” in "Species" card of the reaction surface.
But how to give the different "*rr" to desire reactants ?
kimi_hao is offline   Reply With Quote

Old   May 26, 2020, 17:58
Default
  #2
New Member
 
Adrián Leiva
Join Date: Oct 2019
Posts: 2
Rep Power: 0
adleiva95 is on a distinguished road
Hello!

Could you solve it?
I'm having just the exact problem as you

Greetings
adleiva95 is offline   Reply With Quote

Old   May 27, 2020, 05:24
Default Reaction Identification
  #3
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
Reaction rates are not identified by reactants but by reactions and that can taken care of within the UDF by comparing the names against the reaction. E.g., in the code you commented upon, name is compared against each of the four reactions and each one has different value of rate.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fluent UDF urgent! Variable reaction rate natantyt Fluent UDF and Scheme Programming 8 October 17, 2021 04:35
surface reaction rate UDF query AmitKunte Fluent UDF and Scheme Programming 1 May 26, 2020 18:59
UDF macros for surface reaction borhan_sd@yahoo.com Fluent UDF and Scheme Programming 0 June 6, 2013 09:57
Plotting Surface Reaction Rate Ryan FLUENT 0 February 12, 2003 15:47
CFX4.3 -build analysis form Chie Min CFX 5 July 13, 2001 00:19


All times are GMT -4. The time now is 03:27.