Open access peer-reviewed chapter - ONLINE FIRST

Radiative Transference Equation Algorithm as an ANSYS® User-Defined Function for Solar Technology Applications

By Diana Barraza-Jiménez, Adolfo Ruiz-Soto, Sandra Iliana Torres-Herrera, Elva Marcela Coria-Quiñones, Raúl Armando Olvera-Corral, David José Romero-Soto and Manuel Alberto Flores-Hidalgo

Submitted: April 12th 2019Reviewed: July 23rd 2019Published: August 27th 2019

DOI: 10.5772/intechopen.88767

Downloaded: 52

Abstract

Heat effects in photocatalytic reactor applications are discussed and a case study is analyzed where sunlight is used to activate a chemical reaction to degrade water pollutants. Heat is produced in the light-capturing process, and heat effects need to be better understood during the device design process. Radiative transfer equation (RTE) is the guiding equation used to calculate radiation proliferation in participating media, and it is used to describe the balance of radiative energy transport in the participating media including the interactions caused by different processes such as absorption, scattering, and emission, which also are subject to additional phenomena like weakening and magnification. This equation plays an important role in the design process since it may be included in the simulation process to represent the sunlight heat effects in the different photocatalytic reactor components. In this chapter, it is explained how to build a simplified algorithm to incorporate the RTE in a numerical calculation during the design of a photocatalytic reactor using the commercial software ANSYS®. In addition, simplifications are explained that enable the program to coordinate some coefficients such as absorption and dispersion so their effects are included within the numerical calculation. A user-defined function is presented in the end of the chapter as a usable algorithm in ANSYS® program with acceptable results for photocatalytic reactors.

Keywords

  • radiative transfer equation
  • light source energy
  • radiation energy
  • ANSYS®
  • photocatalysis

1. Introduction

Solar technology includes a wide variety of developments in environmental applications that include photovoltaic cells and photocatalytic devices, among others. Sunlight produces heat that affects the devices, components, and different processes that are carried on. The main interest in this proposal is approach heat effects in photocatalytic reactor applications where sunlight is used to activate a chemical reaction to degrade water pollutants. Heat is produced in the light-capturing process, and heat effects need to be better understood during the device design process [1, 2].

Radiative transfer equation (RTE) is the guiding equation used to calculate radiation proliferation in participating media, and it is used to describe the balance of radiative energy transport in the participating media including the interactions caused by different processes such as absorption, scattering, and emission which also are subject to additional phenomena like weakening and magnification [3, 4]. This equation plays an important role in the design process since it may be included in the simulation process to represent the sunlight heat effects in the different photocatalytic reactor components. In this chapter, it is explained how to build a simplified algorithm to incorporate the RTE in a numerical calculation during the design of a photocatalytic reactor using the commercial software ANSYS Fluent® [5]. This represents a numerical solution of one of the possible presentations of the RTE that can be easily programmed and incorporated in extensive calculations. In addition, simplifications are explained which enable the program to coordinate some coefficients such as absorption and dispersion so their effects are included within the numerical calculation. A user-defined function is presented in this chapter as a usable algorithm in ANSYS® program with acceptable results for photocatalytic reactors.

Simplifications have been done in order to focus on reaching the main goal of this chapter which is study the requirements to have a programmed UDF that resolves the radiation transfer energy equation. It is difficult to find out a generalized program so this chapter will assume the mathematical model applies for a photocatalytic reactor with a light source so the light energy is transferred into the system of study. There might be a transparent wall that the light needs to go through as well as water or polluted water as the fluid media. Above all, the goal is simplifying as much as possible the mathematical model and developments within the chapter in order to focus in an analysis on how to program RTE equation.

The program will be written similarly compared to C language, but the language is considered a property of ANSYS® but more specifically in ANSYS Fluent®. That means the programming language is its own language for ANSYS Fluent®, but it follows a syntaxis and structure very similar to C language. It is highly recommended to have C language programming skills and ANSYS Fluent® user-defined functions training. These skills may be achieved after one is an advanced user in ANSYS Fluent® so the programming can be coupled with CFD calculations and then the problem at hand with hydrodynamics numerical results will be complemented with light source effects, which at the end is the main purpose of this chapter.

2. Radiative energy basic concept

As we shall see, radiative heat transfer rates are generally proportional to differences in temperature to the fourth (or higher) power, i.e.,

E1

