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.
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 |
|---|---|
|
|
UDF name. |
|
|
Face index. |
|
|
Pointer to face thread on which the specular reflectivity function is to be applied. |
|
|
Band number (needed for non-gray discrete ordinates (DO) model). |
|
|
Refractive index of medium a. |
|
|
Refractive index of medium b. |
|
|
Direction vector ( |
|
|
Interface normal vector
( |
|
|
Variable used to flag the code that total internal reflection has occurred. |
|
|
Specular reflectivity for
the given direction |
|
|
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.
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;
}
}
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.