请教大家一个有关反应速率的udf急。
- 
							
							
							
							
#include "udf.h" 
 DEFINE_EC_RATE(user_ec_rate, f, fthread, r, V, current, didV, Eeq)
 {
 double alpha_a = r->alpha_a, alpha_c = r->alpha_c;
 double io = r->io
 double T = F_T(f,fthread);
 double arg1, arg2;
 cxboolean tafelmethod = r->tafelmethod;
 int i;
 double eta;
 if (tafelmethod)
 {
 alpha_a = 2.303 * UNIVERSAL_GAS_CONSTANT * 298.15 /(alpha_a * FARADAY_CONSTANT);
 alpha_c = 2.303 * UNIVERSAL_GAS_CONSTANT * 298.15 /(alpha_c * FARADAY_CONSTANT);
 }
 Eeq = r->Eeq;
 eta = V - Eeq;
 for(i = 0; i<r->n_reactants; i++)
 if( ABS( r->exp_reactant[i] ) > SMALL_S )
 {
 int ni = r->reactant[i];
 io = pow((F_YI(f,fthread,ni)/MAX(r->yi_ref[ni],SMALL) + 1.0e-20), r->exp_reactant[i]);
 }
 for(i = 0; i<r->n_products; i++)
 if( ABS( r->exp_product[i] ) > SMALL_S )
 {
 int ni = r->product[i];
 io = pow((F_YI(f,fthread,ni)/MAX(r->yi_ref[ni],SMALL) + 1.0e-20), r->exp_product[i]);
 }
 arg1 = FARADAY_CONSTANT / (UNIVERSAL_GAS_CONSTANTT);
 arg2 = arg1eta;
 current = io( exp( arg2alpha_a ) - exp( -arg2alpha_c ) );
 didV = io( arg1alpha_aexp( arg2alpha_a ) + arg1alpha_cexp( -arg2alpha_c ) );
 /* If multiple electrochemical reactions are used, you can define rate for each reaction
 using the following if-statement /
 /
 if (STREQ(r->name, "reaction-1"))
 {
 ...
 }
 else if (STREQ(r->name, "reaction-2"))
 {
 ...
 }
 */
 }
