2.4.3.  DEFINE_EXCHANGE_PROPERTY

2.4.3.1. Description

You can use DEFINE_EXCHANGE_PROPERTY to specify UDFs for some phase interaction variables in multiphase models. These include net heat transfer rate between phases, virtual mass coefficient, drag exchange coefficient, lift coefficient, wall lubrication coefficient, and interfacial area (for the Eulerian multiphase boiling model). Drag exchange coefficient may also be specified for the Mixture model. 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 DEFINE_PROPERTY UDFs for details.

Table 2.9:   DEFINE_EXCHANGE_PROPERTY Variables

Mixture Model

Eulerian Model

drag exchange coefficient

drag modification factor, in Equation 17–251 of the Theory Guide

volumetric heat transfer coefficient, in Equation 17–327 of the Theory Guide

virtual mass coefficient, in Equation 17–288 in the Fluent Theory Guide

drag exchange coefficient, in Equation 17–179 of the Theory Guide

drag modification factor, in Equation 17–251 of the Theory Guide

lift coefficient, in Equation 17–255 of the Theory Guide

wall lubrication coefficient, in Equation 17–268 of the Theory Guide

interfacial area, in Interfacial Area Concentration in the Theory Guide

model coefficients for wall lubrication, turbulent dispersion, and turbulence interaction models.


2.4.3.2. Usage

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


Important:  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 volumetric heat transfer coefficient, virtual mass coefficient, lift coefficient, drag exchange coefficient, wall lubrication coefficient, or interfacial area to the solver.


Note:  Your UDF should return the effective coefficient. So, if the quantity being modeled by your UDF depends on the interfacial area, your UDF should return the coefficient multiplied by the interfacial area.


2.4.3.3. 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 Reynolds 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;
 } 

2.4.3.4. Example 2 - Custom Lift Law

The following UDF, named custom_lift, computes the coefficient for the lift force using a formulation developed by Tomiyama in 2002:

/* this example uses "user-defined" to implement a lift model by Tomiyama et al in 2002  */
#include "udf.h"
#include "flow.h"
#define Eo_l1 4.0   
#define Eo_l2 10.0

DEFINE_EXCHANGE_PROPERTY(custom_lift,c,t,i,j)
{
/* i -- liquid-phase; j -- vapor-phase */
  Thread **pt = THREAD_SUB_THREADS(t);

  real v_x=0., v_y=0., v_z=0.;
  real vel, Rev, Eo, d2, T_sfc, sigma;
  real lift_coeff, lift_co, wk_co;;

  real diam = C_PHASE_DIAMETER(c,pt[j]);
  real rho_v = C_R(c,pt[j]);
  real rho_l = C_R(c,pt[i]);
  real mu_l  = C_MU_L(c,pt[i]);
  real gravity = NV_MAG(M_gravity);

  Property *prop =    
  DOMAIN_COMPLEX_PROP_PROPERTY(DOMAIN_INTERACTION(root_domain),
                                                COMPLEX_PROP_sfc_tension_coeff,
                                                i,j);
  T_sfc = (sg_temperature && NNULLP(THREAD_STORAGE(pt[i],SV_T)))? C_T(c,pt[i]) :  T_REF;
  if(prop == NULL || PROPERTY_METHOD(prop,0) == PROP_METHOD_NONE)
     Error("Lift-Tomiyama: Please set value for surface tension !");
  sigma = generic_property(c,t,prop,(Property_ID)0,T_sfc);
  if(sigma <= 0.) Error("Lift-Tomiyama: Please set nonzero value for surface tension !");

/*   calculate bubble Reynolds Number */
  v_x = C_U(c,pt[j]) - C_U(c,pt[i]);
  v_y = C_V(c,pt[j]) - C_V(c,pt[i]);
#if RP_3D
  v_z = C_W(c,pt[j]) - C_W(c,pt[i]);
#endif
  vel = sqrt(v_x*v_x + v_y*v_y + v_z*v_z);
  Rev =  RE_NUMBER(rho_l,vel,diam,mu_l);

  d2 = diam*diam;
  Eo = gravity*(rho_l-rho_v)*d2/sigma;

  if (Eo <= Eo_l1)
     wk_co = 0.0;
  else if (Eo < Eo_l2)
     wk_co = -0.096*Eo + 0.384;
  else
     wk_co = -0.576;

  lift_co = 0.288*tanh(0.121*Rev);

  lift_coeff = lift_co + wk_co;

  return lift_coeff;
}

2.4.3.5. Example 3- 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;
 } 

2.4.3.6. Example 4- Custom Interfacial Area

The following UDF named custom_ia, computes the interfacial area, while including the symmetric model.

#include "udf.h"

DEFINE_EXCHANGE_PROPERTY(custom_ia,c,t,i,j)
{
/* i -- liquid-phase; j -- vapor-phase */
  Thread **pt = THREAD_SUB_THREADS(t);
  real diam = C_PHASE_DIAMETER(c, pt[j]);
  real vof_i = C_VOF(c,pt[i]);
  real vof_j = C_VOF(c,pt[j]);

  real area_intf;

  area_intf = 6.*vof_i*vof_j/diam;

  return area_intf;
}

2.4.3.7. Hooking an Exchange Property UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_EXCHANGE_PROPERTY is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name of the argument that you supplied as the first DEFINE macro argument (for example, heat_udf) will become visible and selectable in the Phase Interaction dialog box in ANSYS Fluent. See Hooking DEFINE_EXCHANGE_PROPERTY UDFs for details.


Release 18.2 - © ANSYS, Inc. All rights reserved.