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

UDF about reaction rate

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Julien

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 30, 2005, 13:23
Default UDF about reaction rate
  #1
Julien
Guest
 
Posts: n/a
Hi

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) -

E_Activation/(UNIVERSAL_GAS_CONSTANT*T);

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

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

*rr = MIN(*rr,40);

*rr = exp(*rr); }

Silence017 likes this.
  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
UDF example for multi reaction in phases error3361 Fluent UDF and Scheme Programming 1 September 23, 2019 10:55
UDF molar rate of creation/destruction of species Michal Fluent UDF and Scheme Programming 1 January 18, 2013 08:26
Segmentation fault in running alternateSteadyReactingFoam,why? NewKid OpenFOAM 18 January 20, 2011 17:55
Reaction Rate in UDF mahdi FLUENT 0 August 5, 2007 07:20
Reaction Rate Dhruv Siemens 1 October 1, 2005 11:34


All times are GMT -4. The time now is 17:14.