CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   [help!] Empirical Reaction Rate UDF (https://www.cfd-online.com/Forums/fluent-udf/114858-help-empirical-reaction-rate-udf.html)

cinwendy March 19, 2013 01:49

[help!] Empirical Reaction Rate UDF
 
Dear all,

I would like to use UDF to define a empirical reaction rate, i.e. it does not have any relationship with the Arrhenius rate equation. I want to use a simplest one as a starter:

rate = d[A]/dt = -[A] (a very simple exponential decay)

The UDF I used is:
Code:

/***********************************************************
Net Reaction Rate Example UDF
************************************************************/
#include "udf.h"
DEFINE_NET_REACTION_RATE(net_rxn,c,t,particle,pressure,temp,yi,rr,jac)
{
int i;
rr[i] = - yi[i];
}

I interpreted it and got a "temp definition shadows previous definition". What does this means?

And, before and after choosing Stiff Chemistry Solver, I hook the function net_rxn. But there is no way for me to indicate it in the species model to tell FLUENT to follow this reaction rate.

Any help will be much appreciated. Many thanks!

vasava March 19, 2013 09:03

Because the indice 'i' is not updated with each iteration.

vasava March 19, 2013 09:09

Also, you must compile the UDF and not interpret. Once you compile the 'net_rxn' should be available for selection in UDF hook.

cinwendy March 19, 2013 09:23

Hi vasava, thanks!

I am really new to this UDF stuff. What does the "i" means? Is it related to each species or each cells? Can you show me how to loop it?

I get myself MSVS express for compilation but failed. I was told that interpretation should work...

I can see it in UDF hook, but after that, what should I do (after I get the "i" correct)? I mean, how to include this into in species transport reaction model? I only found those Arrhenuis parameters to be filled but can't find where to insert a UDF.

Thanks again!

vasava March 19, 2013 09:30

Here is an example. Its the same one from Fluent manual that you are trying to modify.

/************************************************** *********
Net Reaction Rate Example UDF
************************************************** **********/
#include "udf.h"

DEFINE_NET_REACTION_RATE(net_rxn,c,t,particle,pres sure,temp,yi,rr,jac)
{
int i;
for(i=0;i<n_spe;i++)
rr[i] = 1./(real)n_spe - yi[i];
}



As far as compilation is concerned, you can read this thread http://www.cfd-online.com/Forums/flu...compiling.html .

cinwendy March 19, 2013 10:22

Hi vasava,

Now I am a bit confused. Should I use DEFINE_NET_REACTION or DEFINE_VR_REACTION? The reaction term in net_rxn looks more like the form I am interested in, but I don't have those "particle". And my understanding is that the reaction is a "volumetric" one?

As for the compilation environment, I still couldn't understand those mentioned in a lot of threads (that's why I start a new one....). I am not from a very programming background. :| i will give another try again.

Thanks.

cinwendy March 20, 2013 00:11

Now I am using this

#include "udf.h"
DEFINE_VR_RATE(vol_reac_rate,c,t,r,mole_weight,spe cies_mf,rate,rr_t)
{
real s1 = species_mf[0];
real mw1 = mole_weight[0];
*rr_t = -0.1*s1/mw1;
}

I interpreted it and was able to find it in function hook. But the simulation is showing me that reaction was not included (mass fraction of reactant is the same as the one without reaction). Can anyone tell me how to include this into species reaction model?

Many thanks!

m_amiri January 9, 2015 03:10

I think its in the phases/interaction/reaction

annu June 14, 2017 07:16

Quote:

Originally Posted by cinwendy (Post 415153)
Now I am using this

#include "udf.h"
DEFINE_VR_RATE(vol_reac_rate,c,t,r,mole_weight,spe cies_mf,rate,rr_t)
{
real s1 = species_mf[0];
real mw1 = mole_weight[0];
*rr_t = -0.1*s1/mw1;
}

I interpreted it and was able to find it in function hook. But the simulation is showing me that reaction was not included (mass fraction of reactant is the same as the one without reaction). Can anyone tell me how to include this into species reaction model?

Many thanks!


Have you got the answer?
I am also stuck in that.Please revert:confused:


All times are GMT -4. The time now is 06:38.