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

2.5.2 DEFINE_DPM_BODY_FORCE



Description


You can use DEFINE_DPM_BODY_FORCE to specify a body force other than a gravitational or drag force on the particles.



Usage



DEFINE_DPM_BODY_FORCE( name, p, i)


Argument Type Description
symbol name UDF name.
Tracked_Particle *p Pointer to the Tracked_Particle data structure which
  contains data related to the particle being tracked.
int i An index ( 0, 1, or 2) that identifies the Cartesian
  component of the body force that is to be returned by the
  function.
   
Function returns  
real  
   

There are three arguments to DEFINE_DPM_BODY_FORCE: name, p, and i. You supply name, the name of the UDF. p and i are variables that are passed by the ANSYS FLUENT solver to your UDF. Your UDF will need to return the real value of the acceleration due to the body force (in m/s $^2$) to the ANSYS FLUENT solver.

figure   

Pointer p can be used as an argument to the macros defined in Section  3.2.7 to obtain information about particle properties (e.g., injection properties).



Example


The following UDF, named particle_body_force, computes the magnetic force on a charged particle. DEFINE_DPM_BODY_FORCE is called at every particle time step in ANSYS FLUENT and requires a significant amount of CPU time to execute. For this reason, the UDF should be executed as a compiled UDF.

In the UDF presented below a charged particle is introduced upstream, into a laminar flow, and travels downstream until $t$= tstart when a magnetic field is applied. The particle takes on an approximately circular path (not an exact circular path, because the speed and magnetic force vary as the particle is slowed by the surrounding fluid).

The macro P_TIME(p) gives the current time for a particle traveling along a trajectory, which is pointed to by p.

/* UDF for computing the magnetic force on a charged particle */

#include "udf.h"

#define Q 1.0         /* particle electric charge      */
#define BZ 3.0        /* z component of magnetic field */
#define TSTART 18.0   /* field applied at t = tstart   */ 

/* Calculate magnetic force on charged particle.  Magnetic   */
/* force is particle charge times cross product of particle  */
/* velocity with magnetic field: Fx= q*bz*Vy,  Fy= -q*bz*Vx  */

DEFINE_DPM_BODY_FORCE(particle_body_force,p,i)
{
        real bforce=0;
        if(P_TIME(p)>=TSTART)
          {
           if(i==0) bforce=Q*BZ*P_VEL(p)[1];      

           else if(i==1) bforce=-Q*BZ*P_VEL(p)[0];

          }
        else
           bforce=0.0;
        /* an acceleration should be returned */
        return (bforce/P_MASS(p)); 
}



Hooking a DPM Body Force UDF to ANSYS FLUENT


After the UDF that you have defined using DEFINE_DPM_BODY_FORCE 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.2 for details on how to hook your DEFINE_DPM_BODY_FORCE UDF to ANSYS FLUENT.


next up previous contents index Previous: 2.5.1 DEFINE_DPM_BC
Up: 2.5 Discrete Phase Model
Next: 2.5.3 DEFINE_DPM_DRAG
Release 12.0 © ANSYS, Inc. 2009-01-14