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

Drag coefficient, DPM.

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By cfd_user
  • 1 Post By Jorge poyatos

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 3, 2009, 12:29
Default Drag coefficient, DPM.
  #1
jorge poyatos
Guest
 
Posts: n/a
Hello,

I am trying to simulate a turbulent flow with the DPM but the drag coefficient is too low.

I have found that there is a correction called Magelli correction and it is possible to get it from fluent users as a UDF. I dont have access to fluent users so please somebody send it to me? it is in Fluent UDF Archive UDF52.

Thank you very much.

  Reply With Quote

Old   March 3, 2009, 15:12
Default Re: Drag coefficient, DPM.
  #2
cfd_user
Guest
 
Posts: n/a
hello, i know you have been posting the same query many times here. i checked, & there is no Solution ID 52 ! this is what i get:

UDF for computing wall shear stress on user-selected walls(Solution ID=1459) UDF for accessing field variables on the nodes of a face thread(Solution ID=1413) UDF to export variable data into a file in ASCII format from the parallel version(Solution ID=1412) UDF to flag the cells at a boundary that have reversed flow (backflow)(Solution ID=1351) UDF for reading tabulated or experimental values of material properties into FLUENT(Solution ID=1338) UDF template for implementing a droplet breakup model with steady discrete phase model (DPM) tracking(Solution ID=1328) UDF to compute the integral of a variable along a line(Solution ID=1293) Using a UDF to generate a Step-by-Step particle tracking report file from a calculation running in batch mode(Solution ID=1263) How to print to the GUI or an output file from a UDF(Solution ID=1175) How to make contour plots of difference in pressures (or any other variable) in two data sets(Solution ID=416) How can my UDF write output files with the flow time as part of the file name?(Solution ID=1105) UDF to determine the amount of time fluid spends in high shear regions(Solution ID=1072) UDF to extract variables on surface created for postprocessing(Solution ID=1056) UDF to compute particle slip velocity(Solution ID=920) UDF to calculate and report the torque on a rotor shaft(Solution ID=917) UDF to obtain the mean diameter of particles at each cell in a spray simulation(Solution ID=830) UDF to model a moving porous medium(Solution ID=831) Compute fluid residence time(Solution ID=619) Compute fan pressure drop as a function of radius(Solution ID=508) Compute radiation heat transfer rate on an interior surface(Solution ID=669) Compute turbulent diffusion coefficient for a user-defined scalar(Solution ID=668) Access to values computed by a custom field function inside a UDF(Solution ID=512) Compute radial, axial and tangential velocity components inside a UDF(Solution ID=562) Compute Swirl Ratio(Solution ID=650) Reading and Interpolating source term from point data input file not aligned with the grid(Solution ID=625) Herschel-Bulkley viscosity with spatial dependence(Solution ID=585) Transient velocity profile imposed on a moving wall(Solution ID=616) Modeling forced diffusion in binary gas or liquid mixtures (single phase only)(Solution ID=672) Adjusting mass flow inlet boundary conditions to achieve a target thrust(Solution ID=718) UDF to dynamically change the timestep size during calculation(Solution ID=757) UDF to specify both spatial and temporal temperature profile on a wall zone(Solution ID=825) ---------------------- so please give the correct soltuion ID.

thanks.
  Reply With Quote

Old   March 4, 2009, 08:37
Default Re: Drag coefficient, DPM.
  #3
jorge poyatos
Guest
 
Posts: n/a
Thank you!

I have a technical note from Fluent TN253, "Solid-liquid Multiphase Flow Validation in Tall Stirred Vessels with Multiple Impeller Systems", where it is said:

This constant CD was then prescribed using a user-defined function (Fluent UDF Archive UDF52)

I don't know where to find it but if you could try I woud be very pleased. My project is stuck now!

Thank you again!
  Reply With Quote

Old   March 4, 2009, 09:11
Default Re: Drag coefficient, DPM.
  #4
cfd_user
Guest
 
Posts: n/a
can u send me that technical note by my mail asap ? thanks.
  Reply With Quote

Old   March 4, 2009, 09:50
Default Re: Drag coefficient, DPM.
  #5
jorge poyatos
Guest
 
Posts: n/a
I need your mail adrees to link the file. You can also look it up on the internet just writing in google:

Solid-liquid Multiphase Flow Validation in Tall Stirred Vessels with Multiple Impeller Systems.

Thank you again for your interest!
  Reply With Quote

