CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Reaction rate under multi phases (https://www.cfd-online.com/Forums/fluent-udf/97436-reaction-rate-under-multi-phases.html)

 kongl1986 February 16, 2012 22:34

Reaction rate under multi phases

I want to write a UDF about reaction rate using DEFINE_VR_RATE.

#include "udf.h"
DEFINE_VR_RATE(vol_reac_rate,c,t,r,wk,yk,rate,rr_t )
{
real ci,prod;
int i;
prod=1.;
for(i=0;i<r->n_reactants;i++)
{
ci=C_R(c,t)*yk[r->reactant[i]]/wk[r->reactant[i]];
prod*=pow(ci,r->exp_reactant[i]);
}
*rate=r->A*exp(-r->E/(UNIVERSAL_GAS_CONSTANT*C_T(c,t)))*pow(C_T(c,t),r->b)*prod*(1-C_VOF(c,t));
*rr_t=*rate;
}

here Thread *t pointer to cell thread on which the volumetric reaction rate is to be applied.
1-C_VOF(c,t) is the volume fraction of second phase.
If there are more than two phases,
how can i specify the variables of the phases which are not applied by the reaction rate.

thank you

 gearboy February 16, 2012 22:58

Quote:
 Originally Posted by kongl1986 (Post 344859) I want to write a UDF about reaction rate using DEFINE_VR_RATE. #include "udf.h" DEFINE_VR_RATE(vol_reac_rate,c,t,r,wk,yk,rate,rr_t ) { real ci,prod; int i; prod=1.; for(i=0;in_reactants;i++) { ci=C_R(c,t)*yk[r->reactant[i]]/wk[r->reactant[i]]; prod*=pow(ci,r->exp_reactant[i]); } *rate=r->A*exp(-r->E/(UNIVERSAL_GAS_CONSTANT*C_T(c,t)))*pow(C_T(c,t),r->b)*prod*(1-C_VOF(c,t)); *rr_t=*rate; } here Thread *t pointer to cell thread on which the volumetric reaction rate is to be applied. 1-C_VOF(c,t) is the volume fraction of second phase. If there are more than two phases, how can i specify the variables of the phases which are not applied by the reaction rate. thank you
I think (c,t) is the mixture, if you want to get vof of second phase, you shoud first use THREAD_SUB_THREAD to get the thread of second phase, says t_second_phase. then get its vof by C_VOF(c,t_second_phase)

 kongl1986 February 16, 2012 23:38

as described in help manual,
Thread *t pointer to cell thread on which the volumetric reaction rate is to be applied.
So i think t is only the phase applied the reaction rate , not the mixture.
I have tried