CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Drag modification UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 26, 2023, 11:07
Default Drag modification UDF
  #1
Member
 
Roy
Join Date: Sep 2017
Posts: 80
Rep Power: 8
ROY4 is on a distinguished road
Hello everyone,
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 mu_ref=0.0009;
#define C_exp=0;

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);
g= NV_MAG(M-gravity);
diam = C_PHASE_DIAMETER(cell, thread_g);
void_g = C_VOF(cell, thread_g);

/*================calculating bubble relaxation time and the integral time===========*/
tau_b=rho_g*diam*diam/18./mu_g;
int_t=0.135*k_f/eps_f;

/*===================calculating modification coefficient============================*/
stk=tau_b/int_t;
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);

if (2<Hfac<=59.3)
{
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);

if (Re<0.01)
{
C_Dsph=24/Re;
}
else if (Re=>0.01)
{
C_Dsph=24*(1+0.15*powf(Re,0.687))/Re;
}

C_Dcap=8/3.;

C_Delip=(4*g*diam*(rho_f-rho_g))/(3*powf(U_ter,2)*rho_f);

C_D=powf(void_g,C_exp)*max(min(C_Delip,C_Dcap),C_D sph);
/*==========================Calculating modified drag===============================*/
C_Dmod=m_coeff*C_D;

return C_Dmod
}

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.

Many thanks,Roya
ROY4 is offline   Reply With Quote

Reply

Tags
#multiphase, fluent - udf


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF for drag force piaoyangdexue Fluent UDF and Scheme Programming 1 November 3, 2023 14:11
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF acasas CFD Freelancers 1 January 23, 2015 07:26
Help needed on UDF for modification of default syamlal o' brien drag law caai9 Fluent UDF and Scheme Programming 9 August 20, 2014 08:52
UDF DPM drag Hanz FLUENT 0 June 2, 2009 04:32
access drag coeff and udf for granular temp jwwang FLUENT 0 May 22, 2006 00:48


All times are GMT -4. The time now is 14:10.