Old   March 6, 2009, 12:57
Default Re: Drag coefficient, DPM.
  #6
cfd_user
Guest
 
Posts: n/a
just copy + paste.........

#include "sg_mphase.h" #include "sg.h" #include <stdio.h> #define pi 4.*atan(1.)

/* ************************************************** ********* */ /* (c) 2003 Fluent Inc. */ /* Author: Andre Bakker. Last edit: Sep. 2, 2003 */ /* ************************************************** ********* */ /* These UDFs were developed by Bakker specifically to help */ /* with the modeling of solids suspensions in stirred vessels */ /* but can be used for other applications also. */ /* */ /* They can be distributed freely. */ /* */ /* These two UDFs set the drag coefficient to a user specified */ /* value and also fix the overall volume fraction of the */ /* granular phase to a user specified value. To function */ /* properly, the user should first read the SCHEME file */ /* "granular.scm" before reading case and data. This creates */ /* an input panel DEFINE | GRANULAR DRAG AND VOLUME FRACTION */ /* The user specifies the necessary inputs there. */ /* */ /* To use the drag UDF, select it under DEFINE | PHASES | */ /* INTERACTION | DRAG | USER DEFINED | custom_CD */ /* If the drag coefficient in the panel is set to <=0 */ /* this UDF will use the Schiller-Nauman drag law with the */ /* correction by Pinelli. Otherwise, the constant drag */ /* coefficient specified by the user in the input panel is */ /* used. That allows the user to finetune the drag coefficient */ /* for a given system. */ /* */ /* To fix the overall volume fraction select the UDF under */ /* DEFINE | USER DEFINED | FUNCTION HOOKS | ADJUST FUNCTION | */ /* fix_gran_vf. This is useful, for running certain multiphase */ /* simulations in steady state, e.g. batch stirred tanks */ /* with solids suspensions. This can cut CPU time by orders of */ /* magnitude compared to running transient. */ /* */ /* Obviously, the user can choose to only use the fix_gran_vf */ /* UDF without using the drag coefficient UDF (and just use */ /* Fluent's drag laws) and still gain the CPU time advantage. */ /* */ /* ************************************************** ********* */

/* ************************************************** ********* */ /* UDF for customizing the drag law in Fluent */ /* ************************************************** ********* */

DEFINE_EXCHANGE_PROPERTY(custom_CD, cell, mix_thread, s_col, f_col) {

Thread *thread_g, *thread_s; real cd = RP_Get_Real("granpar/cd"); real diam2 = RP_Get_Real("granpar/dp"); real rho_s = RP_Get_Real("granpar/rhos"); real rhol = RP_Get_Real("granpar/rhol"); real mul = RP_Get_Real("granpar/mul");

real x_vel_g, x_vel_s, y_vel_g, y_vel_s, abs_v, slip_x, slip_y,

reyp, void_g, fdrgs, taup, k_g_s,z_vel_g,z_vel_s,slip_z; real lkolm,pinelli;

/* 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); z_vel_g = C_W(cell, thread_g);

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

slip_x = x_vel_g - x_vel_s; slip_y = y_vel_g - y_vel_s; slip_z = z_vel_g - z_vel_s;

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

/*compute reynolds number*/ if (mul<1.0E-30) mul=0.001; reyp = rhol*abs_v*diam2/mul;

/* compute particle relaxation time */ taup = rho_s*diam2*diam2/18./mul;

/*================================================= =============*/ /* if cd<1E-30 then use Schiller-Nauman with Pinelli Correction */ /* first compute Schiller-Nauman drag coefficient */ if (cd<1.0E-30) {

if (reyp > 1000)

{

cd=0.44;

}

else

{

cd=24.0*(1.0+0.15*pow(reyp,0.687))/reyp;

}

/* now calculate pinelli correction to drag coefficient */

lkolm = pow(mul/rhol,3.0);

lkolm = pow(lkolm/C_D(cell,thread_g),0.25);

pinelli = 16.0*lkolm/diam2-1.0;

pinelli = (exp(pinelli)-exp(-pinelli))/(exp(pinelli)+exp(-pinelli)); /* calculate TANH */

pinelli = 0.4*pinelli+0.6;

cd=cd/pow(pinelli,2.0); } /*================================================= =============*/

void_g = C_VOF(cell, thread_g); /* get gas vol frac*/

/*compute drag and return drag coeff, k_g_s*/ if (reyp<0.001) reyp=0.001; fdrgs = cd*reyp/24;

k_g_s = (1.-void_g)*rho_s*fdrgs/taup;

return k_g_s; }

