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

Gidaspow udf

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 18, 2013, 23:02
Default
  #21
Member
 
Musango Lungu
Join Date: Dec 2011
Location: China
Posts: 73
Rep Power: 14
Musa is on a distinguished road
@Mohsen certainly the drag model has not been properly coded meaning the results obtained in the paper are questionable. Did the authors of the paper use the same code? If so bring it to their attention that the code has some errors! i.e. the definition of the particle reynolds number is not correct and the condition for switching to different regimes is missing.
Musa is offline   Reply With Quote

Old   October 19, 2013, 07:48
Default
  #22
Member
 
mohsen
Join Date: Sep 2013
Posts: 42
Rep Power: 13
mohsen0488 is on a distinguished road
I read thesis of the paper and in appendix of the thesis that code was written for gidaspow with switch function.and i think that the code has some errors.


thanks a lot for your replies Dear Musa ,You've helped me a lot.

I wish the best for you.
mohsen0488 is offline   Reply With Quote

Old   October 19, 2013, 08:09
Default
  #23
Member
 
Musango Lungu
Join Date: Dec 2011
Location: China
Posts: 73
Rep Power: 14
Musa is on a distinguished road
You are welcome buddy!
Musa is offline   Reply With Quote

Old   October 24, 2013, 16:18
Default
  #24
New Member
 
temour
Join Date: Sep 2013
Posts: 6
Rep Power: 13
temo is on a distinguished road
aoa, i have used this udf for gas solid fluidized bed and gives accurate results now i want to change from gas to liquid(water), tell me what are the changes required to do in code for this, waiting for ur reply
udf for customizing syamlal drag law in Fluent

#include "udf.h"
#define pi 4.*atan(1.)
#define diam2 3.e-4
DEFINE_EXCHANGE_PROPERTY(custom_drag, cell, mix_thread, s_col, f_col)
{
Thread *thread_g, *thread_s;
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, reyp, afac,
bfac, void_g, vfac, fdrgs, taup, k_g_s;
/* find the threads for the gas (primary) */
/* and solids (secondary phases) */
thread_g = THREAD_SUB_THREAD(mix_thread, s_col);/* gas phase */
thread_s = THREAD_SUB_THREAD(mix_thread, f_col);/* solid phase*/
/* find phase velocities and properties*/
x_vel_g = C_U(cell, thread_g);
y_vel_g = C_V(cell, thread_g);
x_vel_s = C_U(cell, thread_s);
y_vel_s = C_V(cell, thread_s);
slip_x = x_vel_g - x_vel_s;
slip_y = y_vel_g - y_vel_s;
rho_g = C_R(cell, thread_g);
rho_s = C_R(cell, thread_s);
mu_g = C_MU_L(cell, thread_g);
/*compute slip*/
abs_v = sqrt(slip_x*slip_x + slip_y*slip_y);
/*compute Reynold's number*/
reyp = rho_g*abs_v*diam2/mu_g;
/* compute particle relaxation time */
taup = rho_s*diam2*diam2/18./mu_g;
void_g = C_VOF(cell, thread_g);/* gas vol frac*/
/*compute drag and return drag coeff, k_g_s*/
afac = pow(void_g,4.14);
if(void_g<=0.85)
bfac = 0.281632*pow(void_g, 1.28);
else
bfac = pow(void_g, 9.076960);
vfac = 0.5*(afac-0.06*reyp+sqrt(0.0036*reyp*reyp+0.12*reyp*(2.*bfac-afac)+
afac*afac));
fdrgs = void_g*(pow((0.63*sqrt(reyp)/
vfac+4.8*sqrt(vfac)/vfac),2))/24.0;
k_g_s = (1.-void_g)*rho_s*fdrgs/taup;
return k_g_s;
}
temo is offline   Reply With Quote

Old   October 24, 2013, 16:20
Default
  #25
New Member
 
temour
Join Date: Sep 2013
Posts: 6
Rep Power: 13
temo is on a distinguished road
i have used this udf for gas solid fluidized bed and gives accurate results now i want to change from gas to liquid(water), tell me what are the changes required to do in code for this, waiting for ur reply
udf for customizing syamlal drag law in Fluent

#include "udf.h"
#define pi 4.*atan(1.)
#define diam2 3.e-4
DEFINE_EXCHANGE_PROPERTY(custom_drag, cell, mix_thread, s_col, f_col)
{
Thread *thread_g, *thread_s;
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, reyp, afac,
bfac, void_g, vfac, fdrgs, taup, k_g_s;
/* find the threads for the gas (primary) */
/* and solids (secondary phases) */
thread_g = THREAD_SUB_THREAD(mix_thread, s_col);/* gas phase */
thread_s = THREAD_SUB_THREAD(mix_thread, f_col);/* solid phase*/
/* find phase velocities and properties*/
x_vel_g = C_U(cell, thread_g);
y_vel_g = C_V(cell, thread_g);
x_vel_s = C_U(cell, thread_s);
y_vel_s = C_V(cell, thread_s);
slip_x = x_vel_g - x_vel_s;
slip_y = y_vel_g - y_vel_s;
rho_g = C_R(cell, thread_g);
rho_s = C_R(cell, thread_s);
mu_g = C_MU_L(cell, thread_g);
/*compute slip*/
abs_v = sqrt(slip_x*slip_x + slip_y*slip_y);
/*compute Reynold's number*/
reyp = rho_g*abs_v*diam2/mu_g;
/* compute particle relaxation time */
taup = rho_s*diam2*diam2/18./mu_g;
void_g = C_VOF(cell, thread_g);/* gas vol frac*/
/*compute drag and return drag coeff, k_g_s*/
afac = pow(void_g,4.14);
if(void_g<=0.85)
bfac = 0.281632*pow(void_g, 1.28);
else
bfac = pow(void_g, 9.076960);
vfac = 0.5*(afac-0.06*reyp+sqrt(0.0036*reyp*reyp+0.12*reyp*(2.*bfac-afac)+
afac*afac));
fdrgs = void_g*(pow((0.63*sqrt(reyp)/
vfac+4.8*sqrt(vfac)/vfac),2))/24.0;
k_g_s = (1.-void_g)*rho_s*fdrgs/taup;
return k_g_s;
}
temo is offline   Reply With Quote