Then, if temperature rises, radiative heat transfer relevance grows and may become the dominant factor over conduction and convection phenomena at very high temperatures. In this way, one may understand thermal radiation is a meaningful factor in combustion applications (fires, furnaces, rocket nozzles, engines, and others) and in nuclear reactions (such as in a fusion reactor or in nuclear bombs), during atmospheric reentry of space vehicles, among others. Since contemporary technology’s main goal is an increased efficiency, it is expected temperature will increase accordingly, and this situation will reflect in making thermal radiation even more important. In addition, emergent applications gaining importance are solar energy and greenhouse effect (both as a result of our sun’s heating effects). Derived from the previous effects, one of the human kind problems in these days is global warming which is provoked by solar energy absorption mainly by carbon dioxide released into our atmosphere primarily by fuel burning technological devices created by men.

In the same way that factors such as vacuum and high temperature become more important for thermal radiation effects, also the analysis methodology to study thermal radiation becomes more complicated or at least requires to involve additional aspects if compared to analyses in normal conditions. One can say, in general, thermal radiation is a comprehensive matter to analyze. The average distance traveled by a photon previously to interact with a molecule is also known as the photon mean free path may be as short as 10−10 m (absorption process) but may be very long in the possible maximum distance reaching up to 10+10 m or even more (e.g., sunlight over the Earth’s surface). Then, it is natural to conclude conservation of energy will not be applicable on an infinitesimal volume, but must be applied on the entire volume of interest. Therefore, an integral equation with seven independent variables (radiation frequency, three space coordinates, two coordinates to define photons travelling direction, and time) may be proposed.

The effects caused by the radiative properties of materials complicate even more the thermal radiation analysis. Measuring the radiative properties is usually difficult and displays erratic behavior most of the times. Properties for liquids and solids depend on a really thin surface layer, so it is natural that these properties may be affected if there is a surface preparation for this purpose and then the properties may change when this occurs. When it refers to gases, all radiative properties may vary by much with wavelength if another dimension is added to the governing equation. It may be assumed as well that this equation is nonlinear and rarely can be considered otherwise. There are different methods to solve the governing energy equation for radiative transport but escape the scope of this chapter, and the reader is referred to related literature such as whole books that deal with the mathematical details of this equation.

3. Radiative energy transfer equation

The radiative equation has different applications, for example, in aerospace, physics, and astrophysics. Fundamentally, this equation describes a field of radiation called spectral radiance in radiometric terms.

For example, to determine the radiative flux onto a surface (or at any point inside the medium) requires knowledge of the radiative intensity at that point, for all directions and for all wavelengths or wavenumbers. In an application such as a photocatalytic reactor, the importance of energy relates to the intensity field inside a participating medium that is governed by the radiative transfer equation, which is a radiative energy balance along a thin group of rays, but for a medium that emits, absorbs, and/or scatters radiation.

The equation of radiative transfer describes mathematically interactions derived from the propagation of radiation through a medium that means that phenomena such as absorption, emission, and scattering processes are contained in an equation.

The radiative transfer equation (RTE) describes the radiation intensity at any position along a ray path through a medium. This equation can be applied to evaluate the radiation field in the heterogeneous system constituted by a photocatalyst particulate suspension in water. RTE equation may be presented in different forms; in our case we are interested in the application for a photocatalytic reactor. In such application the energy of a light source is used to activate a photocatalyst that will participate in the chemical degradation of a pollutant in water. In a reactor like this one, the energy path starts at the light source, passes through a transparent wall that may be a glass or quartz or similar, and then travels through polluted water until the energy reaches the photocatalyst. Then, for a participating medium, with absorption and scattering (no emission is considered), the RTE can be written as

E2

where Iʎ, Ω is the intensity of photons with wavelength ʎ, propagated in the direction Ω, is the volumetric absorption coefficient, σʎ is the volumetric dispersion coefficient, and p(Ω,Ω,) is the phase function that describes the dispersed radiation direction distribution.

4. Numerical solution for radiative energy problems

Therefore, there are systems or devices where radiative heat transfer becomes more important with rising temperature levels and may be totally dominant over conduction and convection at very high temperatures. Resolution of RTE equation is complex for real systems such as a photochemical reactor. There are different approaches to resolve this equation from making assumptions of ideality for the system or using empirical data. Let’s discuss how can a resolution be reached next.

4.1 An approach to solve RTE

