2.3.7.  DEFINE_DOM_SPECULAR_REFLECTIVITY

2.3.7.1. Description

You can use DEFINE_DOM_SPECULAR_REFLECTIVITY to modify the inter-facial reflectivity of specularly reflecting semi-transparent walls. You may want to do this if the reflectivity is dependent on other conditions that the standard boundary condition does not allow for (see Specular Semi-Transparent Walls of the Theory Guide for more information). During ANSYS Fluent execution, the same UDF is called for all the faces of the semi-transparent wall, for each of the directions.

2.3.7.2. Usage

DEFINE_DOM_SPECULAR_REFLECTIVITY (name, f, t, nband, n_a, n_b, ray_direction, en, internal_reflection, specular_reflectivity, specular_transmissivity)


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.

face_t f

Face index.

Thread *t

Pointer to face thread on which the specular reflectivity function is to be applied.

int nband

Band number (needed for non-gray discrete ordinates (DO) model).

real n_a

Refractive index of medium a.

real n_b

Refractive index of medium b.

real ray_direction

Direction vector () defined in Equation 5–77 in the Theory Guide.

real en

Interface normal vector () defined in Equation 5–77 in the Theory Guide.

int internal_reflection

Variable used to flag the code that total internal reflection has occurred.

real *specular_reflectivity

Specular reflectivity for the given direction .

real *specular_transmissivity

Specular transmissivity for the given direction .

Function returns

void

There are eleven arguments to DEFINE_DOM_SPECULAR_REFLECTIVITY: name, f, t, nband, n_a, n_b, ray_direction, en, internal_reflection, specular_reflectivity, and specular_transmissivity. You supply name, the name of the UDF. f, t, nband, n_a, n_b, ray_direction, en, internal_reflection, specular_reflectivity, and specular_transmissivity are variables that are passed by the ANSYS Fluent solver to your UDF.

2.3.7.3. Example

In the following UDF, named user_dom_spec_refl, specular reflectivity and transmissivity values are altered for a given ray direction at face f.


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


/* UDF to alter the specular reflectivity and transmissivity, at
  semi-transparent walls, along direction s at face f */
 
 #include "udf.h"
 
 DEFINE_DOM_SPECULAR_REFLECTIVITY(user_dom_spec_refl,f,t, nband,n_a,n_b,
 ray_direction,en,internal_reflection,specular_reflectivity,
 specular_transmissivity)
 {
   real angle, cos_theta;
   real PI = 3.141592;
   cos_theta = NV_DOT(ray_direction, en);
   angle = acos(cos_theta);
   if (angle > 0.785398  && angle < 1.047198)
      {
        *specular_reflectivity = 0.3;
        *specular_transmissivity = 0.7;
      }
 }

2.3.7.4. Hooking a Discrete Ordinates Model (DOM) Specular Reflectivity UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_DOM_SPECULAR_REFLECTIVITY is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name of the argument that you supplied as the first DEFINE macro argument (for example, user_dom_spec_refl) will become visible and selectable in the User-Defined Function Hooks dialog box in ANSYS Fluent.

See Hooking DEFINE_DOM_SPECULAR_REFLECTIVITY UDFs for details.


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