We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Setting bubble diameter under Dispersed turbulence model

    • h.a.maldonadodeleon
      Subscriber

      Hi all,

      I'm trying to set a UDF to set the bubble diameter for an Eulerian simulation while simulating the turbulence under the Dispersed model (as the density ratio is way beyond 1). While a similar UDF works perfectly for the Mixture model (for turbulence), it does not work with the modifications I've deemed necessary (i.e., pointing to the liquid - primary phase thread using the super_thread macro). Has anyone managed to define a similar UDF successfully? Any input is appreciated as the current formulation results in SIGSEV error. 

      #include "udf.h"
      #include "math.h"

      DEFINE_PROPERTY(calderbank_db, c, t)

      {
        /* Accessing the liquid domain */
      Thread liq = THREAD_SUPER_THREAD(0); /* Pointing to liquid phase */

      /* Define the variables */
      real db; /* Bubble diamter placeholder */

        /* Get local conditions from the dispersed (gas) phase */
      real eps = C_D(c, liq); /* Obtain turbulence dissipation from liquid phase */
      real eG = C_VOF(c, t); /* Volume fraction of the gas phase */

      /* Liquid properties */

      double density_liq = 998.2; /* Density of liquid phase (kg/m³) */
      /* Ensure epsilon is positive to avoid division errors */
      if (eps <= 0.0)
      {
        eps = 0.0000000001; /* Small value to prevent singularity */
      }
      if (eG > 0.3)
      {
        db = 0.0000001; /* almost zero db */
      }
      /* Calderbank's model (1958) for pure liquid */
      /* db = C1 + C2 * ((surf_tension / rhoL)^0.6 / eps^0.4) * eG^0.5 */
      db = 0.0009 + 4.15 * pow(0.072 / density_liq, 0.6) * 1 / (pow(eps, 0.4)) * pow(eG, 0.5);
      return db;
      }
    • Rob
      Forum Moderator

      The primary phase doesn't have a diameter - that's the second phase(s). 

    • h.a.maldonadodeleon
      Subscriber

      Hi Rob, 

      Thanks for your input. However, the model requires as input the turbulent energy dissipation rate (EDR) of the continuous phase (liquid), which is why I need to access that variable from the secondary phase. From what I got when reading the manual, once I hook the UDF to the diameter of the secondary phase (gas), the thread is pointed to the gas phase, and with the super_thread macro I should be able to reach the liquid one. Is this the case? 

    • Rob
      Forum Moderator

      The turbulence is typically set at the mixture level, unless you've been altering the options in the Viscous panel?  

    • h.a.maldonadodeleon
      Subscriber

       

      Hi Rob, 

      As you mentioned, I’m making some changes to the viscous settings for the Turbulence Multiphase model (i.e., dispersed) due to the characteristics of my system. For now, the solution I found was the following – which seems to work for now: 

       

      1. Defining the mixture and liquid threads
      2. Get/Define the respective pointers to those threads

      #include “udf.h”
      #include “math.h”

      Thread *mix; /* Define the mixture thread */
      Thread *liq; /* Define the liquid thread */

      DEFINE_PROPERTY(calderbank_db, c, t)
      {
        /* Accessing the liquid domain */
        mix = THREAD_SUPER_THREAD(t); /* Pointing to mixture thread */
        liq = THREAD_SUB_THREAD(mix, 0); /* Pointing to liquid phase */

        /* Define the variables */
        real db; /* Bubble diamter placeholder */

        /* Get local conditions from the dispersed (gas) phase */
        real eps = C_D(c, liq); /* Obtain turbulence dissipation from liquid phase */
        real eG = C_VOF(c, t); /* Volume fraction of the gas phase */

        /* Liquid properties */
        double density_liq = 998.2; /* Density of liquid phase (kg/m³) */
       
        /* Ensure epsilon is positive to avoid division errors */
        if (eps <= 0.0)
        {
          eps = 0.0000000001; /* Small value to prevent singularity */
        }
       
        if (eG > 0.3)
        {
          db = 0.0000001; /* almost zero db */
        }

        /* Calderbank’s model (1958) for pure liquid */
        /* db = C1 + C2 * ((surf_tension / rhoL)^0.6 / eps^0.4) * eG^0.5 */
        db = 0.0009 + 4.15 * pow(0.072 / density_liq, 0.6) * 1 / (pow(eps, 0.4)) * pow(eG, 0.5);

        return db;
      }

       

       

       

Viewing 4 reply threads
  • You must be logged in to reply to this topic.