orgring 发表于 2018-3-19 09:08:20

化学udf,没有发生反应

各位老师,我的模型是一段长方形的管子,中间是多孔介质,里面没有设置reaction,模拟化学反应,反应方程为:4nh3+6NO=5N2+6h20
进口设置:NO:0.0989
                  NH3:0.0989
                  h2o(l):0
出口设置:为设置,全为0
开了能量方程和组分运输模型,组分运输模型里面没有勾选Volumetric,udf编写如下,反应用源相来表示,请问这段程序哪里有问题呢,有氮气生成,就是没有水,还有反应过程不太正常,瞬间就反应完了。谢谢各位老师!
#include "udf.h"

#define PRE_EXP 1.8e+08
#define ACTIVE1.3e+08   
#define BETA 0.0         
real arrhenius_rate(real temp)
{
   return PRE_EXP*pow(temp,BETA)*exp(-ACTIVE/(UNIVERSAL_GAS_CONSTANT*temp));
}
#define NO   0
#define NH31
#define H202
#define N2   3
#define NUM_SPECS 4
DEFINE_SOURCE(energy_source,c,t,dS,eqn)
{
      real delt_h, source;
      delt_h = -7.489518e+07;
      source = -delt_h*(-arrhenius_rate(C_T(c,t)))*C_R(c,t)*C_YI(c,t,0)/30;
      ds= delt_h*PRE_EXP*exp(-ACTIVE/(UNIVERSAL_GAS_CONSTANT*temp)) *ACTIVE*(1/temp) *(1/temp) *(1/UNIVERSAL_GAS_CONSTANT)*C_R(c,t)*C_YI(c,t,0)/30;
      return source;
}

DEFINE_SOURCE(no_source,c,t,dS,eqn)
{
      real source;
      source = 6*(-arrhenius_rate(C_T(c,t)))*C_R(c,t)*C_YI(c,t,0)/30;
      ds= -6*PRE_EXP*exp(-ACTIVE/(UNIVERSAL_GAS_CONSTANT*temp)) *ACTIVE*(1/temp) *(1/temp) *(1/UNIVERSAL_GAS_CONSTANT)*C_R(c,t)*C_YI(c,t,0)/30;
      return source;
}

DEFINE_SOURCE(nh3_source,c,t,dS,eqn)
{
      real source;
      source = 4*(-arrhenius_rate(C_T(c,t)))*C_R(c,t)*C_YI(c,t,1)/17;
      ds= -4*PRE_EXP*exp(-ACTIVE/(UNIVERSAL_GAS_CONSTANT*temp)) *ACTIVE*(1/temp) *(1/temp) *(1/UNIVERSAL_GAS_CONSTANT)*C_R(c,t)*C_YI(c,t,0)/17;
      return source;
}

DEFINE_SOURCE(h20_source,c,t,dS,eqn)
{
      real source;
      source = 6*(arrhenius_rate(C_T(c,t)))*C_R(c,t)*C_YI(c,t,2)/18;
      ds= 6*PRE_EXP*exp(-ACTIVE/(UNIVERSAL_GAS_CONSTANT*temp)) *ACTIVE*(1/temp) *(1/temp) *(1/UNIVERSAL_GAS_CONSTANT)*C_R(c,t)*C_YI(c,t,0)/18;
      return source;
}
DEFINE_SOURCE(n2_source,c,t,dS,eqn)
{
      real source;
      source = 5*(arrhenius_rate(C_T(c,t)))*C_R(c,t)*C_YI(c,t,3)/28;
      ds= 5*PRE_EXP*exp(-ACTIVE/(UNIVERSAL_GAS_CONSTANT*temp)) *ACTIVE*(1/temp) *(1/temp) *(1/UNIVERSAL_GAS_CONSTANT)*C_R(c,t)*C_YI(c,t,0)/28;
      return source;
}

wangph 发表于 2018-3-27 09:19:58

请问一下,你的UDF里面的SOURCE表达式是怎么确定的呢?文献里面的还是?
页: [1]
查看完整版本: 化学udf,没有发生反应