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

Di Felice drag model for dpm

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 30, 2019, 18:21
Default Di Felice drag model for dpm
  #1
New Member
 
Yassin ALkassar
Join Date: Jan 2017
Posts: 11
Rep Power: 9
Yassin is on a distinguished road
Can anyone help me in writing UDF for Di Felice drag model in DPM model?
Regards;
Attached Images
File Type: jpg Di-Felice-10-drag-model-equations-and-parameters_W640.jpg (27.6 KB, 37 views)
Yassin is offline   Reply With Quote

Old   July 31, 2019, 01:09
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Ansys Fluent Customization manual -> DEFINE_DPM_DRAG macro

best regards
AlexanderZ is offline   Reply With Quote

Old   July 31, 2019, 07:16
Default
  #3
New Member
 
Yassin ALkassar
Join Date: Jan 2017
Posts: 11
Rep Power: 9
Yassin is on a distinguished road
I wrote Udf for Di Felice drag.
can you check it, please?
******************************
#include "udf.h"

#define pi 4.*atan(1.)

DEFINE_DPM_DRAG(dpm_DiFelice_drag,Re,p)
{
Thread *thread_g, *thread_s, *mix_thread;
real x_vel_g, x_vel_s, y_vel_g, y_vel_s, abs_v, slip_x, slip_y,
rho_g, rho_s, mu_g,
diam2, reyp1,void_g, void_s,Res, Cd, X, k_g_s;

cell_t cell;


/*find the cell index and thread of the cell that the particle is currently in*/
cell=P_CELL_THREAD(p);
mix_thread=THREAD_SUB_THREAD(P_CELL_THREAD(p),0);

/* find the threads for the gas (primary) */

thread_g = THREAD_SUB_THREAD(mix_thread,0);/* gas phase thread */
thread_s = THREAD_SUB_THREAD(mix_thread,1);/* solid phase thread */
/* find phase velocities and properties*/


x_vel_g = C_U(cell, thread_g);
y_vel_g = C_V(cell, thread_g);

x_vel_s=P_VEL(p)[0];
y_vel_s=P_VEL(p)[1];

slip_x = x_vel_g - x_vel_s;
slip_y = y_vel_g - y_vel_s;

rho_g = C_R(cell, thread_g); /*density*/
rho_s =P_RHO(p);

mu_g = C_MU_L(cell, thread_g); /*laminar viscosity*/

diam2 =P_DIAM(p);

/*compute slip*/
abs_v = sqrt(slip_x*slip_x + slip_y*slip_y); /*absolute value of slip velocity*/

void_g = C_VOF(cell, thread_g);/* gas vol frac*/
void_s = 1-void_g;/*particle vol frac*/

/*compute reynolds number*/
reyp =rho_g*abs_v*diam2 /mu_g; /*no volume fraction???*/
Res = void_g*reyp;

Cd=pow((0.63+4.8*sqrt(1/Res),2);

X = 3.7-0.65*exp(-pow(1.5-log10(Res),2)/2);


/* Di Felice Model */
k_g_s = 1/8*Cd*void_g*rho_g*pi*diam2*diam2*abs_v*abs_v*pow(v of_g,-X);


return k_g_s;

}
****************
Yassin is offline   Reply With Quote

Old   August 1, 2019, 02:25
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
#include "udf.h"
#include "math.h"

#define pi 4.*atan(1.)

DEFINE_DPM_DRAG(dpm_DiFelice_drag,Re,p)
{
Thread *thread_g, *thread_s, *mix_thread;
real x_vel_g, x_vel_s, y_vel_g, y_vel_s, abs_v, slip_x, slip_y,
rho_g, rho_s, mu_g, 
diam2, reyp,void_g, void_s,Res, Cd, X, k_g_s;

cell_t cell;


/*find the cell index and thread of the cell that the particle is currently in*/
cell=P_CELL(p);
mix_thread=THREAD_SUB_THREAD(P_CELL_THREAD(p),0);

/* find the threads for the gas (primary) */

thread_g = THREAD_SUB_THREAD(mix_thread,0);/* gas phase thread */
thread_s = THREAD_SUB_THREAD(mix_thread,1);/* solid phase thread */
/* find phase velocities and properties*/


x_vel_g = C_U(cell, thread_g);
y_vel_g = C_V(cell, thread_g);

x_vel_s=P_VEL(p)[0];
y_vel_s=P_VEL(p)[1];

slip_x = x_vel_g - x_vel_s;
slip_y = y_vel_g - y_vel_s; 

rho_g = C_R(cell, thread_g); /*density*/
rho_s =P_RHO(p);

mu_g = C_MU_L(cell, thread_g); /*laminar viscosity*/

diam2 =P_DIAM(p);

/*compute slip*/
abs_v = sqrt(slip_x*slip_x + slip_y*slip_y); /*absolute value of slip velocity*/

void_g = C_VOF(cell, thread_g);/* gas vol frac*/
void_s = 1-void_g;/*particle vol frac*/

/*compute reynolds number*/
reyp =rho_g*abs_v*diam2 /mu_g; /*no volume fraction???*/ 
Res = void_g*reyp;

Cd=pow((0.63+4.8*sqrt(1/Res)),2);

X = 3.7-0.65*exp(-pow(1.5-log10(Res),2)/2);


/* Di Felice Model */
k_g_s = 1/8*Cd*void_g*rho_g*pi*diam2*diam2*abs_v*abs_v*pow(void_g,-X); 


return k_g_s;

}
I've checked only syntax, I don't know if you've apllied equations in right way or not.

check final equation in UDF
Code:
k_g_s = 1/8*Cd*void_g*rho_g*pi*diam2*diam2*abs_v*abs_v*pow(void_g,-X);
AlexanderZ is offline   Reply With Quote

Old   August 1, 2019, 03:37
Default
  #5
New Member
 
Yassin ALkassar
Join Date: Jan 2017
Posts: 11
Rep Power: 9
Yassin is on a distinguished road
Thanks for your replying.
I am facing the following problem when I interpreted the code:

: math.h: No such file or directory
:line 17: P_CELL: undeclared variable
Yassin is offline   Reply With Quote

Old   August 2, 2019, 00:48
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
compile this code

best regards
AlexanderZ is offline   Reply With Quote

Reply


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
How to compile a new drag force in Lagrangian model lilinmin OpenFOAM Programming & Development 4 June 9, 2016 05:15
Drag model implementation vbchris OpenFOAM Running, Solving & CFD 1 March 31, 2015 09:28
about Subgrid-scale model impecca OpenFOAM Running, Solving & CFD 4 December 20, 2013 11:36
multiphase model and drag law Yasmail AKARIOUH FLUENT 0 April 29, 2008 08:44
multiphase flow modelling, Drag model Anant CFX 1 February 4, 2008 05:18


All times are GMT -4. The time now is 15:57.