Fluids

Fluids

Topics relate to Fluent, CFX, Turbogrid and more

SIGSEGV error during initialization in the fluent simulation with UDF

    • Arun mathew
      Subscriber

      Hello,

      I am currently working on a basic evaporation-condensation simulation and would appreciate some assistance.

      Problem Statement:

      I have a chamber that contains a mixture of moist air and water vapor, along with liquid water, all at atmospheric pressure and a relative humidity of 50%. My objective is to simulate the evaporation of the liquid water into the air. To achieve this, I found a suitable user-defined function (UDF) online.

      After successfully compiling the UDF, I assigned it to the saturation tab in the evaporation-condensation model.

      However, I encountered an error when trying to initialize the simulation, which resulted in the following error message:

       

      Node 0: Process 26224 received signal SIGSEGV.

      The FL process could not be started.

       

      I attempted to edit the UDF and run the simulation, suspecting that the error might be related to the following lines in the UDF.

      mixture_species_loop(m, sp, i)

      {

          mf[i] = C_YI(c, pt, i);

      }

      Could someone please help in resolving this issue?

      UDF:

      #include "udf.h"

      #define MOLAR_MASS_WATER 18.01534                                                              /* g/mol*/

      #define MOLAR_MASS_AIR 28.97                                                                             /* g/mol*/

      #define RHO_WV 0.5542                                                                                                              /* kg/m3*/

      #define RHO_AIR 1.225                                                                                                 /* kg/m3*/

      DEFINE_PROPERTY(saturation_temp,c,t)                                               /* t: mixture thread, c: cell variable, Cell volume*/

      {

      real vol = C_VOLUME(c, t);

      Thread *pt = THREAD_SUB_THREAD(t, 0);                                             /* Primary phase thread-water*/

      Thread *st = THREAD_SUB_THREAD(t, 1);/* Secondary phase thread-air-vapour mixture template*/

      real vf_s = C_VOF(c, st);                                 /* Get the volume fraction of secondary phases*/

      real vf_p = 1 - vf_s;                                          /* Get the volume fraction of primary phases*/

      real p_mix = C_P(c, t);                                    /* Get the pressure of the mixture */

      real p_op = RP_Get_Real("operating-pressure");                /* Get the operating pressure*/

      real rho_p = C_R(c, pt);                                                                                  /* Primary phase density*/

      /* Get mass fractions in primary phase*/

      real mf[2];                                                                                                           /*to store mass fractions*/

      Material *m = THREAD_MATERIAL(pt);

      Material *sp = NULL;

      int i;                                       /* Species index - 0 for water vapor and 1 for air+vapour*/

      mixture_species_loop(m, sp, i)

      {

      mf[i] = C_YI(c, pt, i);                                                                         /*species mass fraction*/

      }

      real p_w;                                                                                             /* Water vapor pressure for the cell*/

      if (vf_s == 1)                                                                                       /* If secondary phase only*/

      {

      p_w = p_mix + p_op;

      }

      else                                                                                                        /* If primary phase or mixture of phases*/

      {

      /* Find the partial pressure of water vapour, partial pressure = cell pressure * water mole fraction*/

      real m_prim = rho_p * vol * vf_p;                                             /* mass of primary phase in cell*/

      real m_wv = mf[0] * m_prim;                                                      /* mass of water vapour in cell*/

      real m_air = m_prim - m_wv;                                                      /* mass of air in cell*/

      real N_wv = m_wv / MOLAR_MASS_WATER;                       /* No of moles in water vapour*/

      real N_air = m_air / MOLAR_MASS_AIR;                                /* No of moles in  air*/

      real N_total = N_wv + N_air;                                                       /* total moles*/

      p_w = (C_P(c, t)+ p_op)* (N_wv / N_total);                          /* water vapour partial pressure*/

      }

      real t_sat;

      t_sat = (1730.63 / (10.196 - log10(p_w))) + 39.724; /* Calculate saturation temperature*/

      return t_sat;

      }

       

    • Atharva Nagarkar
      Ansys Employee

      Hello

      SIGSEGV error is returned when there are issues related to storage/memory or data is missing in a place where it needs to be supplied.

      The concern here is the macro defined as: Material *m = THREAD_MATERIAL(pt). The THREAD_MATERIAL macro returns a pointer that is associated with a cell thread (t) and NOT a phase thread (pt) as you have defined. Please have a look at the section 2.3.29.3 of the Ansys UDF User Manual for reference related to this and the 'mixture_species_loop' definition as well.

      Link: 2.3.29. DEFINE_PROPERTY UDFs (ansys.com)

      If you are not able to access the link, please refer to this forum discussion: Using Help with links (ansys.com)

      Thanks!

    • Arun mathew
      Subscriber

      Thank you for your reply. I greatly appreciate it. It appears that the issue was resolved when the primary and secondary phases were swapped. In the previous setup, the primary phase consisted of water liquid, while the secondary phase was a mixture of air and water vapor.

       

Viewing 2 reply threads
  • The topic ‘SIGSEGV error during initialization in the fluent simulation with UDF’ is closed to new replies.