|
[Sponsors] |
How to use UDF to deine surface reaction rate |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 14, 2019, 07:49 |
How to use UDF to deine surface reaction rate
|
#1 |
New Member
郝晨睿
Join Date: Apr 2019
Posts: 3
Rep Power: 7 |
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 ? |
|
May 26, 2020, 17:58 |
|
#2 |
New Member
Adrián Leiva
Join Date: Oct 2019
Posts: 2
Rep Power: 0 |
Hello!
Could you solve it? I'm having just the exact problem as you Greetings |
|
May 27, 2020, 05:24 |
Reaction Identification
|
#3 |
Senior Member
|
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. |
|
|
|
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 |