Fluids

Fluids

Evaporation-Condensation with the Lee Model: Saturation Temperature UDF

    • Julio Guzman
      Subscriber

      Afternoon!

      I have written a UDF to calculate the saturation temperature of water vapour for use with the Lee model of evaporation and condensation.

      The problem I am testing the UDF on is:

      The primary phase is a mixture of water vapour and air (initialised to mass_fraction_air = 1 at inlet), and the secondary phase is liquid water, patched into the tank as indicated by the region with t_sat = 372K in the image below.

      The saturation temperature (and therefore the UDF) appears to be appropriate at all points in the domain upon Initialisation:

      However! I am not observing any mass transfer, and for the life of me can't figure out what's amiss. Even with significant run-time (the simulation is, of course, transient), the saturation temperature throughout the domain remains unchanged, reinforcing the fact that no mass transfer of water vapour has occured!

      On a physical basis, there should be evaporation in the interface region from the get-go. The entire problem domain is initialised to 20degC (293.15K), and there are cells in the interface region with a non-zero volume fraction of liquid water (secondary phase) at this temperature which is above the saturation temperature in those cells.

      To demonstrate, along a horizontal line near the top of the interface region, the volume fraction of water is ~0.1,

      the saturation temperature is ~283K,

      and the total temperature (mixture) is 293K

      yet there is no mass transfer!

      I have adjusted the 'From Phase Frequency' and 'To Phase Frequency' through a wide range of values to no avail.

      Would anyone that has worked on a similar problem before be able to make some suggestions that I can work on? Any help would be warmly appreciated.

    • Rob
      Ansys Employee

      If you increase the initial temperaure does anything change?

    • Julio Guzman
      Subscriber

      Thanks for your reply!

      No: I have experimented with a range of inlet temperatures, and entire domain temperatures (which I set at initialisation). The mass transfer is still zilch.

    • Rob
      Ansys Employee

      If you add the phase change values into a User Defined Memory: what values do you see? 

    • Julio Guzman
      Subscriber

      These are my solver settings:

      I have also experimented with adjusting bubble diameter of the secondary phase, and ensured that the phase and species IDs match up with those specified in the UDF.

      I have checked that the simulation works when using t_sat=constant (373K) with sufficiently hot inflowing air. There is still no evaporation (mass transfer coefficient zero), even after significant run time. This is suggesting there is no heat transfer taking place between the primary and secondary phases.

      Only when I intitialise the entire domain at 383K, with saturation temperature constant (i.e. no UDF hooked), is there evaporation at the interface!

      Thanks again for your time on this.

    • Julio Guzman
      Subscriber

      Which phase change values specifically, sorry?

    • Rob
      Ansys Employee

      I think there's a mass transfer value somewhere, so you can see mass evaporated/condensed in a step. With UDFs there are a few places you can go wrong, so it's possible the UDF is trying to move mass from one phase to the other (according to your model) but the hook up isn't correct so nothing happens. 

      If you need that high a temperature, check material properties. Also, please confirm what boundaries you have inside the domain: how many fluid zones are there?

      • Julio Guzman
        Subscriber

        Hi Rob,

        Hope you are well! Have you had a chance to take a look at my response?

        Best,

        Nick

        • Rob
          Ansys Employee

          I have - look down! The UK got a bonus public holiday yesterday. :) 

    • Julio Guzman
      Subscriber

      Hi Rob,

      The UDF I have written is to calculate saturation temperature given partial pressure of water and so does not involve any phase transfer values. I have diagnosed each line of the code using the Message() function (during initialisation) and everything outputted seems sensible! I haven't tracked any of them with a UDM yet!

      Please see below:

      #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, ct)
      {
      // ct: mixture cell thread
      // c: cell variable
       
      // Cell volume
      real vol = C_VOLUME(c, ct);
       
      Thread *pp_ct = THREAD_SUB_THREAD(ct, 0); // Primary phase cell thread, phase index 0 for primary phase
      Thread *sp_ct = THREAD_SUB_THREAD(ct, 1); // Secondary phase cell thread, add 1 for other phases
       
      // Get the volume fraction of both phases
      real vf_sp = C_VOF(c, sp_ct);
      real vf_pp = 1 - vf_sp;
       
      // Get the pressure of the mixture 
      real p_mix = C_P(c, ct);
       
      // Get the operating pressure
      real p_op = RP_Get_Real("operating-pressure");
       
      // Primary phase density
      real rho_pp = C_R(c, pp_ct);
       
      // Get mass fractions in primary phase
      real mf[2]; // Array to store mass fractions
       
      Material *m = THREAD_MATERIAL(pp_ct);
      Material *spe = NULL;
      int i; // Species index - 0 for water vapor and 1 for air
       
      mixture_species_loop(m, spe, i)
      {
      mf[i] = C_YI(c, pp_ct, i);
      }
       
      real p_wv; // h20 pressure for cell
      real t_sat; // saturation temperature
       
      // If secondary phase (liquid water) only
      if (vf_sp == 1)
      {
      p_wv = p_mix + p_op; // Gauge pressure of water + operating pressure
       
      // Inverted Tetens equation (see wikipedia)
      t_sat = (4947.46 - 82.46 * log10(p_wv)) / (23.69 - 2.3 * log10(p_wv));
      }
       
      // If primary phase (moist) 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_pp = rho_pp * vol * vf_pp;
       
      // mass of water vapour and air in cell
      real m_wv = mf[0] * m_pp;
      real m_air = m_pp - 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_wv = (C_P(c, ct) + p_op) * (N_wv / N_total);
       
       
      if (mf[0] < 0.01)
      {
      // Match Tetens to linear interpolation from NIST data to account for low partial water pressure behaviour
      t_sat = 8.64e-3 * p_wv + 273.15;
      }
       
      else
      {
      // Inverted Tetens equation (see wikipedia)
      t_sat = (4947.46 - 82.46 * log10(p_wv)) / (23.69 - 2.3 * log10(p_wv));
      }
       
      }
       
      return t_sat;
      }
       
      Regarding the high temperatures, I don't need to operate eventually at such high temperatures: I just wanted to check that, given solver settings etc, the simulation runs appropriately for the t_sat=const model (which it does), implying that nothing is wrong on the Solution Controls side of things.
       
      There are two fluid domains: one for the water (so that I could patch), and one for the humid air mixture. The settings for each are:
      In grey are the wall boundaries and in green the interal boundary between the two fluid domains:
       
      Does this all look sensible to you?
       
      Thanks for all your help so far!
       
      Best,
      Nick
       
    • Rob
      Ansys Employee

      No interface or wall & wall:shadow pairs so that's good.  

      Question for the UDF, I've not looked too closely (and won't be doing so), but did you account for the species fraction of vapour on the gas side? Nothing obviously wrong, so it's going to be a fairly long process to figure out what's happening. 

      • Julio Guzman
        Subscriber

        Indeed, I have accounted for the species fraction!

        I am at a loss. Is there anyone that I can speak to that would be able to commit some time to helping debug? I am a paying ANSYS customer on a Start-up Licence (through CADFem), and no one else at my company has experience using UDFs.

        Kind regards

    • Rob
      Ansys Employee

      OK, we can't comment much further via the Community as it counts as "public" from an Export Law point of view: I can give pointers but with UDFs that may not be enough. This platform was initially intended for Academic usage and is currently evolving to include anyone who wants a "simple but quick" answer. 

      However, with paid software you should have some level of support (my main task within Ansys is commercial customer support), and given you're a CADFEM customer I'd contact them. There should have been some information given at the time of purchase but from experience I know that can finish up with your company accounts group! Note, UDFs tend to fall slightly outside of the general support so their input may be limited. 

    • Julio Guzman
      Subscriber

      Hi Rob,

      Thanks for your input which is useful for future reference. I appreciate the help that you have given us within the bounds of your legal obligations!

      The problem was resolved by using the VOF model rather than the mixture model. It seems that the UDF was functioning well. The incompatability with the Mixture model we are still unsure about.

      Kind regards

    • Rob
      Ansys Employee

      It should be OK. Mixture and VOF are both single velocity field models, but I'm not sure exactly how the Phase Domain calls differ, if they do. 

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