Public and private types and functions

Public functions and types for geometry creation

Main.RayTraceHeatTransfer.Geometry.SubEnclosureType
SubEnclosure

This struct is used for initial geometry building. To Initialize it use: SubEnclosure(point1::Vector{Float64},point2::Vector{Float64}, point3::Vector{Float64},point4::Vector{Float64}, solidWall1::Bool,solidWall2::Bool, solidWall3::Bool,solidWall4::Bool) The first four inputs are the bounding points. The next four inputs state whether the walls are solid or empty.

source
Main.RayTraceHeatTransfer.Geometry.displayGeometryMethod
displayGeometry(geometry::Vector{SubEnclosure})

This function plots one or more SubEnclosures. It is used for building and validating the geometry. It automatically shows which walls are solid and empty, and shows the number of each SubEnclosure. This information is important when defining boundary conditions when solving heat transfer problems.

source

Public functions for ray tracing

Main.RayTraceHeatTransfer.RayTracing.writeMatricesToCSVMethod
writeMatricesToCSV(FSS::Matrix{Float64},FSG::Matrix{Float64},
                    FGS::Matrix{Float64},FGG::Matrix{Float64},
                    mesh::RayTracingMesh,gas::GasProperties,
                    N_rays::Int64)

This function saves the results of a ray tracing run, which gives four exchange factor matrices. These matrices are saved as CSV-files where the name gives information on the settings that were used to statistically measure them.

source

Public functions for heat transfer calculation

Main.RayTraceHeatTransfer.HeatTransfer.steadyStateMethod
steadyState(mesh::RayTracingMesh,FSS::Matrix{Float64},FSG::Matrix{Float64},
                    FGS::Matrix{Float64},FGG::Matrix{Float64},
                    epsw_in::Matrix{Float64},gas::GasProperties,
                    maxIter::Int64,relTol::Float64,Tw_in::Matrix{Float64},
                    Tg_in::Vector{Float64},qw_in::Matrix{Float64},qg_in::Vector{Float64})

This function obtains the steady state temperature distribution in a rigorous way.

source
Main.RayTraceHeatTransfer.HeatTransfer.plotTemperatureFieldFunction
plotTemperatureField(mesh::RayTracingMesh,Tg::Vector{Float64},Tw=nothing)

This function enables contour-like plots of custom geometries. It plots the gas temperature distribution and optionally also wall temperatures. The two temperature input vectors are returned by the function 'steadyState'. The wall temperature vector 'Tw' is optional.

source

Public utility 3D view factor function

Main.RayTraceHeatTransfer.ViewFactor3D.viewFactorMethod
viewFactor(POLY_A::Matrix{Float64}, POLY_B::Matrix{Float64})

Original authors: Jacob A. Kerkhoff and Michael J. Wagner (MATLAB-implementation) University of Wisconsin-Madison, Energy Systems Optimization Lab https://github.com/uw-esolab/docs/tree/main/tools/viewfactor Originally written for the paper: "A Flexible Thermal Model for Solar Cavity Receivers Using Analytical View Factors" https://doi.org/10.1115/ES2021-63810

Translated to the Julia Programming Language by: Nikolaj Maack Bielefeld during studies at Aalborg University, Thermal Energy and Process Engineering. The ray tracing part of the original function was not translated. Published in RayTraceHeatTransfer.jl with permission from the original authors.

Analytical solution derivation: Narayanaswamy, Arvind. "An analytic expression for radiation view factor between two arbitrarily oriented planar polygons." International Journal of Heat and Mass Transfer 91 (2015): 841-847.

viewFactor(POLYA, POLYB) analytically computes the view factor from POLYA to POLYB and from POLYB to POLYA. Input arguments are in the form of 3x2 or Nx3 arrays, where each row corresponds to a vertex of the polygon, the columns refer to the X,Y,Z coordinates of the vertices. If Z coordinates are omitted, they are assumed to be zero.

The following must be true for both polygons:

  1. polygons are planar (all vertices lie in the same plane)
  2. polygons are simple (no self-intersecting polygons)
  3. polygons are convex (in theory, concave polygons should work, but this remains untested)
source

Private functions

Private geometry functions

Main.RayTraceHeatTransfer.Geometry.areaVolumeMeshMethod
areaVolumeMesh(Nx::Int64,Ny::Int64,N_subs::Int64,
            point1::Matrix{SVector{2,Float64}},point2::Matrix{SVector{2,Float64}},
            point3::Matrix{SVector{2,Float64}},point4::Matrix{SVector{2,Float64}})

This function is called internallly inside the RayTracingMesh struct when generating a new instance. This function calculates the area of bounding walls and the volume of volumes.

