Algorithms
In this section, we have five important files for calculating view factors, as follows:
1. raytracingviewfactor.hpp:
This file contains the following principal classes and functions:
-
getRandomDirection: This method generates a random direction, uniformly distributed either on a sphere (for 3D cases) or on a circle (for 2D cases).
-
elementArea: This method calculates the area of a geometric element. There are two overloaded versions: one for 3D cases and one for 2D cases.
-
isOnSurface: This method checks if a given point is on the surface of an element (triangle in 3D or segment in 2D). This is crucial for ensuring that rays used in ray tracing correctly start on the surface of interest.
-
RayTracingViewFactor: This class encapsulates the calculation of view factors using the ray tracing method. The results are stored in a view factor matrix.
-
get_random_point: This method generates a random point on an element (triangle or segment) to serve as the starting point for rays in ray tracing.
-
computeViewFactor_bvh: This method calculates view factors using a Bounding Volume Hierarchy (BVH) to accelerate ray tracing.
2. KDTreeVectorOfVectorsAdaptor.hpp:
This is a template struct designed to work with the nanoflann library, which provides efficient nearest neighbor (k-NN) searches. The struct serves as an adapter, allowing the nanoflann KD-tree implementation to work with a custom data structure—a vector of vectors—without duplicating storage.
3. viewfactorbase.hpp:
This file contains methods that compute the view factor matrix, check the deviation from reciprocity, and provide functionalities to retrieve the calculated results.
4. bvh.hpp:
This file contains various classes and functions for creating rays and their intersections using the BVH (Bounding Volume Hierarchy) method and handling intersection cases in 2D and 3D.
-
BVHRay: Manages ray tracing by encapsulating ray components.
-
BVHRayDistributed: Efficiently handles collections of rays in a simple manner.
-
BVH: An advanced implementation of the Bounding Volume Hierarchy for managing mesh primitives and ray tracing.
-
BVH_ThirdParty: Extends the BVH class by using a third-party backend for constructing and managing the Bounding Volume Hierarchy. It enhances the flexibility and performance of intersection calculations.
-
BVH_InHouse: Constructs and manages a custom BVH tree for intersection calculations. It effectively checks intersections with segments or triangles and provides methods to build and traverse the BVH tree.
-
boundingVolumeHierarchy: Dynamically creates a BVH tree based on provided parameters:
-
in-house: Uses an internal implementation (BVH_InHouse).
-
third-party: Uses a third-party implementation (BVH_ThirdParty), but only for 3D data.
-
It configures the BVH tree with the given data and parameters (quality, worldcomm) before returning it as a unique pointer.
5. unobstructedplanarviewfactor.hpp:
This file defines the UnobstructedPlanarViewFactor class, which computes view factors for planar faces in unobstructed radiative heat transfer scenarios using different numerical integration methods
-
UnobstructedPlanarViewFactor: Inherits from ViewFactorBase and implements the computation of view factors for planar surfaces. It supports various algorithms, such as Double Area Integration (2AI) and Single Area Integration (1AI Hottel and Sarofim, 1967 only for 3D).
-
compute: The main function that performs the calculation of view factors· It updates contexts, handles boundary markers, and integrates over surfaces using the specified numerical methods· It also ensures the reciprocity and normalization of the view factors