-
-
December 4, 2023 at 3:15 pmsivaraman-sSubscriber
Hello,
I am trying to write a UDF code to implement Lee evaporation/condensation model, the problem I am facing is with the energy source term.
We know that in VOF, energy term corresponding to mass transfer is calculated as product of mass transfer rate and latent heat of evaporation. I create the same with my UDF as well, with a polynomial equation for latent heat of evaporation. However, after initialisation - FLUENT directly provides the error "Negative latent heat input detected". Even though the latent heat is explicitly mentioned in the UDF as well.
What can be done in this case to rectify this issue or what am I missing here.
For reference: I am trying the following UDF -
#include "udf.h"
real Se;
DEFINE_MASS_TRANSFER(Lee, cell, thread, from_index, from_species_index, to_index, to_species_index)
{
real m_lg;
real P=C_P(cell, thread);
real T_SAT = 7.1099*pow(P,3) - 2.1310E-03*pow(P,2) + 2.7456E-06*P + 123;
real h_lg= -4E-25*pow(P,5) + 0.0000000078*pow(P,4) - 0.00000000005*pow(P,3) + 0.042*pow(P,2) - 0.001252*P + 4607;
real Se;
Thread *liq = THREAD_SUB_THREAD(thread, from_index);
Thread *gas = THREAD_SUB_THREAD(thread, to_index);
m_lg = 0.;
Se = 0.;
/*evaporating*/
if (C_T(cell, liq) >= T_SAT)
{
m_lg = 0.1*C_VOF(cell,liq)*C_R(cell,liq)*fabs(C_T(cell,liq)-T_SAT)/T_SAT;
}
/*condensing*/
if ((m_lg == 0. ) && (C_T(cell, gas) <= T_SAT))
{
m_lg = -0.1*C_VOF(cell,gas)*C_R(cell,gas)*fabs(T_SAT-C_T(cell,gas))/T_SAT;
}
Se=-m_lg*h_lg;
return (m_lg);
}
/*=============================================================*/
/* */
/* SOURCE TERM FOR ENERGY */
/* */
/*=============================================================*/
DEFINE_SOURCE(e_source,cell,thread,dS,eqn)
{
return Se;
}
Thank you in advance -
December 5, 2023 at 7:01 amSRPAnsys Employee
Hi,
It appears that you are setting m_lg to zero initially and then trying to update it in the evaporating and condensing conditions. However, due to the condition m_lg==0, the condensing block might not execute as expected.
To address this issue, you can use separate variables for evaporating and condensing mass transfer rates and then sum them up to get the total mass transfer rate.
-
December 5, 2023 at 11:45 amsivaraman-sSubscriber
Â
Thanks for responding immediately. I tried the solution but it does not work and I realised what is happening and why I get the error.Â
Without considering UDF, In Lee model to implement the varying values of Tsat and latent heat for mass transfer rate and energy source term we either use the tabular format of PTL-sat table option from fluent or the FLUENT uses the values of sensible enthalpy in gas phase properties to set the latent heat of evaporation. However, when I use UDF, FLUENT does not have the way to use PTL table because it is not an option and so it goes to use formation enthalpy (i.e. standard state enthalpy) from FLUENT material properties for latent heat instead of using the Latent heat values from my UDF. Â
I can see that fluent ignores the values of latent heat from my udf and goes to material properties to calculate latent heat, but I am not sure how to rectify this issue. Is there a way in FLUENT for me to impose the values of Latent heat when using UDF for mass transfer mechanism?Â
Thanks in advance
Â
-
December 6, 2023 at 6:28 amSRPAnsys Employee
Hi,
You can try to create material properties in the database into the solver and then read it from solver.
You can find more details here: 8.1. Defining Materials (ansys.com)
Hope this helps you.
-
- The topic ‘VOF – Lee evaporation/condensation’ is closed to new replies.
- Non-Intersected faces found for matching interface periodic-walls
- Script error Code: 800a000d
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Fluent fails with Intel MPI protocol on 2 nodes
- Cyclone (Stairmand) simulation using RSM
- error udf
- Diesel with Ammonia/Hydrogen blend combustion
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Script Error
-
1301
-
591
-
544
-
524
-
366
© 2025 Copyright ANSYS, Inc. All rights reserved.