The finite element method (FEM) is commonly employed to solve the governing equations of various physics problems in the context of numerical homogenization. Imaging techniques, such as micro-computed tomography, are used to obtain digital models of the microscale of real samples, which generates a demand for pixel and voxel-based solutions. As image resolution and/or dimension increases, the memory allocation due to the characteristic finite element global matrix, even in sparse format, quickly becomes unfeasible, making it harder to fully explore state-of-the-art imaging resources. Assembly-free strategies are based on the premise of never storing the global matrix, working with local element matrices instead, which considerably reduces memory usage, but increases computational cost. Hence, optimized implementation approaches are sought out to reduce runtime. This paper presents a memory-efficient assembly-free FEM solver for the numerical homogenization of thermal conductivity and elasticity, of 2D and 3D image-based models, implemented entirely in MATLAB, exploring its vectorization paradigm. The proposed vectorized solver performs significantly better than a sequential element-by-element implementation. The preconditioned conjugate gradient (PCG) method is used to solve the linear systems of algebraic equations. Concise script code to perform key steps of the vectorized homogenization is exposed. The resulting program, called vhifem, is validated with an analytical benchmark and is compared with an educational program. Performance metrics are presented, making evident the trade-off between time and allocated memory. At last, a model of a cast iron sample with up to 81 million degrees-of-freedom is analyzed with a personal computer, allocating about 4 GB. This would be impossible without the assembly-free strategy.
展开▼