/* ************************************************** ********* */ /* UDF for fixing the volume fraction of the granular phase */ /* ************************************************** ********* */

DEFINE_ADJUST(fix_gran_vf, domain) { Thread *t; Thread **pt; int doprint = RP_Get_Integer("granpar/verbose"); int gphase = RP_Get_Integer("granpar/vftofix") - 1; real targetvf = RP_Get_Real("granpar/vftrgt"); real vof_max =

DOMAIN_PROP_CONSTANT(DOMAIN_SUB_DOMAIN(domain,gpha se),PROP_packing) - 1.e-3; real vof_max2 =

DOMAIN_PROP_CONSTANT(DOMAIN_SUB_DOMAIN(domain,gpha se),PROP_packing) - 1.e-2; real packvolume; real notpackvolume; real totvolume; real multiplier; real deltavof;

packvolume = 0.0; notpackvolume = 0.0; totvolume = 0.0;

/* loop over domain */ mp_thread_loop_c (t,domain,pt)

if (FLUID_THREAD_P(t))

{

cell_t c;

begin_c_loop_int (c,t)

{

real c_vol = C_VOLUME(c,t);

totvolume += c_vol;

if (C_VOF(c,pt[gphase]) > vof_max2)

{

packvolume += C_VOF(c,pt[gphase])*c_vol;

}

else

{

notpackvolume += C_VOF(c,pt[gphase])*c_vol;

}

}

end_c_loop_int (c,t)

} /*ensure all compute nodes have the same summation values for parallel calculations */ #if RP_NODE

totvolume=PRF_GRSUM1(totvolume);

packvolume=PRF_GRSUM1(packvolume);

notpackvolume=PRF_GRSUM1(notpackvolume); #endif /*end loop over domain */

/* execute rest only if totvolume>0, otherwise the */ /* routine was called from the compute host in parallel */

if (totvolume>0) {

multiplier=(targetvf*totvolume-packvolume)/notpackvolume; if (multiplier<1.0) multiplier=(targetvf*totvolume)/(packvolume+notpackvolume); if (doprint>0) {

Message ("mass correction factor = %8.6g\n",multiplier);

Message (""); }

if (multiplier<1.0) { mp_thread_loop_c (t,domain,pt)

if (FLUID_THREAD_P(t))

{

cell_t c;

begin_c_loop_int (c,t)

{

deltavof = C_VOF(c,pt[gphase]) * multiplier;

deltavof -= C_VOF(c,pt[gphase]);

C_VOF(c,pt[gphase]) += deltavof;

C_VOF(c,pt[0]) -= deltavof;

}

end_c_loop_int (c,t)

} } else { mp_thread_loop_c (t,domain,pt)

if (FLUID_THREAD_P(t))

{

cell_t c;

begin_c_loop_int (c,t)

{

if (C_VOF(c,pt[gphase]) < vof_max2)

{

deltavof = C_VOF(c,pt[gphase]) * multiplier;

if (deltavof > vof_max) deltavof=vof_max;

deltavof -= C_VOF(c,pt[gphase]);

C_VOF(c,pt[gphase]) += deltavof;

C_VOF(c,pt[0]) -= deltavof;

}

}

end_c_loop_int (c,t)

} } } }

/* ************************************************** *********** */ /* END OF UDF granular.c */ /* ************************************************** *********** */

/* ************************************************** *********** */ /* SCHEME FILE "granular.scm" below */ /* ************************************************** *********** */

