CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   EulerGranular multiphase (https://www.cfd-online.com/Forums/fluent/72520-eulergranular-multiphase.html)

coalgas February 8, 2010 23:49

EulerGranular multiphase
 
ello Every one,

I am trying to model reaction C+0.5O2->CO E= 1.36E06 J/Kmol, A = 1.3E6 with reaction order n =0.68.

Above reaction, i am trying to employ in Eulerian-Granular multiphase model. The basic idea of the model is primary phase oxygen reacts with secondary phase Carbon (fluid species). To introduce this reaction i need to write UDF and hook to the solver with define>Phases>interaction panel.

I have very little experience with writing UDF's. I realized that i need to use "DEFINE_HET_RXN_RATE" macro, any one have experience with mentioned macro??

i have found following UDF (from population balance model manual), but i am not sure wheather this UDF will be useful for my purpose. And if it is useful, how do i introduce "reaction order" term into udf??

coalgas February 9, 2010 00:03

heterogeneous reaction UDF
 
/* this is the UDF i found out from */
/* Population Balance Module Manual */
#include "udf.h"

static const real A = 1.36E06;
static const real E = 1.30E08;

DEFINE_HET_RXN_RATE(reac1,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;
*rr = 0;
for (i=0;i<hr->n_reactants;i++)
{
sp_id = reactant[i];
if(sp_id == -1)sp_id = 0;
dindex = DOMAIN_INDEX(domain_reactant[i]);
t_reactant = THREAD_SUB_THREAD(t,dindex);
/* get concentration */
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(A + SMALL_S) - E/(UNIVERSAL_GAS_CONSTANT * T);
*rr = MAX(*rr, -40);
*rr = MIN(*rr, 40);
*rr = exp(*rr);
}


All times are GMT -4. The time now is 21:04.