TAGGED: cfd-udf-fleunt, chemical-reaction
-
-
April 11, 2024 at 12:05 pmJiacheng lyuSubscriber
Hi, guys. Recently, I plan to define pre-exponential factors for limited rate reactions through UDF. The UDF can be compiled and mounted, but the reaction cannot proceed. Hoping to get the reason? The reactant is kerosene. The UDF code is as follows:
include "udf.h"
DEFINE_VR_RATE(rate_bfer,c,t,r,wk,yk,rate,rr_t)
{
/*If more than one reaction is defined, it is necessary to distinguish
between these using the names of the reactions. */
  if (!strcmp(r->name, "reaction-1"))
  {
    real ci, prod, er, pef_1;
    int i;
    er = (yk[r->reactant[0]] / wk[r->reactant[0]]) / (fabsf(yk[r->reactant[1]] / wk[r->reactant[1]]) + 1e-9);
    pef_1 = r->A * er;
      /* Calculate Arrhenius reaction rate */
    prod = 1.0;
    for(i = 0; i < r->n_reactants; i++)
    {
      ci = C_R(c,t) * yk[r->reactant[i]] / wk[r->reactant[i]];
      prod *= pow(ci, r->exp_reactant[i]);
    }
    *rate = pef_1 * exp(- r->E / (UNIVERSAL_GAS_CONSTANT * C_T(c,t))) * prod;
    /* without pow(C_T(c,t), r->b)*/
    /* *rr_t = *rate;*/
  /* Reaction 1 */
  }
  else if (!strcmp(r->name, "reaction-2"))
  {
    real ci, prod, er, pef_2;
    int i;
    er = (yk[r->reactant[0]] / wk[r->reactant[0]]) / (fabsf(yk[r->reactant[1]] / wk[r->reactant[1]]) + 1e-9);
    pef_2 = r->A * er;
      /* Calculate Arrhenius reaction rate */
    prod = 1.0;
    for(i = 0; i < r->n_reactants; i++)
    {
      ci = C_R(c,t) * yk[r->reactant[i]] / wk[r->reactant[i]];
      prod *= pow(ci, r->exp_reactant[i]);
    }
    *rate = pef_2 * exp(- r->E / (UNIVERSAL_GAS_CONSTANT * C_T(c,t))) * prod;
    /* without pow(C_T(c,t), r->b)*/
    /* *rr_t = *rate;*/
  /* Reaction 2 */
  }
} -
April 11, 2024 at 2:17 pmRobForum Moderator
If you add some message lines into the UDF are they triggered? You need to figure out if the UDF is doing something unexpected re the maths or if it's not working at all.Â
-
April 11, 2024 at 2:21 pmJiacheng lyuSubscriber
I don't think the udf is working so I'm hoping to find the way to make it work. Any suggestions?
-
April 11, 2024 at 2:27 pmRobForum Moderator
Add in some messages to see if it's triggering but not doing anything or not triggering etc.Â
-
Viewing 3 reply threads
- You must be logged in to reply to this topic.
Ansys Innovation Space
Trending discussions
- How do you approach this?
- Convective Augmentation Factor in DEFINE_HEAT_FLUX
- Conservation issue with a UDS solution
- Where is the Electrolyte Projected Area in the Reports tab of PEMFC Model?
- Non-Premixed Combustion PDF generation with 4th-order interpolation
- ANSYS fluent – Rocky DEM coupling
- Solar load , Mesh Orientation and Beam direction
Top Contributors
-
461
-
215
-
194
-
177
-
162
Top Rated Tags
© 2024 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.