Biswajit Banerjee

### Generating periodic RVEs with polydisperse ellipsoids

Part 1: Finding intersections

#### Introduction

Many micromechanics studies use periodic representative volume elements to simulate the effective response of a material. The periodicity requirement comes from requirements imposed by the asymptotic theory of homogenization. In that theory, we assume that field quantities in a heterogeneous material can be expressed as functions of the form $u(x, x/\epsilon)$ where $u(x, y)$ is periodic in $y$. Such functions are identified with microscopic values and macroscopic quantities are found by averaging these values.

The above approach is not the only possible way forward. The H-measure theory developed by Luc Tartar and Francois Murat does not have a periodicity requirement but is more difficult to simulate and has, therefore, not attracted the attention it deserves. We will also avoid the H-convergence route in this article. For more information on possible approaches, see Approximation of H-measures.

#### Periodic microstructures Figure 1. Polydisperse sphere microstructure generated using a Poisson process (c. 2002).

A common technique used to generate non-periodic microstructures uses the following steps:

• Create a regular grid in three dimensions and bound the grid with an axis-aligned box
• Place particles at each grid point based on an input particle size distribution
• Initialize each particle with a random velocity
• Run a discrete element or molecular dynamics simulation with rigid particles while moving the boundaries inward until a given packing fraction is achieved.

Once a non-periodic distribution is generated, a periodic one can be created from it by copying particles from one face of the RVE to the opposite face. This process is straightforward if particles are spherical, but more work is needed for ellipsoidal particles.

#### Ellipsoid-plane intersection Figure 2. An ellipsoid intersecting an oriented box.

The first step in the periodic particle generation is to identify which particles are boundary particles and need to be copied. An easy approach is to choose a bounding box around each face and select particles whose centers fall inside those boxes. However, there is the possibility of missing some particles if we use that approach.

If we start with an ellipsoidal particle distribution, another way of identifying which particles are at or near a boundary face is to determine whether the ellipsoid intersects the plane face. The advantage of this approach is that we can use it even if the bounding box is not axis-aligned.

We can determine whether an ellipsoid intersects a bounded plane, by using a transformation that takes the ellipsoid to a sphere. This transformation has the advantage that now we can can use sphere-edge intersection algorithms to determine whether the ellipsoid intersects a plane.

##### The transformation

The transformation is straightforward. We just compute the matrix $\mathbf{T}$, where

$$\mathbf{T} = \begin{bmatrix} e^a_x/r_a & e^a_y/r_a & e^a_z/r_a \\ e^b_x/r_b & e^b_y/r_b & e^b_z/r_b \\ e^c_x/r_b & e^c_y/r_b & e^c_z/r_b \end{bmatrix}$$

If the center of the ellipsoid is at $\mathbf{c} = (x_c, y_c, z_c)$, and the bounded plane has vertices $\mathbf{v}_1, \mathbf{v}_2, \mathbf{v}_3, \mathbf{v}_4$, we get the transformed plane by computing the transformed vertices

$$\mathbf{v}^{(t)}_i = \mathbf{T} (\mathbf{v}_i - \mathbf{c})$$

where the radii of the three axes of the ellipsoid are $(r_a, r_b, r_c)$ and the unit vectors along the axes are $\mathbf{e}^a, \mathbf{e}^b, \mathbf{e}^c$. Each unit vector has components $\mathbf{e}^\alpha = (e^\alpha_x, e^\alpha_y, e^\alpha_z), \alpha = a, b, c$.

Notice that the rectangular box has transformed into a parallelepiped.

##### Finding face-sphere intersections

To find whether the transformed face intersects the sphere, I decided to compute not only the distance from the sphere to the face but also the location of the point of intersection of a line from the center of the sphere to each edge. Of course, such a line would have to be normal to the edge for that information to be useful.

First I computed a normal to the transformed face, assuming a counter-clockwise layout of the vertices around the outward normal to the face. The normal is given by

$$\mathbf{n} = (\mathbf{v}_2 - \mathbf{v}_1) \times (\mathbf{v}_3 - \mathbf{v}_1) ~,~~ \hat{\mathbf{n}} = \mathbf{n}/\left\lVert\mathbf{n}\right\rVert$$

We, of course, use the unit normal, $\hat{\mathbf{n}}$, in our calculations. The distance from the center of the sphere (which is at the origin after the transformation) to the plane is given by

$$d = \hat{\mathbf{n}} \cdot (\mathbf{c} - \mathbf{v}_1)$$

and therefore, the projection of the sphere center on to the face is

$$\mathbf{c}_p = \mathbf{c} - d \hat{\mathbf{n}}$$

Now that we have the closest point on the face (from the sphere), we can find the distances to the four edges of the bounded plane. If we parameterize an edge with the parameter $t$ such that any point on the edge is given by $\mathbf{p} = (1 - t) \mathbf{v}_1 + t \mathbf{v}_2$, the value of $t$ for the closest point on the edge from $\mathbf{c}_p$ is

$$t_c = -\frac{(\mathbf{v}_1 - \mathbf{c}_p)\cdot(\mathbf{v}_2 - \mathbf{v}_1)}{\left\lVert\mathbf{v}_2 - \mathbf{v}_1\right\rVert^2}$$

and the distance to that point is

$$d_c = \left\lVert \mathbf{c}_p - (1 - t_c) \mathbf{v}_1 - t_c \mathbf{v}_2\right\rVert$$

We could alternatively compute $d_c$ using

$$d_c = \frac{\left\lVert (\mathbf{c}_p - \mathbf{v}_2) \times (\mathbf{c}_p - \mathbf{v}_1) \right\rVert}{\left\lVert\mathbf{v}_2 - \mathbf{v}_1\right\rVert}$$

With this information, we can find whether the sphere intersects the transformed face if the distances are less than 1 (note that the transformation matrix takes the ellipsoid into a sphere of radius 1).

Let us now look at my C++ implementation of these ideas.

##### Implementation

I did not want to lose any of the information computed during the distance computations. So I decided to return a pair containing the values of $t_c$ and $d_c$ for each edge. I created an Edge struct as shown below.

The distance function returns a pair such that first contains $t_c$ while second contains $d_c$.

I then created a Face struct that had the following form. Once again, instead of returning only the distance to the face, I returned a pair containing the $t_c$ and $d_c$ values for each edge in addition to the distance to the face.

Now we are ready to find the intersection of the face with the ellipsoid. For the purposes of periodic particle generation, it is important that we know whether the ellipsoid intersects a vertex or edge of the face, or whether the region of intersection is fully contained in the face. We return that information from the intersection function in addition to a boolean that indicates whether there is any intersection at all. The code is listed below.

#### Remarks

With these basic infrastructure objects in place, we are ready to proceed to the actual generation of periodic particles. The details will be provided in part 2 of this article.

If you have questions/comments/corrections, please contact banerjee at parresianz dot com dot zen (without the dot zen).