[ANSYS, Inc. Logo] return to home search
next up previous contents index

2.4.2 DEFINE_EXCHANGE_PROPERTY



Description


You can use DEFINE_EXCHANGE_PROPERTY to specify UDFs for some phase interaction variables in multiphase models. These include net heat transfer rates between phases, and drag and lift coefficient functions. Below is a list of user-defined functions that can be specified using DEFINE_EXCHANGE_PROPERTY for the multiphase models in ANSYS FLUENT. Note that there are some phase interaction variables such as vaporization pressure and surface tension coefficient (cavitation parameters) that are defined using DEFINE_PROPERTY. See Section  2.3.16 for details.


Table 2.4.2: DEFINE_EXCHANGE_PROPERTY Variables
Mixture Model Eulerian Model

drag exchange coefficient
net heat transfer rate
drag coefficient
lift coefficient



Usage



DEFINE_EXCHANGE_PROPERTY( name, c, mixture_thread, second_column_phase_index,
first_column_phase_index)

figure   

Note that all of the arguments to a DEFINE macro must be placed on the same line in your source code. Splitting the DEFINE statement onto several lines will result in a compilation error.


Argument Type Description
symbol name UDF name.
cell_t c Cell index.
Thread *mixture_thread Pointer to the mixture-level thread.
int second_column_phase_index Identifier that corresponds to the pair of
  phases in your multiphase flow that you are
  specifying a slip velocity for. The identifiers
  correspond to the phases you select in the
  Phase Interaction dialog box in the graphical user
  interface. An index of 0 corresponds to the
  primary phase, and is incremented by one for
  each secondary phase.
int first_column_phase_index See int second_column_phase_index.
   
Function returns  
real  
   

There are five arguments to DEFINE_EXCHANGE_PROPERTY: name, c, mixture_thread, second_column_phase_index, and first_column_phase_index. You supply name, the name of the UDF. c, mixture_thread, second_column_phase_index, and first_column_phase_index are variables that are passed by the ANSYS FLUENT solver to your UDF. Your UDF will need to return the real value of the lift coefficient, drag exchange coefficient, heat or mass transfer to the solver.



Example 1 - Custom Drag Law


The following UDF, named custom_drag, can be used to customize the default Syamlal drag law in ANSYS FLUENT. The default drag law uses 0.8 (for void $<=$0.85) and 2.65 (void $>$0.85) for bfac. This results in a minimum fluid velocity of 25 cm/s. The UDF modifies the drag law to result in a minimum fluid velocity of 8 cm/s, using 0.28 and 9.07 for the bfac parameters.

/******************************************************************
   UDF for customizing the default Syamlal drag law in ANSYS 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;
}



Example 2 - Heat Transfer


The following UDF, named heat_udf, specifies a coefficient that when multiplied by the temperature difference between the dispersed and continuous phases, is equal to the net rate of heat transfer per unit volume.

#include "udf.h"

#define PR_NUMBER(cp,mu,k) ((cp)*(mu)/(k))
#define IP_HEAT_COEFF(vof,k,nu,d) ((vof)*6.*(k)*(Nu)/(d)/(d))

static real
heat_ranz_marshall(cell_t c, Thread *ti, Thread *tj)
{
 real h;
 real d = C_PHASE_DIAMETER(c,tj);
 real k = C_K_L(c,ti);
 real NV_VEC(v), vel, Re, Pr, Nu;

 NV_DD(v,=,C_U(c,tj),C_V(c,tj),C_W(c,tj),-,C_U(c,ti),C_V(c,ti),C_W(c,ti));
 vel = NV_MAG(v);

 Re = RE_NUMBER(C_R(c,ti),vel,d,C_MU_L(c,ti));
 Pr = PR_NUMBER (C_CP(c,ti),C_MU_L(c,ti),k);
 Nu = 2. + 0.6*sqrt(Re)*pow(Pr,1./3.);

 h = IP_HEAT_COEFF(C_VOF(c,tj),k,Nu,d);
return h;
}

DEFINE_EXCHANGE_PROPERTY(heat_udf, c, t, i, j)
{
  Thread *ti = THREAD_SUB_THREAD(t,i);
  Thread *tj = THREAD_SUB_THREAD(t,j);
  real val;

  val = heat_ranz_marshall(c,ti, tj);
  return val;
}



Hooking an Exchange Property UDF to ANSYS FLUENT


After the UDF that you have defined using DEFINE_EXCHANGE_PROPERTY is interpreted (Chapter  4) or compiled (Chapter  5), the name of the argument that you supplied as the first DEFINE macro argument (e.g., heat_udf) will become visible and selectable in the Phase Interaction dialog box in ANSYS FLUENT. See Section  6.3.2 for details.


next up previous contents index Previous: 2.4.1 DEFINE_CAVITATION_RATE
Up: 2.4 Multiphase DEFINE Macros
Next: 2.4.3 DEFINE_HET_RXN_RATE
Release 12.0 © ANSYS, Inc. 2009-01-14