Old   October 24, 2013, 21:48
Default
  #26
Member
 
Musango Lungu
Join Date: Dec 2011
Location: China
Posts: 73
Rep Power: 14
Musa is on a distinguished road
@ Temour buddy sorry but I do not have any experience with gas-liquid fluidized beds!
Musa is offline   Reply With Quote

Old   July 19, 2016, 09:42
Post
  #27
New Member
 
adnan
Join Date: Jul 2016
Posts: 5
Rep Power: 10
eddy123 is on a distinguished road
Quote:
Originally Posted by mohsen0488 View Post
Musa I tried with that code and the results were similar results of paper
so do you think results of this paper are incorrect?
How to write the UDF for DPM drag. I tried to write the UDF for DPM-Gidaspow drag model but it did not work properly. Any one can help me where I am wrong. Any help will be appreciated. Below is my UDF

#include "udf.h"
#include "dpm.h"
#define ZERO 0.0000001

DEFINE_DPM_DRAG(dpm_gidaspow_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, dp, reyp, reyp1,void_g, void_s, cd, D;
cell_t cell;
real left_term;
real dragcoefficient;

/*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*/

dp =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*/

Message ("Voidage of gas phase %f \n", void_g);

void_s = 1-void_g;/*particle vol frac*/

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


if(reyp1<1000)
cd=24/reyp1*(1+0.15*pow(reyp1,0.687));
else
cd = 0.44;
if (void_g <=0.8)
{
/* Ergun Drag Model */
D = 150.0*void_s*void_s*mu_g/void_g/dp/dp+1.75*void_s*rho_g*abs_v/dp;
}
else
{
/* Wen & Yu Model */
D = 0.75*cd*void_g*void_s*rho_g*abs_v/dp/pow(void_g,2.65);
}

left_term=rho_s*pow(dp,2)/mu_g;
dragcoefficient=left_term*D/(abs_v+ZERO);
return dragcoefficient;

}
eddy123 is offline   Reply With Quote

Old   December 13, 2021, 05:43
Default
  #28
Member
 
Join Date: Feb 2020
Posts: 31
Rep Power: 6
The_seeker is on a distinguished road
Hi All,

I am trying to model 2D fluidized bed with laminar flow conditions and validate it with a paper. Following is the Gidaspow model that I wrote in UDF. Looking at the discussion in this thread, I feel that the code that I have written is correct but I am not able to get good convergence for continuity. I would appreciate if someone can guide me on this.


DEFINE_EXCHANGE_PROPERTY (custom_drag, cell, mix_thread,s_col,f_col)

{
Thread *thread_g, *thread_s;
real x_vel_g, x_vel_s, y_vel_g, y_vel_s, abs_v, slip_x, slip_y, rho_g, mu_g, reyp, void_g, k_g_s, cd;

/*find the threads for the gas (primary) */
/*and solid (secondary phases) */

thread_g =THREAD_SUB_THREAD (mix_thread, s_col); /*gas phase */
thread_s=THREAD_SUB_THREAD (mix_thread, f_col);/*solid phase*/

/*find phase velocities*/

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

x_vel_s = C_U(cell, thread_s);
y_vel_s = C_V(cell, thread_s);

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

rho_g = C_R (cell, thread_g);
mu_g = C_MU_L (cell, thread_g);
void_g = C_VOF (cell, thread_g); /*gas vol fraction*/

/*compute slip*/
abs_v=sqrt(slip_x*slip_x+slip_y*slip_y);


/*compute Reynolds number*/
reyp=rho_g*abs_v*diam2/mu_g;

/*compute drag coefficient*/
if (reyp <= 1000)
cd = (24/(void_g*reyp)*(1+0.15*pow((void_g*reyp), 0.687)));
else
cd = 0.44;
if (void_g <= 0.8)
k_g_s = ((150*(1-void_g)*(1-void_g)*mu_g)/(void_g*diam2*diam2))+((1.75*rho_g*abs_v)/(diam2));
else
k_g_s = (3/4)*cd*((void_g*(1-void_g)*rho_g*abs_v*pow(void_g,-2.65))/diam2);
return k_g_s;
}
The_seeker is offline   Reply With Quote

Old   December 13, 2021, 23:45
Default
  #29
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
if UDF works without problems, your convergence issue is related to other factors (most likely):
1. discretization scheme
2. time step resolution
3. mesh resolution
4. boundary conditions
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   February 17, 2024, 09:16
Default asking some questions
  #30
New Member
 
Amin
Join Date: Feb 2024
Posts: 1
Rep Power: 0
Amin Gh is on a distinguished road
Quote:
Originally Posted by Musa View Post
Mohsen you are absolutely right the reyp has to be multiplied by void_g in the equation containing Cd but this has not been done in the code although it has been shown in the paper . Secondly there is no condition for switching from one regime to the other i.e from Ergun for the dense bed (void_g > 0.8) to WenYu for ( void_g<= 0.8). The stitching function simply ensures smooth transition from one regime to the other meaning that the condition of regime change must still be given.
Hi Musa,
I'm trying to write the UDF of gidaspow drag model then I want to write my own drag model UDF buy I don't know how to do it would you please help me?
Amin Gh 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
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 08:37
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 22:38
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 00:59.