On the Development of an Open-Source Toolbox for the Structural Analysis of Composite Materials

Commonly used in structural applications since the ’90s, composite materials represent a valid alternative to metallic solutions. An intense research activity accompanied the spread of this technology to the point that, nowadays, a large variety of modeling techniques and tools are at the designers’ disposal. Although the literature on this topic is vast, detailed, and thorough, the need for new, faster, and more efficient design tools and methodologies remains. In this context, this work covers the development of an Open-Source computational laminate analysis toolbox, its structure, and its validation. The objective of the research was the creation of a simple and accessible mean for the calculation of laminates’ stresses in complex structural components with a reduced computational cost. To this end, the authors implemented the basics of micro, meso, and micromechanics in a Python-based toolbox and then performed a validation campaign against the results of an FE analysis. The work resulted in an input-generation/output-analysis instrument to be used by designers alongside the FEA.


Introduction
Widely used in structural and non-structural applications, composite materials represent a valid alternative to the standard metallic solution.Indeed, the high stiffness-to-mass ratio (when compared to metallic materials), and, most importantly, the possibility to design the directional material properties allowed the spread of the technology in almost all engineering fields.Despite these benefits, the solution comes with new challenges and issues.Although most of the abovecited problems relate to the manufacturing process, the possibility of designing the material mechanical properties is simultaneously an advantage and a drawback.Certainly, if on one hand the resulting component's mechanical properties are optimized for specific loading conditions, on the other the design process has to include the new and non-trivial material design phase, thus leading to increased workloads and the project intricacy.
The authors have grown acquainted with the problem's complexity in the last two years through the collaboration with the Italian National Institute of Nuclear Physics (INFN) concerning the design of composite-based structures for space-borne particle physics experiments [1], [2], [3] .The former project presented the group with the composite design challenge and the associated issues.And on the experience gained during the design process, the toolbox was conceived and developed.
To pursue accessibility and outreach, the development took place in the Python [4], [5], [6] environment.  2 The toolbox Being the project mentioned in section 1 one of the first research group's approaches to the composite topic, the authors started from the basics [7], [8], [9], [10], [11], [12], [13] and put together a simple but effective toolbox.Two different parts compose the toolbox: the lamina class implementing the micro-mechanics and the laminate class implementing the meso and macro mechanics.Although either toolset is independent of the other, the outputs from the first can be inputs for the second, thus allowing the definition of a laminate whose lamina properties are not provided by the user but inherited from another Python class.
In literature, the study of composite materials splits into three scales: the micro-scale, the mesoscale, and the macro-scale.The first concerns the material's constituents and deals with them as merged but distinct entities, the second works with homogeneous composite materials laminae (making no distinction between the components), and the third deals with the materials and the structures as a whole without differentiating between constituents and layers.Concerning figure 1, consider a laminated wind turbine blade: analyzing the object micro-mechanically would mean studying the interaction between the fiber and the matrix of the constituents' laminae; instead, the meso-mechanics would concern the stresses and deformations of the single laminae in their reference system; closing with macro-mechanics which deals with the overall laminate with flexural and tensional stiffness matrix associating the punctual deformation with the stress resultants.Due to the close relation between the laminate deformation and the stress in the lamine (often regarded as "ply-by-ply stress state") meso and macro mechanics are entangled, whereas micro-mechanics can be treated as a separate topic, hence the split in the toolbox.
As previously stated, micro-mechanics starts from the material's constituents, their properties, and their relative proportions to extrapolate equivalent composite properties.As a whole, the code requires inputs on the fiber and matrix to compute the lamina's mechanical properties.The laminate tools start from the ply attributes (which can be either external or derived with the former tools) and the stack-up definition to compute properties as the stiffness matrices (A, B, D, and H) or the laminate equivalent orthotropic material constants.In addition, the code allows the computation of the ply-by-ply stress state under a given set of actions (N, M, V).Lastly, the code can detect First Ply Failure and compute safety factors according to the 3 Tsai-Wu, max stress, or max strain criteria.
3 The code structure Before moving on to the toolbox applications and validation let us spend some words on the rationale behind the coding.The code follows the Python Enhancement Programming (PEP) 8 [14] format and exploits various Python packages like Numpy [15], [16] and SciPy [17], [18] .The code uses class properties to store the majority of the computed outputs, including the list of dictionaries containing the plies characteristic.Additionally, the exploitment of methods (either internal or user accessible) allows the performance of the requested operations.The usage of class methods is interesting from a code flexibility point of view: more of those can be added to the class, thus introducing new functionalities or new formulations can be added to perform the same calculation (e.g. the computation of lamina properties can be performed with different criteria, with this structure it is easy to add new theories to the existing methods and switch between those).The code is currently available on GitHub and PyPi at the following addresses: • GitHub: https://github.com/edo-147/PyComps• PyPi: https://pypi.org/project/PyComps/

