Skip to content
  • 最新
  • Categories
  • 东岳流体
  • 随机看[请狂点我]
Skins
  • 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

  • Default (No Skin)
  • No Skin
Collapse
CFD中文网

CFD中文网

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

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

Scheduled Pinned Locked Moved Fluent
2 Posts 2 Posters 3.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lyyyy
    wrote on last edited by
    #1

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

    1 Reply Last reply
  • I Online
    I Online
    ibelief
    wrote on last edited by
    #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 Reply Last reply

  • Login

  • Login or register to search.
  • First post
    Last post
0
  • 最新
  • Categories
  • 东岳流体
  • 随机看[请狂点我]