Fluids

Fluids

UDF error 126

    • Ahmad Hadi Bakir
      Subscriber
      I am using Fluent 2021 R2 on a Red hat linux cluster to run a 2D transient flame simulation. The purpose of this work is to investigate the effects of heat loss on the flame using the Planck Mean Absorption coefficients as a function of temperature for H2O, CO, CO2, and CH4. I created a UDF that calculated this absorption coefficient looping for each cell in the simulation.
       
      The UDF source code is shown at the bottom. I am first attempting to check the UDF on a Windows 11 computer to see its validity before applying it to the cluster. The issue I am having is when I try loading the UDF after building it, it gives me Error athost: Error code: 126. Could you please help me resolve this issue? Thank you in advance.
       

      #include "udf.h"

      DEFINE_GRAY_BAND_ABS_COEFF(user_gray_band_abs,c,t, nb)
      {
          Domain *domain;
          Material *m = THREAD_MATERIAL(t);
          int ico2 = mixture_specie_index(m, "co2");
          int ico  = mixture_specie_index(m, "co");
          int ih2o = mixture_specie_index(m, "h2o");
          int ich4 = mixture_specie_index(m, "ch4");
          thread_loop_c(t, domain)
          {
              cell_t c;
              begin_c_loop(c, t) /* loops over cells in a cell thread */
              {
                  real CO2_molf, CO_molf, H2O_molf, CH4_molf;
                  real a_co2, a_co, a_h2o, a_ch4;
                  real abs_coeff = 0;
                  real T = C_T(c, t);
                  real P = C_P(c, t);
                  
                  CO2_molf= (C_R(c, t) * C_VOLUME(c, t) * C_YI(c, t, ico2))/44.01;
                  CO_molf = (C_R(c, t) * C_VOLUME(c, t) * C_YI(c, t, ico))/28.01;
                  H2O_molf= (C_R(c, t) * C_VOLUME(c, t) * C_YI(c, t, ih2o))/18.01528;
                  CH4_molf= (C_R(c, t) * C_VOLUME(c, t) * C_YI(c, t, ich4))/16.04;
                  
                  a_h2o = -1.40598 + (5.1403E+3 / pow(T,1)) + (-2.49209E+6 / pow(T,2)) + (5.87875E+9 / pow(T,3)) + (-2.33462E+12 / pow(T,4)) + (3.28929E+14 / pow(T,5));

                  if((300<=T) && (T<=865))
                  {
                    a_co = 3.32332E+1 + (-3.81859E-1 * pow(T,1)) + (1.68054E-3 * pow(T,2)) + (-3.59221E-6 * pow(T,3)) + (4.10932E-9 * pow(T,4)) + (-2.44251E-12 * pow(T,5)) + (5.96159E-16 * pow(T,6));
                  }
                  else if(865<=T)
                  {
                    a_co = 1.14597 + (2.32393E-2 * pow(T,1)) + (-5.17447E-5 * pow(T,2)) + (4.65068E-8 * pow(T,3)) + (-2.13393E-11 * pow(T,4)) + (4.97086E-15 * pow(T,5)) + (-4.67667E-19 * pow(T,6));
                  }   
                  
                  if ((300<=T) && (T<=860))
                  {
                    a_co2 = -1.61017E+2 + (2.07661 * pow(T,1)) + (-1.00536E-2 * pow(T,2)) + (2.58277E-5 * pow(T,3)) + (-3.59098E-8 * pow(T,4)) + (2.54860E-11 * pow(T,5)) + (-7.25425E-15 * pow(T,6));
                  }
                  else if(860<=T)
                  {
                    a_co2 = -8.16334 + (2.72779E-1 * pow(T,1)) + (-5.37382E-4 * pow(T,2)) + (4.56021E-7 * pow(T,3)) + (-2.01261E-10 * pow(T,4)) + (4.54957E-14 * pow(T,5)) + (-4.17609E-18 * pow(T,6));
                  }   
                     
                  if ((300<=T) && (T<=645))
                  {
                     a_ch4 = 9.34245E+1 + (-1.36727 * pow(T,1)) + (8.19456E-3 * pow(T,2)) + (-2.49120E-5 * pow(T,3)) + (4.11322E-8 * pow(T,4)) + (-3.53140E-11 * pow(T,5)) + (1.23840E-14 * pow(T,6));
                  }
                  else if(645<=T)
                  {
                     a_ch4 = -6.04867 + (6.35149E-2 * pow(T,1)) + (-1.29462E-4 * pow(T,2)) + (1.17164E-7 * pow(T,3)) + (-5.49038E-11 * pow(T,4)) + (1.30767E-14 * pow(T,5)) + (-1.25597E-18 * pow(T,6));
                  }
                   
                  C_ABS_COEFF(c,t) = ((P / 101325)*((a_h2o * H2O_molf) + (a_co * CO_molf) + (a_co2 * CO2_molf) + (a_ch4 * CH4_molf)));

                  return C_ABS_COEFF(c, t);
              }
              end_c_loop(c, t)

          }
      }

    • Rob
      Ansys Employee

      Can you check the code compiled? A quick search for "error code 126" on here shows it's possible it hasn't. Note, use the included compiler on Win11 do NOT leave that option selected for Linux. 

Viewing 1 reply thread
  • You must be logged in to reply to this topic.