CFD Online Logo CFD Online URL
Home > Forums > FLUENT

UDF about reaction rate

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

LinkBack Thread Tools Display Modes
Old   June 30, 2005, 12:23
Default UDF about reaction rate
Posts: n/a

I try to interpret the UDF example which is in the UDF help of fluent about DEFINE_HET_RXN_RATE, but I have syntax errors (line 2 and 3) and "structure reference not implemented" (line 9,10,11). This example specifies an Arrhenius type reaction rate for hetereogeneous reactions. Anybody could help me?

Thank you in advance

#include "udf.h"

static const real Arrhenius = 1.e15; static const real E_Activation = 1.e6; #define SMALL_S 1.e-29

DEFINE_HET_RXN_RATE(arrh,c,t,hr,mw,yi,rr,rr_t) {

Domain **domain_reactant = hr->domain_reactant;

real *stoich_reactant = hr->stoich_reactant;

int *reactant = hr->reactant;

int i;

int sp_id;

int dindex;

Thread *t_reactant;

real ci;

real T = 1200.; /* should obtain from cell */

/* instead of compute rr directly, compute log(rr) and then

take exp */

*rr = 0;

for (i=0; i < hr->n_reactants; i++)


sp_id = reactant[i]; /* species ID to access mw and yi */

if (sp_id == -1) sp_id = 0; /* if phase does not have species,

mw, etc. will be stored at index 0 */

dindex = DOMAIN_INDEX(domain_reactant[i]);

/* domain index to access mw & yi */

t_reactant = THREAD_SUB_THREAD(t,dindex);

/* get conc. */

ci = yi[dindex][sp_id]*C_R(c,t_reactant)/mw[dindex][sp_id];

ci = MAX(ci,SMALL_S);

*rr += stoich_reactant[i]*log(ci);


*rr += log(Arrhenius + SMALL_S) -


/* 1.e-40 < rr < 1.e40 */

*rr = MAX(*rr,-40);

*rr = MIN(*rr,40);

*rr = exp(*rr); }

  Reply With Quote


Thread Tools
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF molar rate of creation/destruction of species Michal Fluent UDF and Scheme Programming 1 January 18, 2013 08:26
UDF example for multi reaction in phases error3361 Fluent UDF and Scheme Programming 0 March 4, 2011 16:49
Segmentation fault in running alternateSteadyReactingFoam,why? NewKid OpenFOAM 18 January 20, 2011 17:55
Reaction Rate in UDF mahdi FLUENT 0 August 5, 2007 06:20
Reaction Rate Dhruv Siemens 1 October 1, 2005 10:34

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