|
[Sponsors] |
Understanding mathematics of DEFINE_VR_RATE UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 5, 2020, 08:21 |
Understanding mathematics of DEFINE_VR_RATE UDF
|
#1 |
New Member
Abhishek Goel
Join Date: Oct 2019
Location: India
Posts: 8
Rep Power: 7 |
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. */ } |
|
December 5, 2020, 10:19 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
What it is calculating: the code has a comment
Code:
* Calculate Arrhenius reaction 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. |
|
December 5, 2020, 10:31 |
|
#3 |
New Member
Abhishek Goel
Join Date: Oct 2019
Location: India
Posts: 8
Rep Power: 7 |
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?? |
|
December 5, 2020, 15:03 |
|
#4 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
But why this UDF? Is it from the manual? Where did you find it? |
||
December 5, 2020, 20:07 |
|
#5 |
New Member
Abhishek Goel
Join Date: Oct 2019
Location: India
Posts: 8
Rep Power: 7 |
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.
|
|
December 6, 2020, 03:52 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for vapor pressure | anuarun | Fluent UDF and Scheme Programming | 13 | June 23, 2024 14:12 |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 07:12 |
UDF programming | fullmonty | FLUENT | 5 | June 30, 2011 03:40 |
DEFINE_GEOM UDF Problems | Pat | FLUENT | 0 | August 14, 2003 14:16 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |