Function kalast::body::view_factor

source ·
pub fn view_factor(
    b1: &AirlessBody,
    b2: &AirlessBody,
    shadows: bool
) -> DMatrix<Float>
Expand description

Compute the view factor per unit of area describing the fraction of energy that can be transmitted between the Faces of Surface A and the Faces of Surface B.

Definition

The contribution between two Faces to the viewing factor depends on the angle between one Face normal and the line of sight between the two Faces.

The viewing factor contribution between two Faces is zero if:

  • the angle between any of the two Faces normal and the line of sight between these two is greater than 90 degrees, or
  • the line of sight between these two is intercepted by any of the two Surfaces.

Nalgebra matrices are column-major order. So the filling of the view-factor matrix is column-major order. The cartesian product of itertools over facets of both surfaces will iterate first over A and then B. To get an output of shape (N1, N2) we need to transpose the matrix at the end.

The shape of the output matrix is (N1, N2). There are N1 rows and N2 columns. N1 is the number of Face in Surface A, and N2 the number of Face in Surface B. In this text, i-th indices refers to rows and j-th are for columns. Which means, each column is a new Face of Surface B, and each row is a new Face of Surface A. In other words, a row is of shape (1, N2) containing one Face of Surface A and all the Faces of the Surface B, and a column is of shape (N1, 1) containing all the Faces of Surface B and one Face of Surface A. So if you are looking for the contributions of all Faces of Surface B onto the i-th Face of Surface A, you need the i-th row.

The only thing is, this function actually returns the view factor per unit of area. To correctly express the fraction of energy that can be transmitted from facets B to A, each individual facet contribution needs to me multiplied by the area of the facets transmitting energy. Each column should be multiplied by each facet area from surface B. And to get the energy transmitted from surface A to surface B, each row should be multiplied by the area of the facets A. We let the user to do that to that his own way to handle memory as prefered because matrices can be very large and can explode the RAM.

Surface B needs to be correctly oriented and positioned in the reference frame of Surface A to do the computation of the view factor. Thus, a transformation matrix is needed to express the rotation and translation from Surface B to Surface A.

Expression

$$V_{ij}=\frac{a_j\cos\Theta_i\cos\Theta_j}{\pi r_{ij}^2}$$

where $a_i$ is the area of the facet $i$, $\Theta_x$ the angle between the centers of the facets $i$ and $j$ and the normal of the facet $x$, and $r$ is the distance between the facets.