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

2.5.12 DEFINE_DPM_SPRAY_COLLIDE



Description


You can use DEFINE_DPM_SPRAY_COLLIDE to side-step the default ANSYS FLUENT spray collision algorithm. When droplets collide they may bounce (in which case their velocity changes) or they may coalesce (in which case their velocity is changed, as well as their diameter and number in the DPM parcel). A spray collide UDF is called during droplet tracking after every droplet time step and requires that Droplet Collision is enabled in the Discrete Phase Model dialog box.



Usage



DEFINE_DPM_SPRAY_COLLIDE( name, tp, p)


Argument Type Description
symbol name UDF name.
Tracked_Particle *tp Pointer to the Tracked_Particle data structure which
  contains data related to the particle being tracked.
Particle *p Pointer to the Particle data structure where particles p
  are stored in a linked list.
   
Function returns  
void  
   

There are three arguments to DEFINE_DPM_SPRAY_COLLIDE: name, tp, and p. You supply name, the name of the UDF. tp and p are variables that are passed by the ANSYS FLUENT solver to your UDF. When collision is enabled, this linked list is ordered by the cell that the particle is currently in. As particles from this linked list are tracked, they are copied from the particle list into a Tracked_Particle structure.



Example


The following UDF, named mean_spray_collide, is a simple (and non-physical) example that demonstrates the usage of DEFINE_SPRAY_COLLIDE. The droplet diameters are assumed to relax to their initial diameter over a specified time t_relax. The droplet velocity is also assumed to relax to the mean velocity of all droplets in the cell over the same time scale.

/***********************************************************
   DPM Spray Collide Example UDF 
************************************************************/
#include "udf.h"
#include "dpm.h"
#include "surf.h"
DEFINE_DPM_SPRAY_COLLIDE(mean_spray_collide,tp,p)
{
  /* non-physical collision UDF that relaxes the particle */
  /* velocity and diameter in a cell to the mean over the */
  /* specified time scale t_relax */

  const real t_relax = 0.001; /* seconds */

  /* get the cell and Thread that the particle is currently in */
  cell_t c  = P_CELL(tp);
  Thread *t = P_CELL_THREAD(tp);

  /* Particle index for looping over all particles in the cell */
  Particle *pi;

  /* loop over all particles in the cell to find their mass */
  /* weighted mean velocity and diameter */
  int i;
  real u_mean[3]={0.}, mass_mean=0.;
  real d_orig = P_DIAM(tp);
  real decay = 1. - exp(-t_relax);
  begin_particle_cell_loop(pi,c,t)
    {
      mass_mean += P_MASS(pi);
      for(i=0;i<3;i++)
        u_mean[i] += P_VEL(pi)[i]*P_MASS(pi);
    }
  end_particle_cell_loop(pi,c,t)

  /* relax particle velocity to the mean and diameter to the */
  /* initial diameter over the relaxation time scale t_relax */
  if( mass_mean > 0. )
    {
      for(i=0;i<3;i++)
        u_mean[i] /= mass_mean;
      for(i=0;i<3;i++)
        P_VEL(tp)[i] += decay*( u_mean[i] - P_VEL(tp)[i] );
      P_DIAM(tp) += decay*( P_INIT_DIAM(tp) - P_DIAM(tp) );
      /* adjust the number in the droplet parcel to conserve mass */
      P_N(tp) *= CUB( d_orig/P_DIAM(tp) );
    }
}



Hooking a DPM Spray Collide UDF to ANSYS FLUENT


After the UDF that you have defined using DEFINE_DPM_SPRAY_COLLIDE is interpreted (Chapter  4) or compiled (Chapter  5), the name of the argument that you supplied as the first DEFINE macro argument will become visible in the Discrete Phase Model dialog box in ANSYS FLUENT.

See Section  6.4.12 for details on how to hook your DEFINE_DPM_SPRAY_COLLIDE UDF to ANSYS FLUENT.


next up previous contents index Previous: 2.5.11 DEFINE_DPM_SOURCE
Up: 2.5 Discrete Phase Model
Next: 2.5.13 DEFINE_DPM_SWITCH
Release 12.0 © ANSYS, Inc. 2009-01-14