-
-
May 4, 2023 at 2:25 pm
Julio Guzman
SubscriberAfternoon!
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.
-
May 4, 2023 at 3:24 pm
Rob
Ansys EmployeeIf you increase the initial temperaure does anything change?
-
May 4, 2023 at 3:40 pm
Julio Guzman
SubscriberThanks 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.
-
May 4, 2023 at 3:50 pm
Rob
Ansys EmployeeIf you add the phase change values into a User Defined Memory: what values do you see?
-
May 4, 2023 at 4:24 pm
Julio Guzman
SubscriberThese 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.
-
May 4, 2023 at 4:29 pm
Julio Guzman
SubscriberWhich phase change values specifically, sorry?
-
May 5, 2023 at 8:09 am
Rob
Ansys EmployeeI 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?
-
May 9, 2023 at 8:52 am
Julio Guzman
SubscriberHi Rob,
Hope you are well! Have you had a chance to take a look at my response?
Best,
Nick
-
May 9, 2023 at 8:54 am
Rob
Ansys EmployeeI have - look down! The UK got a bonus public holiday yesterday. :)
-
-
-
May 5, 2023 at 4:03 pm
Julio Guzman
SubscriberHi 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/m3DEFINE_PROPERTY(saturation_temp, c, ct){// ct: mixture cell thread// c: cell variable// Cell volumereal vol = C_VOLUME(c, ct);Thread *pp_ct = THREAD_SUB_THREAD(ct, 0); // Primary phase cell thread, phase index 0 for primary phaseThread *sp_ct = THREAD_SUB_THREAD(ct, 1); // Secondary phase cell thread, add 1 for other phases// Get the volume fraction of both phasesreal vf_sp = C_VOF(c, sp_ct);real vf_pp = 1 - vf_sp;// Get the pressure of the mixturereal p_mix = C_P(c, ct);// Get the operating pressurereal p_op = RP_Get_Real("operating-pressure");// Primary phase densityreal rho_pp = C_R(c, pp_ct);// Get mass fractions in primary phasereal mf[2]; // Array to store mass fractionsMaterial *m = THREAD_MATERIAL(pp_ct);Material *spe = NULL;int i; // Species index - 0 for water vapor and 1 for airmixture_species_loop(m, spe, i){mf[i] = C_YI(c, pp_ct, i);}real p_wv; // h20 pressure for cellreal t_sat; // saturation temperature// If secondary phase (liquid water) onlyif (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 phaseselse{// Find the partial pressure of water vapour// partial pressure = cell pressure * water mole fraction// mass of primary phase in cellreal m_pp = rho_pp * vol * vf_pp;// mass of water vapour and air in cellreal m_wv = mf[0] * m_pp;real m_air = m_pp - m_wv;// No of moles in water vapour and airreal 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 pressurep_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 behaviourt_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 -
May 9, 2023 at 8:52 am
Rob
Ansys EmployeeNo 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.
-
May 9, 2023 at 9:36 am
Julio Guzman
SubscriberIndeed, 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
-
-
May 9, 2023 at 11:05 am
Rob
Ansys EmployeeOK, 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.
-
May 10, 2023 at 10:43 am
Julio Guzman
SubscriberHi 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
-
May 10, 2023 at 12:52 pm
Rob
Ansys EmployeeIt 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.
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- Difference between K-epsilon and K-omega Turbulence Model
- The solver failed with a non-zero exit code of : 2
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error: Received signal SIGSEGV
-
5290
-
3311
-
2471
-
1308
-
1016
© 2023 Copyright ANSYS, Inc. All rights reserved.