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

Understanding mathematics of DEFINE_VR_RATE UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 5, 2020, 07:21
Default Understanding mathematics of DEFINE_VR_RATE UDF
  #1
New Member
 
Abhishek Goel
Join Date: Oct 2019
Location: India
Posts: 8
Rep Power: 6
abgoel363 is on a distinguished road
I want to understand the mathematics behind the UDF given below, how it is calculating the reaction rate. Specifically, the loop running to calculate ci and prod. what this loop is calculating and why?

Thank you so much for the help in advance.


#include "udf.h"

DEFINE_VR_RATE(vol_reac_rate,c,t,r,wk,yk,rate,rr_t )
{
real ci, prod;
int i;

/* Calculate Arrhenius reaction rate */

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;

*rr_t = *rate;

/* No "return..;" value. */
}
abgoel363 is offline   Reply With Quote

Old   December 5, 2020, 09:19
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
What it is calculating: the code has a comment
Code:
* Calculate Arrhenius reaction rate *
So, that is probably what it is calculating. It is a loop because every reactant has a different rate.

Why, you also asked. I don't know how to answer it it in a different way than: because the person who wrote this code, needed the result of the calculation.
pakk is offline   Reply With Quote

Old   December 5, 2020, 09:31
Default
  #3
New Member
 
Abhishek Goel
Join Date: Oct 2019
Location: India
Posts: 8
Rep Power: 6
abgoel363 is on a distinguished road
Thanks for the reply.

By "what it is calculating", I mean the reason to calculate ci and prod, as Arrhenius equation is defined as
k = A* exp(-E/RT) * T^b

Please explain the meaning and purpose of calculating prod.

Also, what does wk[r->reactant[i] signifies?
Is yk[r->reactant[i] means initial mass fraction of reactants and
r->exp_reactant[i] means rate exponent of the reactants??
abgoel363 is offline   Reply With Quote

Old   December 5, 2020, 14:03
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by abgoel363 View Post
Thanks for the reply.

By "what it is calculating", I mean the reason to calculate ci and prod, as Arrhenius equation is defined as
k = A* exp(-E/RT) * T^b

Please explain the meaning and purpose of calculating prod.

Also, what does wk[r->reactant[i] signifies?
Is yk[r->reactant[i] means initial mass fraction of reactants and
r->exp_reactant[i] means rate exponent of the reactants??
I guess prod is the product of the concentrations, used in the usual reaction rate equations.

But why this UDF? Is it from the manual? Where did you find it?
pakk is offline   Reply With Quote

Old   December 5, 2020, 19:07
Default
  #5
New Member
 
Abhishek Goel
Join Date: Oct 2019
Location: India
Posts: 8
Rep Power: 6
abgoel363 is on a distinguished road
Yes, this is the example udf given in the manual for volumetric reaction rate. I have made the changes in it as per my requirement in this code but not able to understand the mathematics of this code by calculating ci and prod. The rest is quite understandable though.
abgoel363 is offline   Reply With Quote

Old   December 6, 2020, 02:52
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Then look in the manual. Wk and yk are the fifth and sixth argument of the macro.

Above the example, the arguments are explained. The fifth and sixth are mw and yi. So read what they mean.
pakk is offline   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 for vapor pressure anuarun Fluent UDF and Scheme Programming 12 December 24, 2021 10:12
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12
UDF programming fullmonty FLUENT 5 June 30, 2011 02:40
DEFINE_GEOM UDF Problems Pat FLUENT 0 August 14, 2003 13:16
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 04:01


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