|
[Sponsors] |
July 30, 2019, 18:21 |
Di Felice drag model for dpm
|
#1 |
New Member
Yassin ALkassar
Join Date: Jan 2017
Posts: 11
Rep Power: 9 |
Can anyone help me in writing UDF for Di Felice drag model in DPM model?
Regards; |
|
July 31, 2019, 01:09 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Ansys Fluent Customization manual -> DEFINE_DPM_DRAG macro
best regards |
|
July 31, 2019, 07:16 |
|
#3 |
New Member
Yassin ALkassar
Join Date: Jan 2017
Posts: 11
Rep Power: 9 |
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; } **************** |
|
August 1, 2019, 02:25 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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; } 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); |
|
August 1, 2019, 03:37 |
|
#5 |
New Member
Yassin ALkassar
Join Date: Jan 2017
Posts: 11
Rep Power: 9 |
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 |
|
August 2, 2019, 00:48 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
compile this code
best regards |
|
|
|
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 |