Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Saturation temperature UDF

    • TryingMyBest1232
      Subscriber

      Hello all,


      I have been trying to model evaporation at temperatures far well below 100C. This is primarily driven by the vapor content of air at the water-air interface.

      I found this discussion on the problem where a user had developed a UDF to solve this problem (see a version with a few adjustments below) : /forum/discussion/26620/saturation-temperature-udf-for-evaporation-condensation

      The setup this is used with has 2 phases, one a mixture of air and water vapor and the other is water.

      The results of using the UDF seem wrong intuitively. On a test where I ran warm air over a pool of water, the drier air had a higher saturation temperature and the lower air had a lower saturation temperature. Additionally, the fluctuation of saturation pressures across the domain is of the order 1e-1 which is much too low.

      I think the calculation of partial pressure on line 75 is wrong:

      (C_P(c, t)+ p_op)* (N_wv / N_total)

      I'm not sure if it should be this, or:

      (C_P(c, t))* (N_wv / N_total) + p_op

      or:

      (C_P(c, t))* (N_wv / N_total)

      or something else entirely. To me the final option makes sense, but this could lead to an error as there would be log_10(0) on line 81.

      Any advice would be appreciated.

      Cheers




      #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

      Thread *st = THREAD_SUB_THREAD(t, 1); // Secondary phase thread


      // Get the volume fraction of both phases

      real vf_s = C_VOF(c, st);

      real vf_p = 1 - vf_s;


      // Get the pressure of the mixture 

      real p_mix = C_P(c, t);


      // Get the operating pressure

      real p_op = RP_Get_Real("operating-pressure");


      // Primary phase density

      real rho_p = C_R(c, pt);



      // 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


      mixture_species_loop(m, sp, i)

      {

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

      }


      real p_w; // h20 pressure for cell


      // If secondary phase only

      if (vf_s == 1)

      {

      p_w = p_mix + p_op;

      }

      // If primary phase or mixture of phases

      else 

      {

      // Find the partial pressure of water vapour

      // partial pressure = cell pressure * water mole fraction


      // mass of primary phase in cell

      real m_prim = rho_p * vol * vf_p;


      // mass of water vapour and air in cell

      real m_wv = mf[0] * m_prim;

      real m_air = m_prim - m_wv;


      // No of moles in water vapour and air

      real N_wv = m_wv / MOLAR_MASS_WATER;

      real N_air = m_air / MOLAR_MASS_AIR;


      real N_total = N_wv + N_air;



      // water vapour partial pressure

      p_w = (C_P(c, t)+ p_op)* (N_wv / N_total);

      }


      // Calculate saturation temperature

      real t_sat;


      t_sat = (1730.63 / (10.196 - log10(p_w))) + 39.724;


      return t_sat;


      }

    • Surya Deb
      Ansys Employee
      Hello,
      The first option (C_P(c, t)+ p_op)* (N_wv / N_total) is correct as it need to have the Absolute pressure information.
      Also consider using Species Mass Transfer model if the evaporation/condensation is concentration driven.
      Check this link [https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v212/en/flu_th/InterfaceSpeciesMassTransfer-3A72B96D.html?q=species%20mass%20transfer]
      Regards SD
    • TryingMyBest1232
      Subscriber
      Thanks for the response! Do you see what else may be wrong with the code? The saturation temperatures it is returning are definitely not correct. The Saturation temperature being lower in places with more water vapour is a big giveaway but besides that, the variation is far too low.
    • Rob
      Forum Moderator
      Is water vapour the first species in the mixture list?

    • TryingMyBest1232
      Subscriber
      Thank you! It is always the stupid mistakes!
    • Rob
      Forum Moderator
      :) To make you feel better, remember that we've made (or seen) most of these before.
Viewing 5 reply threads
  • The topic ‘Saturation temperature UDF’ is closed to new replies.