Skip to content
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠
CFD中文网

CFD中文网

  1. CFD中文网
  2. Fluent
  3. 请教大家一个有关反应速率的udf急。

请教大家一个有关反应速率的udf急。

已定时 已固定 已锁定 已移动 Fluent
2 帖子 2 发布者 3.1k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • L 离线
    L 离线
    lyyyy
    写于 最后由 编辑
    #1

    各位大神有会编写反映化学反应速率的用户自定义函数的嘛 求帮忙

    1 条回复 最后回复
  • I 离线
    I 离线
    ibelief
    写于 最后由 编辑
    #2

    #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_CONSTANT
    T);
    arg2 = arg1
    eta;
    current = io( exp( arg2
    alpha_a ) - exp( -arg2
    alpha_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"))
    {
    ...
    }
    */
    }

    努力收敛

    1 条回复 最后回复

  • 登录

  • 登录或注册以进行搜索。
  • 第一个帖子
    最后一个帖子
0
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]