Analytic solutions to the radiative transfer equation (RTE) exist for simple cases, but for more realistic media, with complex multiple scattering effects, numerical methods are required. Before reaching the numerical method approach, one may notice that in order to resolve Eq. (2), the volumetric scattering coefficient σʎ and the phase function that describes the directional distribution of scattered radiation p(Ω′ → Ω) are needed mainly due to the volumetric absorption coefficient κʎ, which displays strong spectral dependence. From this calculation, the intensity of photons with wavelength ʎ propagated along direction Ω, and Iʎ,Ω is the result that may be obtained. An integral on all the spatial directions may be used to account for the whole radiation field for any point of the reactor space, and by multiplying this value by the absorption coefficient, one may obtain the local volumetric rate of energy absorption (VREA).

4.2 Discrete ordinate method and numerical solution

Resolution of RTE may be reached using a numerical technique known as the discrete ordinate method (DOM). An advantage to use DOM is that this method is incorporated in ANSYS Fluent®. This method solves the RTE for a finite number of discrete solid angles, each one associated with a vector direction. For the case where a computational tool such as ANSYS Fluent® is used, the spatial discretization of the computational region of interest may be taken from the mesh grid created during the discretization step required by this program. However, the directional discretization for the RTE has to be specified using an angular discretization of the sphere octant of m × n divisions (divisions should be enough to avoid the well-known “ray effect”) and p × q pixelation (enough to overcome angle overhanging). ANSYS Fluent® has more models for radiation calculation incorporated that may be more simplified than DOM, but the discrete ordinate method is able to define optical processes considering wavelength; also, it considers dispersion effects, absorption, and emission of radiation in media and surfaces.

DOM may be able to resolve RTE based on a finite number of discrete solids with an angle and direction which may be related with a vector. ANSYS Fluent® provides this information by means of the meshing process which contains region location data needed by DOM, but direction of discretization for RTE evaluation should be specified by the user by means of an angular discretization. To address the direction of discretization, each octant in the 4π angular space may be discretized in Nθp × Nϕp control angles. These angles relate with polar and azimuthal directions and are fundamental for RTE resolution. Figure 1 displays an example of control elements.

Figure 1.

Geometry assuming a spherical shape with an n × m control elements division of 10 × 10 for numerical calculations using DOM.

Each control element may be subdivided Nθp × Nϕp for a bigger discretization, and calculations will refer to the pixels generated either for incoming or outgoing energy. This is an optional technique to obtain a further division of the surface in case it is required.

4.3 Programming a numerical method to resolve RTE

Programming a method to resolve the RTE is a way to carry on with a numerical solution. There are different options to program the RTE; among the more common choices may be MATLAB which is a numerical computation system by itself with its own language, Fortran, C, C++, and ANSYS®, among others. The programming that will be displayed in the next paragraphs is built for ANSYS Fluent® so it needs some C or C++ knowledge because even though ANSYS Fluent® is considered to use its own language, it is similar to C or C++ given that ANSYS Fluent® itself was built in that language.

This chapter does not intent to educate the reader in programming but assumes some basic knowledge is needed in order to keep up with the next paragraphs. Also, there is some knowledge in ANSYS Fluent® needed; more likely, the reader might need to be an advanced user of this program since we will mention briefly some of the basics only when it is absolutely needed.

Some essential comments related to programming C language are included because it is relevant to understand UDFs in ANSYS Fluent®. These comments are really basic because they are intended to provide only a hint to the reader, but a C language programming book is highly recommended. So, in this context, this chapter will not cover important C programming topics such as while and do-while, unions, cycles, structures, and reading and writing files. For further developing your programming skills, one may consult a C book or guide [6, 7]; this is highly recommended before starting to build or program your own UDFs.

4.4 Programming and user-defined functions

The ANSYS Fluent® has a tool to input complementary code with customized functions or actions. This complementary code is known in ANSYS® user manual as user-defined functions (UDFs). User-defined functions are the more common tool to customize calculations in ANSYS Fluent®; however, programming a UDF is complicated, and it is considered an advanced skill for users of ANSYS Fluent®.

A UDF, in short, is a C or C++ small program that acts as a function so it can be easily loaded in the ANSYS Fluent® solver with the intention of enhancing its standard features. For example, a UDF may be used to:

  • Specify boundary conditions, material properties, surface and volume reaction rates, source terms in ANSYS Fluent® transport equations, user-defined scalar (UDS) for source terms in transport equations, and diffusivity functions, among others.

  • Once per iteration adjustment of specific computed values.

  • Solution initialization.

  • Execution of a UDF performs asynchronous calculations as required.

  • End of an iteration function execution, computations after exiting from ANSYS Fluent®, or after loading a compiled library.

  • Additional capabilities or computations during postprocessing.

  • Additional capabilities or computations from existing ANSYS Fluent® models (additional to mathematical models already loaded like discrete phase model, multiphase mixture model, discrete ordinates radiation model).