(rpsetvar 'udf/adjust-fcn "fix_gran_vf") ;; ;; Create rpvars for the model if they don't ;; exist. ;; (if (not (rp-var-object 'granpar/VFTRGT))

(rp-var-define 'granpar/VFTRGT 0.000682 'real #f)) (if (not (rp-var-object 'granpar/VFTOFIX))

(rp-var-define 'granpar/VFTOFIX 2 'integer #f)) (if (not (rp-var-object 'granpar/VERBOSE))

(rp-var-define 'granpar/VERBOSE 0 'integer #f)) (if (not (rp-var-object 'granpar/CD))

(rp-var-define 'granpar/CD 5.1 'real #f)) (if (not (rp-var-object 'granpar/DP))

(rp-var-define 'granpar/DP 3.27e-4 'real #f)) (if (not (rp-var-object 'granpar/RHOS))

(rp-var-define 'granpar/RHOS 2450.0 'real #f)) (if (not (rp-var-object 'granpar/RHOL))

(rp-var-define 'granpar/RHOL 998.2 'real #f)) (if (not (rp-var-object 'granpar/MUL))

(rp-var-define 'granpar/MUL 0.001003 'real #f))

;; ;; Create a panel for the granular mass fix model. ;; (define gui-granpar (let ((panel #f)

(vftrgt)

(vftofix)

(verbose)

(cd)

(dp)

(rhos)

(rhol)

(mul))

(define (update-cb . args) ;update panel fields

(cx-set-real-entry vftrgt (rpgetvar 'granpar/VFTRGT))

(cx-set-integer-entry vftofix (rpgetvar 'granpar/VFTOFIX))

(cx-set-integer-entry verbose (rpgetvar 'granpar/VERBOSE))

(cx-set-real-entry cd (rpgetvar 'granpar/CD))

(cx-set-real-entry dp (rpgetvar 'granpar/DP))

(cx-set-real-entry rhos (rpgetvar 'granpar/RHOS))

(cx-set-real-entry rhol (rpgetvar 'granpar/RHOL))

(cx-set-real-entry mul (rpgetvar 'granpar/MUL)))

(define (apply-cb . args)

(rpsetvar 'granpar/VFTRGT (cx-show-real-entry vftrgt))

(rpsetvar 'granpar/VFTOFIX (cx-show-integer-entry vftofix))

(rpsetvar 'granpar/VERBOSE (cx-show-integer-entry verbose))

(rpsetvar 'granpar/CD (cx-show-real-entry cd))

(rpsetvar 'granpar/DP (cx-show-real-entry dp))

(rpsetvar 'granpar/RHOS (cx-show-real-entry rhos))

(rpsetvar 'granpar/RHOL (cx-show-real-entry rhol))

(rpsetvar 'granpar/MUL (cx-show-real-entry mul)))

(lambda args

(if (not panel)

(let ((table)

(form))

(set! panel (cx-create-panel "Granular Drag and Volume Fraction"

apply-cb update-cb))

(set! table (cx-create-table panel ""

'border #f

'visible-rows 9

'below 0

'right-of 0))

(set! vftrgt

(cx-create-real-entry table

"Fixed Overall Volume Fraction"

'width 10

'row 1 'col 0

'minimum 0

'maximum 1))

(set! vftofix

(cx-create-integer-entry table

"Granular Phase to Fix Volume Fraction"

'width 10

'row 2 'col 0

'minimum 2

'maximum 20))

(set! verbose

(cx-create-integer-entry table

"Print Correction Factor (0=off, 1=on)"

'width 10

'row 3 'col 0

'minimum 0

'maximum 1))

(set! cd

(cx-create-real-entry table

"Drag Coefficient"

'width 10

'row 4 'col 0

'minimum 0

'maximum 1000))

(set! dp

(cx-create-real-entry table

"Particle Diameter (m)"

'width 10

'row 5 'col 0

'minimum 0

'maximum 1.0))

(set! rhos

(cx-create-real-entry table

"Solids Density (kg/m3)"

'width 10

'row 6 'col 0

'minimum 0

'maximum 13000))

(set! rhol

(cx-create-real-entry table

"Liquid Density (kg/m3)"

'width 10

'row 7 'col 0

'minimum 0

'maximum 13000))

(set! mul

(cx-create-real-entry table

"Liquid Viscosity (Pa-s)"

'width 10

'row 8 'col 0

'minimum 0

'maximum 10000))

))

(cx-show-panel panel))))

(cx-add-item "Define" "Granular Drag and Volume Fraction" #\U #f cx-client? gui-granpar) /*************************************************/

Please note these points when using this UDF :

The original purpose of this UDF was to improve the modeling of solids suspensions in stirred vessels. The UDF has two parts:

(1) It allows the user to fix the overall volume fraction of a secondary phase in a domain. This allows the user then to run Eulerian multiphase calculations for batch stirred tanks in steady state with MRF, instead of having to run them transient. This cuts CPU time dramatically. (2) It allows the user to specify either a constant value for the drag coefficient or use the Pinelli drag law. This helps fine tune the results for given systems. These two components to the UDF can be used independently. The UDF comes with a SCHEME file granular.scm which is required for the UDF to function. The UDF is compiled.

have a nice weekend !

green iran and BlnPhoenix like this.
  Reply With Quote

Old   March 9, 2009, 14:57
Default Re: Drag coefficient, DPM.
  #7
Jorge poyatos
Guest
 
Posts: n/a
Thank you! very very much!

I have to make it works now!
  Reply With Quote

Old   March 9, 2009, 15:38
Default Re: Drag coefficient, DPM.
  #8
cfd_user
Guest
 
Posts: n/a
u r welcome
  Reply With Quote

Old   March 11, 2009, 14:27
Default Re: Drag coefficient, DPM.
  #9
Jorge poyatos
Guest
 
Posts: n/a
Hi! sorry again, but i am having some problems with the UDF, I am using it for discrete phase model so i changed some parameters. I can interpret it without problems but when i try to display the particles track i get the next error:

FLUENT received fatal signal (ACCESS VIOLATION) 1. Note exact evets leading to error 2. Save case/data under new name 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: ()

The UDF is as follows:

#include "udf.h"

#include "mem.h"

DEFINE_DPM_DRAG(particle_drag_force,Re,p)

{

cell_t c;

Thread *t;

real drag_force;

double cd,epsilon,lkolm,pinelli;

epsilon = C_D(c, t);

if (Re > 1000)

{

cd=0.44;

}

else

{cd=24*(1+0.15*pow(Re,0.687))/Re;

}

lkolm = pow(0.001003/998.2,3);

lkolm = pow(lkolm/epsilon,0.25);

pinelli = 16.0*lkolm/0.000421-1.0;

pinelli = (exp(pinelli)-exp(-pinelli))/(exp(pinelli)+exp(-pinelli)); /* calculate TANH */

pinelli = 0.4*pinelli+0.6;

cd=cd/pow(pinelli,2.0);

drag_force = 18*cd*Re/24 ;

return (drag_force);

}

I realized that when i change: epsilon = C_D(c, t); by: epsilon = 10000 or any constant value.

Everything goes right.

I don't know if you can help me? But thanks anyway.

ffsun likes this.
  Reply With Quote

Old   March 11, 2009, 15:28
Default Re: Drag coefficient, DPM.
  #10
cfd_user
Guest
 
Posts: n/a
I do not understand the use of C_D(c,t) in a DPM UDF. Pls chack that.
  Reply With Quote

Old   March 11, 2009, 18:07
Default Re: Drag coefficient, DPM.
  #11
jorge poyatos
Guest
 
Posts: n/a
I need to define the kolmogorov microscale for every cell in order to calculate the drag coefficient for every cell(every velocity), and to calculate the kolmogorov microscale i need the turbulent disipation rate (epsilon), so I try to use C_D(c,t) to get this value.
  Reply With Quote

Old   March 19, 2009, 22:14
Default
  #12
New Member
 
chengshaojie
Join Date: Mar 2009
Posts: 4
Rep Power: 17
chengshaojie is on a distinguished road
Quote:
Originally Posted by jorge poyatos
;157333
I need to define the kolmogorov microscale for every cell in order to calculate the drag coefficient for every cell(every velocity), and to calculate the kolmogorov microscale i need the turbulent disipation rate (epsilon), so I try to use C_D(c,t) to get this value.
hi, sir
as i know, ε is the average rate of energy dissipation per unit mass. pls look for http://en.wikipedia.org/wiki/Kolmogorov_microscales

Last edited by chengshaojie; March 25, 2009 at 01:53.
chengshaojie is offline   Reply With Quote

Old   March 24, 2009, 21:56
Default
  #13
New Member
 
chengshaojie
Join Date: Mar 2009
Posts: 4
Rep Power: 17
chengshaojie is on a distinguished road
dear sir ,
could someone send me the file at www.fluentusers.com/udf_archive/udf_examples/UDF52.htm please.
i cannot access to it, thank you.
my e-mail:chengshaojie9856@yahoo.cn
chengshaojie is offline   Reply With Quote

Old   January 7, 2012, 05:53
Default
  #14
New Member
 
green iran's Avatar
 
A_A
Join Date: Oct 2010
Posts: 10
Rep Power: 16
green iran is on a distinguished road
Hello guys
i need urgent help. actually i'm in need to this scheme and udf file for my solid-liquid simulation. i just copied and pasted them separately in a notepad as text.but when i launch FLUENT i received this message for scheme file:
unbound variable
Error Object: /*
i deleted /* in scm file but it didn't work. i still receive the same problem with another Error object for instance a name of variables.
i'm really stuck. i'll be very appreciate if you give me some comments.
appreciate in advance
green iran is offline   Reply With Quote

Old   January 20, 2012, 14:41
Default
  #15
Member
 
Join Date: Jun 2011
Posts: 86
Rep Power: 15
mali28 is on a distinguished road
Quote:
Originally Posted by chengshaojie View Post
dear sir ,
could someone send me the file at www.fluentusers.com/udf_archive/udf_examples/UDF52.htm please.
i cannot access to it, thank you.
my e-mail:chengshaojie9856@yahoo.cn
Am I too late?

This is UDF52.htm

#include "udf.h" #include "sg_mphase.h" #include "sg.h" #include <stdio.h> #define pi 4.*atan(1.) /* ************************************************** ********* */ /* (c) 2003 Fluent Inc. */ /* Author: Andre Bakker. Last edit: Sep. 2, 2003 */ /* ************************************************** ********* */ /* These UDFs were developed by Bakker specifically to help */ /* with the modeling of solids suspensions in stirred vessels */ /* but can be used for other applications also. */ /* */ /* They can be distributed freely. */ /* */ /* These two UDFs set the drag coefficient to a user specified */ /* value and also fix the overall volume fraction of the */ /* granular phase to a user specified value. To function */ /* properly, the user should first read the SCHEME file */ /* "granular.scm" before reading case and data. This creates */ /* an input panel DEFINE | GRANULAR DRAG AND VOLUME FRACTION */ /* The user specifies the necessary inputs there. */ /* */ /* To use the drag UDF, select it under DEFINE | PHASES | */ /* INTERACTION | DRAG | USER DEFINED | custom_CD */ /* If the drag coefficient in the panel is set to <=0 */ /* this UDF will use the Schiller-Nauman drag law with the */ /* correction by Pinelli. Otherwise, the constant drag */ /* coefficient specified by the user in the input panel is */ /* used. That allows the user to finetune the drag coefficient */ /* for a given system. */ /* */ /* To fix the overall volume fraction select the UDF under */ /* DEFINE | USER DEFINED | FUNCTION HOOKS | ADJUST FUNCTION | */ /* fix_gran_vf. This is useful, for running certain multiphase */ /* simulations in steady state, e.g. batch stirred tanks */ /* with solids suspensions. This can cut CPU time by orders of */ /* magnitude compared to running transient. */ /* */ /* Obviously, the user can choose to only use the fix_gran_vf */ /* UDF without using the drag coefficient UDF (and just use */ /* Fluent's drag laws) and still gain the CPU time advantage. */ /* */ /* ************************************************** ********* */ /* ************************************************** ********* */ /* UDF for customizing the drag law in Fluent */ /* ************************************************** ********* */ DEFINE_EXCHANGE_PROPERTY(custom_CD, cell, mix_thread, s_col, f_col) { Thread *thread_g, *thread_s; real cd = RP_Get_Real("granpar/cd"); real diam2 = RP_Get_Real("granpar/dp"); real rho_s = RP_Get_Real("granpar/rhos"); real rhol = RP_Get_Real("granpar/rhol"); real mul = RP_Get_Real("granpar/mul"); real x_vel_g, x_vel_s, y_vel_g, y_vel_s, abs_v, slip_x, slip_y, reyp, void_g, fdrgs, taup, k_g_s,z_vel_g,z_vel_s,slip_z; real lkolm,pinelli; /* 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); z_vel_g = C_W(cell, thread_g); x_vel_s = C_U(cell, thread_s); y_vel_s = C_V(cell, thread_s); z_vel_s = C_W(cell, thread_s); slip_x = x_vel_g - x_vel_s; slip_y = y_vel_g - y_vel_s; slip_z = z_vel_g - z_vel_s; /*compute slip*/ abs_v = sqrt(slip_x*slip_x + slip_y*slip_y + slip_z*slip_z); /*compute reynolds number*/ if (mul<1.0E-30) mul=0.001; reyp = rhol*abs_v*diam2/mul; /* compute particle relaxation time */ taup = rho_s*diam2*diam2/18./mul; /*================================================= =============*/ /* if cd<1E-30 then use Schiller-Nauman with Pinelli Correction */ /* first compute Schiller-Nauman drag coefficient */ if (cd<1.0E-30) { if (reyp > 1000) { cd=0.44; } else { cd=24.0*(1.0+0.15*pow(reyp,0.687))/reyp; } /* now calculate pinelli correction to drag coefficient */ lkolm = pow(mul/rhol,3.0); lkolm = pow(lkolm/C_D(cell,thread_g),0.25); pinelli = 16.0*lkolm/diam2-1.0; pinelli = (exp(pinelli)-exp(-pinelli))/(exp(pinelli)+exp(-pinelli)); /* calculate TANH */ pinelli = 0.4*pinelli+0.6; cd=cd/pow(pinelli,2.0); } /*================================================= =============*/ void_g = C_VOF(cell, thread_g); /* get gas vol frac*/ /*compute drag and return drag coeff, k_g_s*/ if (reyp<0.001) reyp=0.001; fdrgs = cd*reyp/24; k_g_s = (1.-void_g)*rho_s*fdrgs/taup; return k_g_s; } /* ************************************************** ********* */ /* UDF for fixing the volume fraction of the granular phase */ /* ************************************************** ********* */ DEFINE_ADJUST(fix_gran_vf, domain) { Thread *t; Thread **pt; int doprint = RP_Get_Integer("granpar/verbose"); int gphase = RP_Get_Integer("granpar/vftofix") - 1; real targetvf = RP_Get_Real("granpar/vftrgt"); real vof_max = DOMAIN_PROP_CONSTANT(DOMAIN_SUB_DOMAIN(domain,gpha se),PROP_packing) - 1.e-3; real vof_max2 = DOMAIN_PROP_CONSTANT(DOMAIN_SUB_DOMAIN(domain,gpha se),PROP_packing) - 1.e-2; real packvolume; real notpackvolume; real totvolume; real multiplier; real deltavof; packvolume = 0.0; notpackvolume = 0.0; totvolume = 0.0; /* loop over domain */ mp_thread_loop_c (t,domain,pt) if (FLUID_THREAD_P(t)) { cell_t c; begin_c_loop_int (c,t) { real c_vol = C_VOLUME(c,t); totvolume += c_vol; if (C_VOF(c,pt[gphase]) > vof_max2) { packvolume += C_VOF(c,pt[gphase])*c_vol; } else { notpackvolume += C_VOF(c,pt[gphase])*c_vol; } } end_c_loop_int (c,t) } /*ensure all compute nodes have the same summation values for parallel calculations */ #if RP_NODE totvolume=PRF_GRSUM1(totvolume); packvolume=PRF_GRSUM1(packvolume); notpackvolume=PRF_GRSUM1(notpackvolume); #endif /*end loop over domain */ /* execute rest only if totvolume>0, otherwise the */ /* routine was called from the compute host in parallel */ if (totvolume>0) { multiplier=(targetvf*totvolume-packvolume)/notpackvolume; if (multiplier<1.0) multiplier=(targetvf*totvolume)/(packvolume+notpackvolume); if (doprint>0) { Message ("mass correction factor = %8.6g\n",multiplier); Message (""); } if (multiplier<1.0) { mp_thread_loop_c (t,domain,pt) if (FLUID_THREAD_P(t)) { cell_t c; begin_c_loop_int (c,t) { deltavof = C_VOF(c,pt[gphase]) * multiplier; deltavof -= C_VOF(c,pt[gphase]); C_VOF(c,pt[gphase]) += deltavof; C_VOF(c,pt[0]) -= deltavof; } end_c_loop_int (c,t) } } else { mp_thread_loop_c (t,domain,pt) if (FLUID_THREAD_P(t)) { cell_t c; begin_c_loop_int (c,t) { if (C_VOF(c,pt[gphase]) < vof_max2) { deltavof = C_VOF(c,pt[gphase]) * multiplier; if (deltavof > vof_max) deltavof=vof_max; deltavof -= C_VOF(c,pt[gphase]); C_VOF(c,pt[gphase]) += deltavof; C_VOF(c,pt[0]) -= deltavof; } } end_c_loop_int (c,t) } } } } /* ************************************************** *********** */ /* END OF UDF granular.c */ /* ************************************************** *********** */ /* ************************************************** *********** */ /* SCHEME FILE "granular.scm" below */ /* ************************************************** *********** */ (rpsetvar 'udf/adjust-fcn "fix_gran_vf") ;; ;; Create rpvars for the model if they don't ;; exist. ;; (if (not (rp-var-object 'granpar/VFTRGT)) (rp-var-define 'granpar/VFTRGT 0.000682 'real #f)) (if (not (rp-var-object 'granpar/VFTOFIX)) (rp-var-define 'granpar/VFTOFIX 2 'integer #f)) (if (not (rp-var-object 'granpar/VERBOSE)) (rp-var-define 'granpar/VERBOSE 0 'integer #f)) (if (not (rp-var-object 'granpar/CD)) (rp-var-define 'granpar/CD 5.1 'real #f)) (if (not (rp-var-object 'granpar/DP)) (rp-var-define 'granpar/DP 3.27e-4 'real #f)) (if (not (rp-var-object 'granpar/RHOS)) (rp-var-define 'granpar/RHOS 2450.0 'real #f)) (if (not (rp-var-object 'granpar/RHOL)) (rp-var-define 'granpar/RHOL 998.2 'real #f)) (if (not (rp-var-object 'granpar/MUL)) (rp-var-define 'granpar/MUL 0.001003 'real #f)) ;; ;; Create a panel for the granular mass fix model. ;; (define gui-granpar (let ((panel #f) (vftrgt) (vftofix) (verbose) (cd) (dp) (rhos) (rhol) (mul)) (define (update-cb . args) ;update panel fields (cx-set-real-entry vftrgt (rpgetvar 'granpar/VFTRGT)) (cx-set-integer-entry vftofix (rpgetvar 'granpar/VFTOFIX)) (cx-set-integer-entry verbose (rpgetvar 'granpar/VERBOSE)) (cx-set-real-entry cd (rpgetvar 'granpar/CD)) (cx-set-real-entry dp (rpgetvar 'granpar/DP)) (cx-set-real-entry rhos (rpgetvar 'granpar/RHOS)) (cx-set-real-entry rhol (rpgetvar 'granpar/RHOL)) (cx-set-real-entry mul (rpgetvar 'granpar/MUL))) (define (apply-cb . args) (rpsetvar 'granpar/VFTRGT (cx-show-real-entry vftrgt)) (rpsetvar 'granpar/VFTOFIX (cx-show-integer-entry vftofix)) (rpsetvar 'granpar/VERBOSE (cx-show-integer-entry verbose)) (rpsetvar 'granpar/CD (cx-show-real-entry cd)) (rpsetvar 'granpar/DP (cx-show-real-entry dp)) (rpsetvar 'granpar/RHOS (cx-show-real-entry rhos)) (rpsetvar 'granpar/RHOL (cx-show-real-entry rhol)) (rpsetvar 'granpar/MUL (cx-show-real-entry mul))) (lambda args (if (not panel) (let ((table) (form)) (set! panel (cx-create-panel "Granular Drag and Volume Fraction" apply-cb update-cb)) (set! table (cx-create-table panel "" 'border #f 'visible-rows 9 'below 0 'right-of 0)) (set! vftrgt (cx-create-real-entry table "Fixed Overall Volume Fraction" 'width 10 'row 1 'col 0 'minimum 0 'maximum 1)) (set! vftofix (cx-create-integer-entry table "Granular Phase to Fix Volume Fraction" 'width 10 'row 2 'col 0 'minimum 2 'maximum 20)) (set! verbose (cx-create-integer-entry table "Print Correction Factor (0=off, 1=on)" 'width 10 'row 3 'col 0 'minimum 0 'maximum 1)) (set! cd (cx-create-real-entry table "Drag Coefficient" 'width 10 'row 4 'col 0 'minimum 0 'maximum 1000)) (set! dp (cx-create-real-entry table "Particle Diameter (m)" 'width 10 'row 5 'col 0 'minimum 0 'maximum 1.0)) (set! rhos (cx-create-real-entry table "Solids Density (kg/m3)" 'width 10 'row 6 'col 0 'minimum 0 'maximum 13000)) (set! rhol (cx-create-real-entry table "Liquid Density (kg/m3)" 'width 10 'row 7 'col 0 'minimum 0 'maximum 13000)) (set! mul (cx-create-real-entry table "Liquid Viscosity (Pa-s)" 'width 10 'row 8 'col 0 'minimum 0 'maximum 10000)) )) (cx-show-panel panel)))) (cx-add-item "Define" "Granular Drag and Volume Fraction" #\U #f cx-client? gui-granpar)
mali28 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
Fluent Good Lift coefficient BAD drag coefficient Rif Main CFD Forum 4 March 9, 2010 11:52
drag coefficient puneshwar verma FLUENT 2 February 28, 2007 01:04
drag coefficient valentina FLUENT 2 January 23, 2007 14:16
coefficient of drag C.Mohan FLUENT 1 January 8, 2007 14:00
about the drag coefficient maximus Main CFD Forum 7 April 18, 2005 20:00


All times are GMT -4. The time now is 19:40.