TAGGED: udf


August 15, 2023 at 2:42 amDing HCSubscriber
Hello everyone, I have a question regarding the usage of a UserDefined Function (UDF) to define the interphase heat transfer coefficient for the Eulerian model (TwoFluids Model,TFM) within ANSYS FLUENT. I'm wondering whether the UDF should return the heat transfer coefficient 'h' (measured in W/m²K) directly, or if it should return the product of the heat transfer coefficient 'h' and the interface area 'Ai' (measured in 1/m). Additionally, I have a few minor questions to ask:
I've developed a UDF based on the RanzMarshall correlation to compute the interphase heat transfer coefficient between the liquid phase and the interface. However, the computed results differ from those obtained using FLUENT's internal RanzMarshall correlation. I'm seeking insights into the potential reasons for this disparity.
Concerning the correlation itself, should the 'Pr' value in the correlation refer to the Prandtl number of the gas phase? I came across this information in the FLUENT Theory Guide, but I'm uncertain about its accuracy.
Here is the UDF code I have written:
include "udf.h"
DEFINE_EXCHANGE_PROPERTY(htc_1, c, mixthread, pi1, pi2)
{
Thread* liqthread, * vapthread;
real Nu, h, h_eff, Re, Pr, vel,d,k,cp,mu,Ai;
real NV_VEC(v);
liqthread = THREAD_SUB_THREAD(mixthread, pi1);
vapthread = THREAD_SUB_THREAD(mixthread, pi2);
d = C_PHASE_DIAMETER(c, vapthread);
k = C_K_L(c, vapthread);
cp = C_CP(c, vapthread);
mu = C_MU_L(c, vapthread);
Pr = (cp * mu) / k;
NV_DD(v, =, C_U(c, liqthread), C_V(c, liqthread), C_W(c, liqthread), , C_U(c, vapthread), C_V(c, vapthread), C_W(c, vapthread));
vel = NV_MAG(v);
Re = (C_R(c, liqthread) * vel * d) / (C_MU_L(c, liqthread));
Nu = 2.0 + 0.6 * pow(Re, 0.5) * pow(Pr, 1. / 3.);
h = C_K_L(c, liqthread) * Nu / d;
Ai = 6.0 * C_VOF(c, vapthread) / d;
h_eff = h * Ai;
return h_eff;
}Thanks!😊

August 16, 2023 at 12:01 pmAtharva NagarkarSubscriber
Hello,
Please refer to the UDF Manual for detailed explanation on the DEFINE_EXCHANGE_PROPERTY macro. I have attached the link below for your reference. Check section 2.4.3 as well as example 3 (section 2.4.3.5) which is related to your topic. As per the manual, the UDF will need to return the real value of the effective heat transfer coefficient to the solver. So, if the quantity being modeled by your UDF depends on the interfacial area, your UDF should return the coefficient multiplied by the interfacial area.
2.4. Multiphase DEFINE Macros (ansys.com)
As per the Fluent Theory Guide, for the RanzMarshall model, the relative Reynolds number is based on the diameter of one phase which is liquid in your case. The Prandtl number is defined for the other phase which must be gas. Please check the section 14.5.17.1.3 of the Theory guide, the link of which is given below.
14.5.17. Description of Heat Transfer (ansys.com)
If you are not able to access the links, please refer to this forum discussion: Using Help with links (ansys.com)
Thanks!

August 16, 2023 at 12:34 pmDing HCSubscriber
Thank you very much！
Let me confirm once again that the UserDefined Function (UDF) needs to provide the actual volumetric heat transfer coefficient in units of W/m²*K. This coefficient should be calculated using the properties of the gas to define the Prandtl number.
This information is mentioned in both the theoretical manual and the UDF manual. However, I've noticed a discrepancy between this information and the heat transfer coefficient UDF example provided in the UDF manual. So, I would like to verify this once again for clarity.
In the example 2.4.3.5 provided in the UDF manual, the returned heat transfer coefficient is multiplied by the interface area density. However, according to the definitions and descriptions given earlier, the expected return value should be the true, unmodified heat transfer coefficient. Does this mean that there is an error in the provided example? Below is a screenshot of the code from the example.


August 16, 2023 at 12:47 pmAtharva NagarkarSubscriber
Hello,
Please check my earlier post for clarification. It says that "The UDF will need to return the real value of the effective heat transfer coefficient to the solver. So, if the quantity being modeled by your UDF depends on the interfacial area, your UDF should return the coefficient multiplied by the interfacial area."
This is why in the example, the returned value is multiplied by the interface area.
Thanks!

August 16, 2023 at 1:02 pmDing HCSubscriber
Thank you for your reply！
This means that in the UDF definition for the phase interaction of heat transfer coefficient, what I need to return is the effective heat transfer coefficient, which is the product of the volumetric heat transfer coefficient and the interface area. Instead of the Single volumetric heat transfer coefficient introduced and mentioned in the manual earlier, right?


 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.
 Floating point exception in Fluent
 What are the differences between CFX and Fluent?
 Heat transfer coefficient
 Difference between Kepsilon and Komega Turbulence Model
 Getting graph and tabular data from result in workbench mechanical
 The solver failed with a nonzero exit code of : 2
 Suppress Fluent to open with GUI while performing in journal file
 Mesh Interfaces in ANSYS FLUENT
 Time Step Size and Courant Number
 error: Received signal SIGSEGV

7592

4440

2953

1427

1322
© 2023 Copyright ANSYS, Inc. All rights reserved.