2.4.7.  DEFINE_VECTOR_EXCHANGE_PROPERTY

2.4.7.1. Description

You can use DEFINE_VECTOR_EXCHANGE_PROPERTY to specify custom slip velocities for the multiphase Mixture model or custom turbulent dispersion forces for the multiphase Eulerian model.

2.4.7.2. Usage

DEFINE_VECTOR_EXCHANGE_PROPERTY (name, c, mixture_thread, second_column_phase_index, first_column_phase_index, vector_result)


Important:  Note that all of the arguments to a DEFINE macro need to 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 cell thread of mixture domain.

int second_column_phase_index

Index of second phase in phase interaction.

int first_column_phase_index

Index of first phase in phase interaction.

real *vector_result

Pointer to slip velocity vector.

Function returns

real

There are six arguments to DEFINE_VECTOR_EXCHANGE_PROPERTY: name, c, mixture_thread, second_column_phase_index, first_column_phase_index, and vector_result. You supply name, the name of the UDF. c, mixture_thread, second_column_phase_index, first_column_phase_index, and vector_result are variables that are passed by the ANSYS Fluent solver to your UDF. Your UDF will need to set the values referenced by the real pointer to the slip velocity vector (vector_result) to the components of the slip velocity vector (for example, vector_result[0], vector_result[1] for a 2D problem).

2.4.7.3. Example 1 — Custom Slip Velocity

The following UDF, named custom_slip, specifies a custom slip velocity in a two-phase mixture problem.


Important:  Note that in the example that follows, the DEFINE_VECTOR_EXCHANGE_PROPERTY statement is broken up into two lines for the sake of readability. In your source file, you must make sure that the DEFINE statement is on one line only.


/***************************************************************
   UDF for a defining a custom slip velocity in a 2-phase
   mixture problem
 ****************************************************************/
 
 #include "udf.h"
 
 DEFINE_VECTOR_EXCHANGE_PROPERTY(custom_slip,c,mixture_thread,
 second_column_phase_index,first_column_phase_index,vector_result)
 {
   real grav[2] = {0., -9.81};
   real K = 5.e4;

   real pgrad_x, pgrad_y;

   Thread *pt, *st;/* thread pointers for primary and secondary phases*/

   pt = THREAD_SUB_THREAD(mixture_thread, second_column_phase_index);
   st = THREAD_SUB_THREAD(mixture_thread, first_column_phase_index);

   /* at this point the phase threads are known for primary (0) and
   secondary(1) phases */

   pgrad_x = C_DP(c,mixture_thread)[0];
   pgrad_y = C_DP(c,mixture_thread)[1];

   vector_result[0] =
     -(pgrad_x/K)
     +(((C_R(c, st)-
     C_R(c, pt))/K)*
     grav[0]);

   vector_result[1] =
     -(pgrad_y/K) +(((C_R(c, st)-
     C_R(c, pt))/K)*
     grav[1]);
 }

Important:  Note that the pressure gradient macro C_DP is now obsolete. A more current pressure gradient macro can be found in Table 3.4: Macro for Cell Volume Defined in mem.h .


2.4.7.4. Example 2 — Custom Turbulent Dispersion

The following UDF, named custom_td, specifies a custom turbulent dispersion force in a two-phase mixture problem.

/* this example uses DEFINE_VECTOR_EXCHANGE_PROPERTY to implement the lopez-de-bertodano model  */
#include "udf.h"

DEFINE_VECTOR_EXCHANGE_PROPERTY(custom_td, c, t, i, j, val)
{
  /* i -- liquid-phase; j -- vapor-phase */

  Thread **pt = THREAD_SUB_THREADS(t);
  Thread *ti = pt[i];
  Thread *tj = pt[j];
  real term;
  real rho_P = C_R(c,ti);
  real turb_k = (mp_ke_type==TURB_MP_KE_MIXTURE ||   
                mp_rsm_type==TURB_MP_RSM_MIXTURE)?
                C_K(c,t) : C_K(c,pt[P_PHASE]);

  term = -rho_P*turb_k;
  term *= C_VOLUME(c,t);

  NV_VS(val, =, C_VOF_G(c,tj),*,term);

  if(NNULLP(THREAD_STORAGE(tj,SV_MP_DRIFT_S_P_COEFF)))
    P_DRIFT_COEFF(c,tj) = 0.0;

  if(NNULLP(THREAD_STORAGE(tj,SV_MP_DRIFT_COEFF)))
    S_DRIFT_COEFF(c,tj) = term;
}

2.4.7.5. Hooking a Vector Exchange Property UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_VECTOR_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, custom_slip) will become visible and selectable in the Phase Interaction dialog box in ANSYS Fluent. See Hooking DEFINE_VECTOR_EXCHANGE_PROPERTY UDFs for details.


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