|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
关于UDF自定义反应速度的问题,下面是help给出的例子,请问里面的r结构体需要定义吗?为什么解释时总是说“structure reference not implemented”结构体未被执行呢?我C语言没学好,但是这个要得比较急,希望大家能帮帮我,感激不尽。
/*********************************************************************
UDF for specifying a volume reaction rate
The basics of Fluent's calculation of reaction rates: only an
Arrhenius ("finite rate") reaction rate is calculated
from the inputs given by the user in the graphical user interface
**********************************************************************/
#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] / wk[r->reactant];
prod *= pow(ci, r->exp_reactant);
}
*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. */
} |
|