For further knowledge in UDFs, the reader is referred to literature produced by ANSYS® or specialized books [8].

From the authors perspective, a UDF is a C program conformed by a set of macros developed specifically for ANSYS Fluent®; such macros may be considered small pieces of the program or built in functions specially for ANSYS Fluent®. If one takes a look at a UDF, a code will be able to identify a program in C or C++, but very few lines will be purely these languages because most lines are macros specifically developed for ANSYS Fluent®. Then, in conclusion, if one looks at the content of an UDF, he or she will find a few lines purely programmed in C plus a series of macros built in to work only in ANSYS Fluent® all of them ready to add up a specific computation complementary to ANSYS Fluent® capabilities.

4.5 Coupling the UDF to a multiphysics program suite

The UDF will provide the steps to numerically resolve RTE, but there is an important action that needs to be carefully performed, and that is the coupling of the UDF in the ANSYS Fluent®. The general theory in UDF development says a user-defined function may be programmed to execute steps in different stages of the problem numerical resolution. In this case, the need to resolve the RTE equation relies in the need to find out numerically the light energy influence in a photocatalytic reactor. To accomplish this purpose, the UDF will execute after hydrodynamic calculations have been completed.

Then, after the UDF is available, the user will have to perform a compilation of the program to make sure the syntaxis is correct. After compilation, the UDF is ready to be loaded into the Multiphysics program in this case ANSYS Fluent®. In fact, the compilation process is also performed within ANSYS Fluent® as well as the loading process where the UDF is coupled to the main code.

A last recommendation after the UDF is compiled and loaded into ANSYS Fluent® is to perform testing runs of the problem numerical resolution to make sure the UDF works well and is returning good numerical results.

5. User-defined functions to resolve the RTE

In this section, examples of UDFs that can be used to resolve numerically the RTE are presented.

5.1 UDF used to resolve the Henyey-Greenstein phase function

As mentioned in prior paragraphs, it is needed to resolve the phase function. Since the selected phase function was the Henyey-Greenstein, it is needed to develop a UDF to have this function resolved. Next, a proposed UDF to resolve this function in pretty basic terms is shown [9]. Additional comments have been added to explain further the purpose of the programmed line. In each line or command, or cycle, or macro, the user may add comments to help out understand the UDF design intent during possible reviews, corrections, tests, improvement, etc. In these examples, comments are added for didactic reasons but in a professional UDF if may be recommended much less comments and limited to explain the more relevant parts of the program. A solution for the selected phase function was the Henyey-Greenstein which is displayed in Table 1.

/* Dear all: this is a UDF built specifically to resolve the
Henyey-Greenstein phase function for thermal radiation calculations*/ /* comments section*/
#include"udf.h" /* command to initiate a udf*/
DEFINE_SCAT_PHASE_FUNC(hgscat,c,f) /* DEFINE is a macro*/
{ /* Command to start a computation*/
real p = 0.; /* set up a data type*/
real g = 0.5161; /* set up a data type*/
p = (1-pow(g,2.0))/pow((1+g*g-2*g*c),1.5); /* Equation for calculation*/
return(p); /* output*/
} /* Command to end a computation */

Table 1.

Proposed UDF to resolve the Henyey-Greenstein phase function.

5.2 UDF to resolve radiation transfer from a light source

This UDF represents a numerical solution to the energy transfer from a light source to a reactor. The skeleton of this UDF was recycled from the Sandia National Laboratories website. It was updated to suit the open channel flow application and new features were added [10]. Additional comments have been added to explain further the purpose of the programmed line. Table 2 displays a UDF to resolve the radiation energy as a result of the emission of a light source.

