When evaluating the radiative heat exchange, one of the common methodologies is to use ray tracing.
With this method, it is possible to determine radiative couplings (or view factors) between objects.
In this analysis, it is necessary to specify ray origin points on the object surfaces such that they are uniformly distributed over the area, and then the ray directions should be determined according to Lambert’s cosine law (assumining diffuse surfaces).
In this article, we discuss how to distribute points uniformly on primitive shapes using random values in the range of 0 to 1.
Rectangle
The most simple case for uniform point distribution is a rectangle.
To uniformly distribute points on a rectangle, each point can be calculated by Eq. (1) using two random numbers q1 and q2 in the range of [0, 1].
This method can be applicable to parallelograms as well.
p=q1(p2−p1)+q2(p3−p1)
Figure 1: Point Distribution on a Rectangle.
Triangle
For a triangle, one simple approach is to calculate the point in the same way as a rectangle, using Eq. (1).
To ensure the points are inside the triangle, the sum of the two random values (q1,q2) should be less than or equal to 1.
If the sum exceeds 1, the values should be discarded, and new random values should be generated until a valid combination is obtained.
Figure 2: Point Distribution on a Triangle.
Cylindrical Surface
For a cylindrical surface, points can be distributed uniformly in both the height and the circumferential direction.
The height h and circumferential parameter φ are determined using a random value q1 and q2 as shown in Eq. (2) and Eq. (3), respectively.
h=hmaxq1φ=(φend−φstart)q2+φstart
Figure 3: Point Distribution on a Cylindrical Surface.
Disc
We consider a partial disk as shown in Figure 4.
When distributing points uniformly on a partial disk, the probability q1 of a point falling within the radius of r can be expressed by Eq. (4).
Solving this equation for r gives us the description of the radial position r as a function of random value q1.
r=q1(router2−rinner2)+rinner2
For the angular direction, the angle θ can be determined using a random value q2 as shown in Eq. (6).
θ=q2(θend−θstart)+θstart
Figure 4: Point Distribution on a Disk.
Spherical Surface
We consider a partial spherical surface as shown in Figure 5.
When distributing points uniformly on a spherical surface, the probability q that a point is below a polar angle of θ can be expressed as shown in Eq. (7).
For the azimuthal direction, the angle φ can be determined using a random value q2 as shown in Eq. (9).
φ=q2(φend−φstart)+φstart
Figure 5: Point Distribution on a Spherical Surface.
Cone
We consider a partial conical surface as shown in Figure 6.
When distributing points uniformly on a conical surface, the probability q1 that a point is below a height of h can be expressed as shown in Eq. (10).
Solving this equation for h, we obtain the height h as a function of the random value q1.
There are two solutions to this equation, but we select the negative solution, so that the height h does not exceed the apex of the cone.
For the angular direction, the angle φ can be determined using a random value q2 as shown in Eq. (14).
φ=q2(φend−φstart)+φstart
Figure 6: Point Distribution on a Cone.
Parabolic Surface
We consider a parabolic surface as shown in Figure 7.
The vertex of the parabolic surface is at the coordinate origin, and the axis of the parabolic surface aligns with the vertical axis of the coordinate system.
Figure 7: Point Distribution on a Parabolic Surface.
The relationship between the radius r and the height h is expressed by
h=a2r2,wherea2=rmax2hmaxr=ah
The inclination of the tangential line tanθ is described by
tanθ=drdh=2a2r
Using the relation of 1+tan2θ1=sin2θ1, the following equations are obtained.
If rounding errors for floating point numbers are critical for your numerical calculation. What is the correct way to estimate and track the error? Looking into the definition in IEEE 754-2019 and basic methodology for the error estimation.
If you want to calculate the time evolution of ODE, one of the most common and simple methods is the Runge-Kutta method (RK4). In this article, we will confirm that RK4 achieves fourth-order accuracy.