A 149 Line Homogenization Code
A 149 Line Homogenization Code
Guoying Dong
Department of Mechanical Engineering, for Three-Dimensional Cellular
McGill University,
817 Rue Sherbrooke Ouest, Room G53,
Montreal, QC H3A 0C3, Canada
Materials Written in MATLAB
e-mail: [email protected]
Cellular architectures are promising in a variety of engineering applications due to
Yunlong Tang attractive material properties. Additive manufacturing has reduced the difficulty in the
Department of Mechanical Engineering, fabrication of three-dimensional (3D) cellular materials. In this paper, the numerical
McGill University, homogenization method for 3D cellular materials is provided based on a short, self-
817 Rue Sherbrooke Ouest, Room G53, contained MATLAB code. It is an educational description that shows how the homogenized
Montreal, QC H3A 0C3, Canada constitutive matrix is computed by a voxel model with one material to be void and
e-mail: [email protected] another material to be solid. A voxel generation algorithm is proposed to generate the
voxel model easily by the wireframe scripts of unit cell topologies. The format of the wire-
Yaoyao Fiona Zhao1 frame script is defined so that the topology can be customized. The homogenization code
is then extended to multimaterial cellular structures and thermal conductivity problems.
Department of Mechanical Engineering,
The result of the numerical homogenization shows that different topologies exhibit aniso-
McGill University,
tropic elastic properties to a different extent. It is also found that the anisotropy of cellu-
817 Rue Sherbrooke Ouest, Room 148,
lar materials can be controlled by adjusting the combination of materials.
Montreal, QC H3A 0C3, Canada
[DOI: 10.1115/1.4040555]
e-mail: [email protected]
Keywords: cellular material, lattice structure, MATLAB, numerical homogenization
1 Introduction decades. It assumes that each field quantity depends on two differ-
ent scales: macroscopic level and microscopic level. The basic
Cellular materials are evolved from nature to achieve high stiff-
theory has been covered in detail in some literature [7,8]. Bendsøe
ness and strength with low density. Humankind had manufactured
and Kikuchi [9] used this method to get the effective elastic mod-
cellular architectures such as foams and honeycombs to mimic
ulus of a unit cell. It was also implemented in a design procedure
natural cellular materials decades ago. However, they were less
to find the optimal topology of a unit cell under a certain boundary
sophisticated than natural cellular materials due to the limitation
condition. Arabnejad and Pasini [10] investigated the mechanical
of manufacturing techniques. Recently, with the development of
properties of six different lattice topologies for a whole range of
additive manufacturing (AM), cellular materials have been fabri-
relative density by asymptotic homogenization. The homogeniza-
cated with more complicated structures and novel architectures
tion equation is discretized and solved via FEA. This is often
[1]. The lattice structure, which is a type of cellular material with
referred as numerical homogenization. Hassani and Hinton [6,11]
interconnected structs and nodes in a three-dimensional (3D)
reviewed the methods of numerical homogenization to solve gen-
space, has been successfully manufactured by several types of
eral boundary value problems with periodic boundary conditions.
AM techniques. Due to controllable properties, periodic lattice
Andreassen and Andreasen [12] summarized the formula to com-
structures with different topologies and relative densities are
pute the homogenized elasticity tensor EH ijkl and used numerical
widely used in engineering applications for high stiffness-to-
methods to solve the two-dimensional (2D) homogenization prob-
weight ratio [2,3], energy absorption [4], thermal management
lem by MATLAB. EH ijkl can be computed as
[5], etc.
The complex structure of cellular materials not only makes it ð
1 ðijÞ ðijÞ
difficult for fabrications but also leads to high computational cost EH
ijkl ¼ Epqrs e0ðijÞ
pq epq e 0ðijÞ
rs ers dX (1)
for the simulation of their property. Because of small features j Xj X
inside the material, finite element analysis (FEA) requires fine
mesh to model cellular materials. If the structure is constructed by where Epqrs is the locally varying elasticity tensor, jXj is the vol-
0ðijÞ
lots of unit cells, the computational cost is extremely high. To ume of the unit cell, epq are prescribed macroscopic strain fields,
reduce the complexity of simulation, homogenization methods ðijÞ
while the locally varying strain fields epq are defined as
can be used to compute the macroscopic cellular material proper-
ties. Homogenization refers to a method that can replace the com- 1 ij
posite with an equivalent material model in order to resolve the eðijÞ ð ij Þ ¼
pq ¼ epq X X p;q þ X ijq;p (2)
2
difficulty in the analysis of boundary value problem with high het-
erogeneities [6]. In this method, the local problem is solved to where X kl is the displacement fields which can be found by solv-
obtain the homogenized material property based on unit cell. ing the following equation:
Then the overall problem is computed by assigning a solid mate- ð ð
rial with the homogenized property to substitute the periodic
structure. Eijpq eij ðvÞepq ðX kl ÞdX ¼ Eijpq eij ðvÞepq
0ðklÞ
dV 8v 2 X (3)
X X
Asymptotic homogenization has been widely used to character-
ize the mechanical properties of cellular materials for several where v is a virtual displacement field. The code provided in Ref.
[12] can solve Eq. (3) and computes the homogenized elasticity
tensor for a 2D composite material. It can also be used to solve
1
Corresponding author. 2D cellular material by assigning an extremely soft second
Contributed by the Materials Division of ASME for publication in the JOURNAL OF material.
ENGINEERING MATERIALS AND TECHNOLOGY. Manuscript received October 25, 2017;
final manuscript received May 24, 2018; published online July 10, 2018. Assoc. However, as AM has greatly relieved the manufacturing con-
Editor: Toshio Nakamura. straints in the fabrication of 3D cellular materials, the interest in
Journal of Engineering Materials and Technology JANUARY 2019, Vol. 141 / 011005-1
C 2019 by ASME
Copyright V
Fig. 2 An example of the voxel model of a lattice structure with cubic topology: (a) perspective view, (b) top view
of each layers, and (c) 3D logical matrix
Fig. 3 Two cases when calculating the minimum distance from voxel center to the line seg-
ment of lattice wireframe
which specifies whether a finite element contains materials n, g, and l. These coordinates are also shown in Fig. 5. The shape
(voxele ¼ 1) or not (voxele ¼ 0). This matrix can be obtained by function can be summarized as
the method proposed in Sec. 2. It requires the finite elements with
materials to be connected. If they are not connected, a two- 1
Nie ¼ ð1 þ nni Þð1 þ ggi Þð1 þ lli Þ (4)
material model with a very soft second material should be used, 8
which will be introduced in Sec. 5.
where ni , gi , and li are the natural coordinates of the ith node.
The element stiffness matrix is given by the standard formula
3.1 Stiffness Matrix and Load Vectors of Hexahedron. The
type of element used in this homogenization is an eight-node hex- ð
ahedron element [13]. The local node number of hexahedron ele- KðeÞ ¼ BT CðeÞ BdXðeÞ (5)
ment is shown in Fig. 5. The natural coordinates for it are called XðeÞ
Journal of Engineering Materials and Technology JANUARY 2019, Vol. 141 / 011005-3
Similarly, the load vector f iðeÞ can also be split into two parts as
The split parts of element stiffness matrix and load vector are cal-
culated by calling the function “hexahedron,” which will output
kk , kl , f ik ; and f il .
simply activate lines 65–66 and deactivate lines 60–64. It should between the 2D and 3D problem is the number of constrained
be noted that when using PCG method, the matrix should be sym- degrees-of-freedom. The 2D problem only needs to constrain three
metric and positive definite. The global stiffness matrix satisfies degrees-of-freedom, while the 3D problem needs to constrain six
these requirements so that it can be efficiently solved by PCG degrees-of-freedom so that the element stiffness matrix is not singular.
method. To accelerate the speed of computation, only the degrees- Line 72 explains which degrees-of-freedom are constrained to calcu-
of-freedom of element with solid materials are activated in line late the elementary displacements. Because all the elements are equiv-
58. The void element without material properties will not be con- alent, the resulting displacements are the same for each element.
sidered in the computation. But this procedure requires these The next step is to use the element displacements and the global
active elements to be connected. displacement field to calculate the homogenized constitutive
To accelerate the convergence of PCG method, a proper pre- matrix CH . The entries in CH can be calculated by the following
conditioner should be obtained at first. The function “ichol” with equation:
only one input argument is used to construct an incomplete Cho- ð
1 X
lesky factorization with zero-fill. The output can be used as a pre- ðÞ ðiÞ 0ðjÞ ðjÞ
CHij ¼ vð0eÞi vðeÞ ÞT ke ðvðeÞ vðeÞ dXðeÞ (12)
conditioner in PCG method. Furthermore, the PCG method should jXj ðeÞ XðeÞ
specify the tolerance and the maximum number of iteration. If the
relative residual is less than the tolerance or if the number of itera- ðÞ
tion exceeds the maximum value, the PCG method will stop and where vð0eÞi is the element displacements corresponding to the ith
return a result with the minimum relative residual. In this paper, ðiÞ
unit strain in Eq. (10). vðeÞ is the displacement field obtained from
the default tolerance is 1010 , and the maximum number of itera-
the global stiffness equation. X is the total volume of the unit cell
tion is 300. These two parameters can be adjusted by users. For
of the lattice structure. The summation is computed in lines
instance, a lower tolerance and a larger number of iteration will
85–96. The k part and l part are computed separately, and these
return a more accurate result, but it takes more time to run the
PCG method. In lines 61–64, PCG is run six times to get the dis- two parts are multiplied with kðeÞ and lðeÞ . Then, the result for all
placement field under six loading conditions. the elements is summed together to get CH ij . After the iteration for
all six unit strains, the 6 6 homogenized constitutive matrix CH
is obtained.
3.5 Homogenization. The homogenization procedure is similar
to the procedure for 2D problems proposed by Andreassen and 4 Results and Discussion
Andreasen [12]. First, the element displacements corresponding to
unit strain cases are found in lines 69–82. Elements’ nodal displace- 4.1 Homogenized Constitutive Matrix. In this section, an
ment is solved under the uniform strains in Eq. (3). The difference example is used to illustrate how to use the proposed method to
Table 1 The comparison between the PCG method and the direct method
Resolution Topology Relative density (%) Memory (MB) Time (s) Memory (MB) Time (s)
Journal of Engineering Materials and Technology JANUARY 2019, Vol. 141 / 011005-5
modulus is selected to represent the result. The bulk material Nevertheless, the incomplete Cholesky with threshold dropping
property is also the same as in Sec. 4.1. The homogenized consti- (ICT) can perform better convergence than zero-fill. A non-
tutive matrix is computed for two relative densities: 10% and negative scalar is used as a drop tolerance when performing ICT.
30%. The result is shown in Fig. 11. It can be found that when the Elements which are smaller in magnitude than a local drop toler-
number of voxels reaches to 100, the result has a trend to con- ance are dropped from the resulting factor except for the diagonal
verge. However, because the computational cost is quite large element which is never dropped. However, incomplete Cholesky
when the resolution is 100, there is no need to set such a high factorizations of positive definite matrices do not always exist.
resolution if high accuracy is not the primary goal of simulation. Sometimes nonpositive will be encountered when constructing an
A resolution around 50 can already give an indicative result. But incomplete Cholesky preconditioner. To solve this problem, the
if a high accuracy is required, 100 resolution is recommended. “diagcomp” option is used to construct a shifted incomplete Cho-
lesky factorization. That is, instead of constructing L such that
5 Extension L*L0 approximates A, incomplete Cholesky factorization with
diagonal compensation constructs L such that L L0 approxi-
5.1 Shifted Incomplete Cholesky Factorization. To further mates M ¼ A þ alpha diagðdiagðAÞÞ without explicitly forming
accelerate the convergence of the PCG method, the shifted incom- M. As incomplete factorizations always exist for diagonally
plete Cholesky factorization with threshold dropping can be used dominant matrices, alpha can be found to make M diagonally
to modify the preconditioner. The default preconditioner in this dominant. These can be done by substituting line 61 in the
code is an incomplete Cholesky factorization with zero-fill. Appendix with the following lines:
Fig. 8 Effective Young’s modulus of lattice structures with 10% relative density
Journal of Engineering Materials and Technology JANUARY 2019, Vol. 141 / 011005-7
Fig. 10 Effective Young’s modulus of lattice structures with 50% relative density
Fig. 11 The relationship between the resolution of the voxel and the axial Young’s
modulus
Material k l
1 170:8 117:8
2 80:8 55:7
3 115:4 79:6
Journal of Engineering Materials and Technology JANUARY 2019, Vol. 141 / 011005-9
Journal of Engineering Materials and Technology JANUARY 2019, Vol. 141 / 011005-11