September 26, 2023 at 2:34 pmRoyaSubscriber
I am trying to simulate a gas-liquid stirred tank. I am using a Grace drag model, for the modification, I dont want to use Brucato model, but I want to define a UDF based on another model. I know that I need to use the DEFINE_EXCHANGE_PROPERTY macro. The formula I would like to use can be defined as :
C_D_modified= modification_coefficient* C_D
* C_D being the drag coefficient that is already being calculated by the Grace model.
My issue is that I don't know how to call the drag coefficient that FLUENT is already calculating through the Grace model. I searched the UDF manual and was not able to find any macro for this. I found a code online which redefines the drag coefficient within the modification. So, I ended up writing the UDF below:
# include "udf.h"
#define sigma= 0.072;
DEFINE_EXCHANGE_PROPERTY(lane_drag_mod, cell, mixture_thread, scnd_clmn, frst_clmn)
Thread *thread_f, *thread_g;
real x-vel-f, x-vel-g, y-vel-f, y-vel-g, z-vel-f, z-vel-g;
real rho_f, rho_g, mu_f,g;
real eps_f, k_f;
real tau_b, int_t;
real stk, m_coeff;
real Eo, Mo, Re, Hfac, Jfac, C_Dsph, C_Dcap, C_Delip:
real C_D, C_Dmod;
thread_f = THREAD_SUB_THREAD(mix_thread, scnd_clmn); /* liquid phase */
thread_g = THREAD_SUB_THREAD(mix_thread, f_col); /* gas phase*/
/* ===================find phase velocities in all spatial directions================*/
x_vel_f = C_U(cell, thread_f);
y_vel_f = C_V(cell, thread_f);
z_vel_f = C_W(cell, thread_f);
x_vel_g = C_U(cell, thread_g);
y_vel_g = C_V(cell, thread_g);
z_vel_g = C_W(cell, thread_g);
/* ====================compute velocitiy differences=================================*/
slip_x = x_vel_g - x_vel_f;
slip_y = y_vel_g - y_vel_f;
slip_z = z_vel_g - z_vel_f;
abs_v = sqrt(slip_x*slip_x + slip_y*slip_y + slip_z*slip_z);
/*=====================finding the properties of gas and liquid======================*/
rho_f = C_R(cell, thread_f);
rho_g = C_R(cell, thread_g);
mu_f = C_MU_L(cell, thread_f);
k_f= C_K(cell, thread_f);
eps_f= C_D(cell, threaf_f);
diam = C_PHASE_DIAMETER(cell, thread_g);
void_g = C_VOF(cell, thread_g);
/*================calculating bubble relaxation time and the integral time===========*/
/*===================calculating modification coefficient============================*/
m_coeff= powf((1 - 1.4 * powf(stk,0.7) * exp(-0.6 * stk)),-2.0)
/*=======================Grace drag model defining==================================*/
Eo= (g * (rho_f - rho_g) * diam * diam)/ sigma;
Mo= (powf(mu_f,4) * g * (rho_f - rho_g))/(powf(rho_f,2) * powf(sigma,3);
Re= (rho_f * abs_v * diam)/ mu_f;
Hfac= 4/3 * Eo * powf (Mo,-0.149) * powf (mu_f/mu_ref, -0.14);
Jfac= 0.94 * powf(Hfac,0.757);
else if (Hfac>59.3)
Jfac= 3.42 * powf(Hfac,0.441);
U_ter=(mu_f/(rho_f * diam)) * powf(Mo,-0.149) * (Jfac-0.857);
else if (Re=>0.01)
/*==========================Calculating modified drag===============================*/
Now, can anyone tell me if this is corect?
Also, looking at the Theory guide, I can see that the interphase Exchange coefficient (K_pq) is dependent on the drag coefficient. Should I also embed that within the code?
I appreciate any help you can give me. I am really stuck with this and no one can help me.
September 26, 2023 at 4:14 pmRobForum Moderator
Looking at the example I don't think it's available. I'm also very limited in what I can say as UDFs aren't fully supported and we're straying into specific knowledge.
Others in the Community aren't necessarily bound by the same rules as staff.
September 27, 2023 at 9:39 amRoyaSubscriber
Hello Rob. Thanks for your answer.
May I ask what do you mean by your comment? I do not find it clear. Which example? What do you mean by "Others in the Community aren't necessarily bound by the same rules as staff"?
I need a drag modification except Brucato as Brucato over predicts for gas-liquid flow. The only way there is to define a UDF, and doing that, I am not sure how I can call the drag coefficient being calculated by FLUENT (I use Grace model), to the code so I can multiply it to the modification coefficient I am defining in UDF. The only I found was to maybe embed the drag model in the code as well and then use the whole UDF as a Drag model instead of a modification model.
Another issue is that the interphase exchange coefficient which is given as K_pq in FLUENT theory guide, is also dependent on the drag coefficient and if I change drag coefficient, then I should also change K_pq.
In tutorial, there is no modification example in DEFINE-EXCHANGE-PROPERTY. I really appreciate any useful insight you can give me.
September 27, 2023 at 11:10 amRobForum Moderator
https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v232/en/flu_udf/flu_udf_MultiphaseDEFINE.html%23flu_udf_sec_define_exchange_property Example 1?
Staff knowledge of the Ansys software can be considered as an export under US Export Law. As such we're restricted to general/public knowledge and the documentation.
- 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.
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.
- Licensing – Request name does not exist in the licensing pool
- 2022 R1 Ansys Mechanical APDL: QXcbConnection: Failed to initialize XRandr
- error “ansyslmd: Cannot connect to license server system. (-15,10032)
- The analysis systems in Workbench are missing
- Student license renewal
- Mechanical APDL Launcher Options
- how to open files created from newer version by using the older version of ansys
- Problems using 2022/R2
- Results Probe in ANSYS Workbench
- Unable to delete system in Ansys Workbench
© 2023 Copyright ANSYS, Inc. All rights reserved.