2.3.29.  DEFINE_SCAT_PHASE_FUNC

2.3.29.1. Description

You can use DEFINE_SCAT_PHASE_FUNC to specify the radiation scattering phase function for the discrete ordinates (DO) model. The function computes two values: the fraction of radiation energy scattered from direction to direction , and the forward scattering factor.

2.3.29.2. Usage

DEFINE_SCAT_PHASE_FUNC (name, cosine, f)

Argument Type

Description

symbol name

UDF name.

real cosine

Cosine of the angle between directions and .

real *f

Pointer to the location in memory where the real forward scattering factor is stored.

Function returns

real

There are three arguments to DEFINE_SCAT_PHASE_FUNC: name, cosine, and f. You supply name, the name of the UDF. cosine and f are variables that are passed by the ANSYS Fluent solver to your UDF. Your UDF will need to compute the real fraction of radiation energy scattered from direction to direction and return it to the solver. Note that the solver computes and stores a scattering matrix for each material by calling this function for each unique pair of discrete ordinates.

2.3.29.3. Example

In the following example, a number of UDFs are concatenated in a single C source file. These UDFs implement backward and forward scattering phase functions that are cited by Jendoubi et al. [5]. The source code can be interpreted or compiled in ANSYS Fluent.

/*******************************************************************
   UDFs that implement backward and forward scattering
   phase functions as cited by Jendoubi et al.
 ********************************************************************/
 
 #include "udf.h"
 
 DEFINE_SCAT_PHASE_FUNC(ScatPhiB2,c,fsf)
 {
    real phi=0;
    *fsf = 0;
    phi = 1.0 - 1.2*c + 0.25*(3*c*c-1);
    return (phi);
 }
 
 DEFINE_SCAT_PHASE_FUNC(ScatPhiB1,c,fsf)
 {
    real phi=0;
    *fsf = 0;
    phi = 1.0 - 0.56524*c + 0.29783*0.5*(3*c*c-1) +
      0.08571*0.5*(5*c*c*c-3*c) + 0.01003/8*(35*c*c*c*c-30*c*c+3) +
      0.00063/8*(63*c*c*c*c*c-70*c*c*c+15*c);
    return (phi);
 }
 
 DEFINE_SCAT_PHASE_FUNC(ScatPhiF3,c,fsf)
 {
    real phi=0;
    *fsf = 0;
    phi = 1.0 + 1.2*c + 0.25*(3*c*c-1);
    return (phi);
 }
 
 DEFINE_SCAT_PHASE_FUNC(ScatPhiF2,c,fsf) {
    real phi=0;
    real coeffs[9]={1,2.00917,1.56339,0.67407,0.22215,0.04725,
          0.00671,0.00068,0.00005};
    real P[9];
    int i;
    *fsf = 0;
    P[0] = 1;
    P[1] = c;
    phi = P[0]*coeffs[0] + P[1]*coeffs[1];
    for(i=1;i<7;i++)
    {
       P[i+1] = 1/(i+1.0)*((2*i+1)*c*P[i] - i*P[i-1]);
       phi += coeffs[i+1]*P[i+1];
    }
    return (phi);
 }
 
 DEFINE_SCAT_PHASE_FUNC(ScatIso,c,fsf)
 {
    *fsf=0;
    return (1.0);
 } 

2.3.29.4. Hooking a Scattering Phase UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_SCAT_PHASE_FUNCTION is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name that you specified in the DEFINE macro argument (for example, ScatPhiB) will become visible and selectable in the Create/Edit Materials dialog box in ANSYS Fluent. See Hooking DEFINE_SCAT_PHASE_FUNC UDFs for details.


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