Possible applications
The application of such general tools can be multiple.Given the impossibility of covering every usage, the present section deals with the authors' application of the code.
The most obvious and common usage for the code is the calculation of equivalent properties at all scales.As an example, meso-scale properties (ply properties) are a required input for mesoscale FE composite analysis, in the same way as equivalent laminate mechanical properties are for macro-scale ones.
In more sophisticated applications, the toolbox carries on a part of the analysis.Starting from the FEA stress resultants in a specific point as input to a Python routine to perform a preliminary laminate ranking.Specifically, refer to the workflow schematized in figure 2: the design of composite components often exploits the black metal approach where the design starts with a preliminary simulation of isotropic components from which it is possible to identify critical areas and load paths, and which precedes the stack-up ranking and choice, and the final simulation.Computationally wise, the most critical step of the process is the stack-up ranking, a design phase where several different laminae configurations have to be weighed against each other to define the best material solution.If the designer performs this trade-off using only the FE method the computational cost could be high.Instead, the ranking can be performed in Python considering only critical areas and thus evaluating different stack-ups on specific points.Being the stress-resultants the only input needed to perform this analysis, the output from the first simulation(isotropic material) is sufficient to complete the raking.Additionally, if more accurate results are sought the user could perform parametric analysis using an equivalent material formulation and getting the FE input from the Python code, thus switching from a mesoscopic to a macroscopic (less accurate but cheaper) FE model.

Validation
Although there was a relevant effort in making the toolbox as general as possible, the authors mainly employed it alongside the FEA.Given the former, it is easy to understand the choice of taking the commercial tool as the validation reference.
As previously stated, the code is divided into two parts, and so it is the validation.In detail, the authors set up two different models in the commercial FE software ANSYS ® : one to validate the micromechanical aspects and developed in the Material Design environment, and another for the meso and micromechanical aspects implemented in the Mechanical and ACP environment.

Micromechanics validation
Again, ANSYS ® Material Designer module is the reference for the micromechanics validation.The commercial toolbox's purpose is the calculation of the mechanical properties of a general (in terms of geometry and materials) Representative Volume Element (RVE).Typical Material Designer applications are sandwich cells, trabecular structures, and composite laminae.The preliminary validation of PyComps considered a unidirectional long-fiber Carbon/Epoxy composite RVE (figure 3).The RVE calculated equivalent properties were then compared with the one from a PyComps analysis with similar inputs.Results, presented in table 1, show good agreement.

Meso/macromechanics validation
Similarly, the PyComps laminate's features were validated.In this case, the reference is an FE model of a composite beam, modeled as a surface (shell elements) and with an imposed lamination (operation performed within the ACP environment).The beam, shown in figure 4  of equivalent properties is performed in PyComps as well, and the delta between the results is presented in table 2. Finally, using the extracted stress resultants on a given FE element, it was possible to compare the PyComps' and the FE's ply-by-ply stress state.For the sake of clarity, the authors propose both a visual result representation (figure 5) and a tabular one (table 3).

Conclusions
The presented document briefly describes the work done by the machine design group of the University of Perugia on an Open Source composite structural analysis toolbox.The code follows the PEP-8 and the Object-Oriented Programming approach.A validated version of the code is available on two of the most common Python open-source sharing platforms: GitHub [19] and PyPi [20] .The toolbox generates lamina and laminate objects from two different classes and uses class attributes to store mechanical and physical properties.Although the possible applications   are various, the authors briefly dwelt on the toolbox-FEA interactions, input provision, and cosimulation.Finally, the present document describes the preliminary validation of said toolbox, performed against commercial FE software.The validation results show good agreement and justify the code release on free-access platforms.

Figure 2 :
Figure 2: Work-flow of a possible tool application.

Figure 3 :
Figure 3: Reference model for the micromechanics validation.

Table 1 :
Micromechanics.RVE equivalent properties calculation.Commercial SW vs. toolbox.one extremity and loaded with an oblique load on the other.Additionally, the FE computes equivalent composite properties (those of a homogeneous material behaving as the laminated) and provides the stress resultants in a point of the structure.The computation

Table 3 :
Error committed by the toolbox on the stress calculation in different plies.Ply no. and FEA element err.σ x err.σ y err.σ xy