CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

[help!] Empirical Reaction Rate UDF

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 19, 2013, 02:49
Exclamation [help!] Empirical Reaction Rate UDF
  #1
Member
 
Join Date: Feb 2013
Posts: 31
Rep Power: 4
cinwendy is on a distinguished road
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!
cinwendy is offline   Reply With Quote

Old   March 19, 2013, 10:03
Default
  #2
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 545
Rep Power: 12
vasava will become famous soon enough
Because the indice 'i' is not updated with each iteration.
vasava is offline   Reply With Quote

Old   March 19, 2013, 10:09
Default
  #3
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 545
Rep Power: 12
vasava will become famous soon enough
Also, you must compile the UDF and not interpret. Once you compile the 'net_rxn' should be available for selection in UDF hook.
vasava is offline   Reply With Quote

Old   March 19, 2013, 10:23
Default
  #4
Member
 
Join Date: Feb 2013
Posts: 31
Rep Power: 4
cinwendy is on a distinguished road
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!

Last edited by cinwendy; March 20, 2013 at 00:01.
cinwendy is offline   Reply With Quote

Old   March 19, 2013, 10:30
Default
  #5
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 545
Rep Power: 12
vasava will become famous soon enough
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 Visual Studio Settings for compiling .
vasava is offline   Reply With Quote

Old   March 19, 2013, 11:22
Default
  #6
Member
 
Join Date: Feb 2013
Posts: 31
Rep Power: 4
cinwendy is on a distinguished road
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 is offline   Reply With Quote

Old   March 20, 2013, 01:11
Default
  #7
Member
 
Join Date: Feb 2013
Posts: 31
Rep Power: 4
cinwendy is on a distinguished road
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!
cinwendy is offline   Reply With Quote

Old   January 9, 2015, 04:10
Default
  #8
New Member
 
Join Date: Jan 2015
Posts: 3
Rep Power: 2
m_amiri is on a distinguished road
I think its in the phases/interaction/reaction
m_amiri is offline   Reply With Quote

Reply

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
Volumetric Reaction Rate UDF. Inactivation of Clostridium Botulinum Robbb Fluent UDF and Scheme Programming 11 March 20, 2013 04:54
Heterogeneous reaction rate UDF snh Fluent UDF and Scheme Programming 2 February 23, 2013 03:15
reaction rate Benfa CFX 0 January 22, 2013 14:58
using rate equation for volumetric reaction byronsmith FLUENT 3 April 8, 2009 11:58
surface reaction rate plot at diffusiion limit cas Jason FLUENT 1 August 22, 2003 04:54


All times are GMT -4. The time now is 11:23.