TAGGED: cfd-udf-fleunt, chemical-reaction
-
-
April 11, 2024 at 12:05 pm315914335Subscriber
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 pm315914335Subscriber
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
- The topic ‘Fluent UDF DEFINE_VR_RATE unable to react’ is closed to new replies.
Ansys Innovation Space
Trending discussions
- Non-Intersected faces found for matching interface periodic-walls
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Cyclone (Stairmand) simulation using RSM
- error udf
- Script error Code: 800a000d
- Fluent fails with Intel MPI protocol on 2 nodes
- Diesel with Ammonia/Hydrogen blend combustion
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Encountering Error in Heterogeneous Surface Reaction
Top Contributors
-
1191
-
513
-
488
-
225
-
209
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.