source
Main.RayTraceHeatTransfer.Geometry.localWallsMethod
localWalls(point1::Vector{Float64},point2::Vector{Float64},
            point3::Vector{Float64},point4::Vector{Float64})

This function determines a point on each wall of the current cell as well as an inward pointing normal vector of each wall. This information fully describe the walls of each cell.

source

Private functions for ray tracing

Main.RayTraceHeatTransfer.RayTracing.coefs_exchangeMethod
coefs_exchange(mesh::RayTracingMesh, Wall_absorbX::Array{Float64, 3},
                    Wall_absorbY::Array{Float64, 3},
                    N_abs_gas::Array{Float64, 3},RayCountTotal::Float64)

This function is called internallly during the ray tracing. After ray tracing one emitter (surface or volume) this function calculates one row of the two corresponding exchange factor matrices.

source
Main.RayTraceHeatTransfer.RayTracing.distToSurfaceMethod
distToSurface(point::SVector{2,Float64}, i1::SVector{2,Float64},
                mesh::RayTracingMesh, N_subs_count::Int64)

This function determines the distance to a plane (a line in 2D) from a given point along a given direction, as well as the index of the wall (bottom, right, top, left).

source
Main.RayTraceHeatTransfer.RayTracing.lambertSample3DMethod
lambertSample3D()

This function generates a local diffuse (Lambertian) emission sample from a wall. The generated sample is 3D but is converted to 2D by projecting it onto the 2D plane (by setting third component to zero). This sample correspond to the local coordinates of the given wall. It is later rotated to global coordinates.

source
Main.RayTraceHeatTransfer.RayTracing.rayTracing_CPUMethod
rayTracing_CPU(subNumber::Int64,wallNumber::Int64,
                    sampleLeftRight::Bool,sampleTopBottom::Bool,
                    mesh::RayTracingMesh, gas::GasProperties, N_rays::Int64,
                    wallEmission::Bool,volumeEmission::Bool,
                    displayWhileTracing::Bool,nthreads::Int64,
                    xCountSample::Int64, yCountSample::Int64)

This function ray traces a single ray in a 2D domain (or a number of rays in parallel). The ray (or rays) is emitted from a specified emitter (wall or volume) and traced throughout the domain. This function also gives the user the possibility to plot the traced ray paths (must execute single threaded). When all the rays have been traced the absorbed rays are summed up for each cell and returned for use in the calculation of the exchange factor matrices. The ray tracing is performed on a coarse grid and absorption points are mapped to a fine grid. This approach greatly improves the efficiency as opposed to tracing on a fine grid.

source
Main.RayTraceHeatTransfer.RayTracing.sampleSurfaceMethod
sampleSurface(mesh::RayTracingMesh, subNumber::Int64, wallNumber::Int64,
                        xCountSample::Int64, yCountSample::Int64,
                        sampleLeftRight::Bool, sampleTopBottom::Bool)

This function samples an emission position on a 2D surface (a line) as well as an emission direction, given the endpoints of the line and position in the mesh. The function samples from a diffuse (Lambertian) distribution and rotates the sample from local to global coordinates using a rotation matrix.

source
Main.RayTraceHeatTransfer.RayTracing.sampleSurfacesMethod
sampleSurfaces(mesh::RayTracingMesh,gas::GasProperties,
                N_rays::Int64,nthreads::Int64,displayWhileTracing::Bool)

This function samples all of the surface emitters. Each sampled emitter generates rows in the FSS and FSG exchange factor matrices.

source
Main.RayTraceHeatTransfer.RayTracing.sampleVolumeMethod
sampleVolume(mesh::RayTracingMesh, xCount::Int64, yCount::Int64)

This function samples an emission point and direction in a volume (a surface in 2D), by separating it in two triangles and sampling according to their area. This operation requires knowledge of the mesh, which is why the mesh is also an input.

source
Main.RayTraceHeatTransfer.RayTracing.sampleVolumesMethod
sampleVolumes(mesh::RayTracingMesh,gas::GasProperties,
                N_rays::Int64,nthreads::Int64,displayWhileTracing::Bool)

This function samples all of the volumetric (gas) emitters. Each sampled emitter generates rows in the FGS and FGG exchange factor matrices.

source

Private functions for view factor function

Main.RayTraceHeatTransfer.ViewFactor3D.edgePairParametersMethod
edgePairParameters(Po::Matrix{Float64}, Pf::Matrix{Float64},
                    Qo::Matrix{Float64}, Qf::Matrix{Float64},
                    almostZero::Float64)

http://geomalgorithms.com/a07-_distance.html find shortest distance D between line Po+su and Qo+tv for initial points Po and Qo, parameters s and t, and vectors u and v.

source

Index