/* Tested UDF to integrate UV intensity over time along a particle trajectory. */
/* When volume fraction is very small and a cell is reached particles are deleted from the domain */
/*Low dosed particles are identified and residence times are obtained at the reactor outlet. */ /* comments section*/
#include "udf.h" /* command to initiate a udf*/
#include "dpm.h" /* command to call a udf*/
#include "sg_disco.h" /* command to access cell UV intensity values*/
#define C_DO(c,t)C_STORAGE_R_XV(c,t,SV_DO_IRRAD,0) /* DEFINE is a macro*/
#define fdout "doseout.txt" /* DEFINE is a macro*/
#define ftrack "trackfilters.txt" /* DEFINE is a macro*/
#define ftime "restime.txt" /* DEFINE is a macro*/
FILE *pdout; /* use file*/
FILE *ptrack; /* use file*/
FILE *ptime; /* use file*/
static real uv_intensity;
/* This macro integrates UV intensity over time along a particle trajectory */ /* comments section*/
/* This macro writes the UV dosage, residence time and ID for low dosed particles at reactor outlet. */ /* comments section*/
DEFINE_DPM_OUTPUT(uv_output, header, fp, p, thread, plane) /* Define macro, variable set up*/
{
if (header) /* if-else loop*/
{
}
else
{
/* write the dosage values */ /* comments*/
pdout=fopen(fdout,"a"); /* delete previous files */ /* data type, comments*/
fprintf(pdout,"%10.6g \n",p->user[0]); /* output, comments*/
fclose(pdout); /* end computation*/
/* write the particle id of low dosed particles */ /* comments*/
ptrack=fopen(ftrack,"a"); /* delete previous files */ /* datatype, comments*/
if(p->user[0]<30.0) /* change this value accordingly */ /* if-else loop, comments*/
{
fprintf(ptrack,"%d,",p->part_id); /* output, calculations*/
}
fclose(ptrack); /* end computation*/
/* write the particle residence times */ /* comments*/
ptime=fopen(ftime,"a"); /* delete previous files */ /* data, calculation, comments*/
fprintf(ptime,"%10.6g \n",p->st ate.time); /* output, calculations*/
fclose(ptime); /* end computation*/
}
}

Table 2.

Proposed UDF to resolve the effects of a light source radiation energy to the reactor passing through transparent media, in our case, polluted water.

6. Conclusions

The mathematical model for numerical calculations of the effects of light into a photocatalytic reactor is discussed. Despite the difficulty of a generalized method, it is reached the goal on presenting a study of the requirements to have a programmed UDF that resolves the radiation transfer energy equation. Due to the difficulty to find out a generic code applicable in all situations, for this chapter, one may assume the mathematical model applies for a photocatalytic reactor with an external light source so the light energy is transferred into the system of study. There is a transparent wall that the light needs to go through as well as water or polluted water as the fluid media. For such system, the process to obtain a UDF that calculates numerically the effects of the light source in the reactor is explained. The program was written similarly compared to C language, but the language is considered a property of ANSYS® or more specifically in ANSYS Fluent®. That means the programming language is its own language for ANSYS Fluent®, but it follows a syntaxis and structure very similar to C language. It is highly recommended to develop C language programming skills and ANSYS Fluent® user-defined function training. These skills may be achieved after one is an advanced user in ANSYS Fluent® so the programming can be coupled with CFD calculations and then the problem at hand with hydrodynamics numerical results will be complemented with light source effects, which at the end is the main purpose of this chapter. The UDFs presented are displayed so the reader can understand its purpose and take advantage to develop their own program.

Acknowledgments

This work was financed by CONACyT (Mexican Science and Technology National Council) through 2015 CONACyT SEP-CB (Basic Science-Public Education Ministry) project fund 258553/CONACyT/CB-2015-01. Thanks go to the Scientific Computing Laboratory at FCQ-UJED for computational resources. Thanks go to the Academic Group UJED-CA-129 for valuable discussions.

Conflict of interest

The authors state that this research was completed without any conflicts of interest related with funding to develop the present work.

Download

chapter PDF

© 2019 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution 3.0 License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

How to cite and reference

Link to this chapter Copy to clipboard

Cite this chapter Copy to clipboard

Diana Barraza-Jiménez, Adolfo Ruiz-Soto, Sandra Iliana Torres-Herrera, Elva Marcela Coria-Quiñones, Raúl Armando Olvera-Corral, David José Romero-Soto and Manuel Alberto Flores-Hidalgo (August 27th 2019). Radiative Transference Equation Algorithm as an ANSYS® User-Defined Function for Solar Technology Applications [Online First], IntechOpen, DOI: 10.5772/intechopen.88767. Available from:

chapter statistics

52total chapter downloads

More statistics for editors and authors

Login to your personal dashboard for more detailed statistics on your publications.

Access personal reporting

We are IntechOpen, the world's leading publisher of Open Access books. Built by scientists, for scientists. Our readership spans scientists, professors, researchers, librarians, and students, as well as business professionals. We share our knowledge and peer-reveiwed research papers with libraries, scientific and engineering societies, and also work with corporate R&D departments and government entities.

More About Us