lqh911 / TPMSgen

Triply Periodic Minimal Surfaces Generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TPMSgen

Triply Periodic Minimal Surfaces, also known as TPMS, are a class of mathematical surfaces that are periodic in all three spatial dimensions. They are known for their unique geometric properties, such as a lack of local extrema and a high degree of symmetry. These surfaces have a wide range of applications, including in architecture, engineering, and materials science. They have been studied extensively by mathematicians and have been found to have many interesting properties, such as the existence of an infinite number of distinct TPMS. They are also related to other mathematical structures such as soap films, minimal surfaces, and constant mean curvature surfaces.

TPMSgen is a powerful program based on Python that allows users to easily design and generate Triply Periodic Minimal Surface (TPMS) geometries. It features a user-friendly interface with multiple design parameters (TPMS typology, specimen dimensions, unit cell size…) that makes it simple to generate their corresponding 3D model employing their mathematical equations. In addition, the program offers the possibility to export the 3D model in the .STL file format, which can be later used for fabrication with additive manufacturing technologies or in finite element simulation studies. This makes TPMSgen a versatile tool for architects, engineers, and material scientists who are interested in exploring the unique properties of TPMS and their potential applications.

TPMSgen


Built-in TPMS designs

The current library of TPMSgen features a total of 10 distinct TPMS typologies, including 5 skeletal and 5 shell morphologies. These typologies provide users with a wide range of options for designing and exploring different TPMS geometries, and the ability to choose between skeletal and shell structures allows for even greater flexibility in their designs.

Shell-TPMS Unit Cell Designs Skeletal-TPMS Unit Cell Designs
Gyroid Schoen Gyroid
Diamond Schwarz Diamond
Lidinoid Schwarz Primitive (pinched)
Split-P Schwarz Primitive
Schwarz Body Diagonals with Nodes

Equations of Shell-TPMS designs:

a) Gyroid:

$\sin(x) \cdot \cos(y) + \sin(y) \cdot \cos(z) + \sin(z) \cdot \cos(x) = 0$

b) Diamond

$\sin(x) \cdot \sin(y) \cdot \sin(z) + \sin(x) \cdot \cos(y) \cdot \cos(z) + \cos(x) \cdot \sin(y) \cdot \cos(z) + \cos(x) \cdot \cos(y) \cdot \sin(z) = 0$

c) Lidinoid:

$\sin(2x) \cdot \cos(y) \cdot \sin(z) + \sin(x) \cdot \sin(2y) \cdot \cos(z) + \cos(x) \cdot \sin(y) \cdot \sin(2z) -$ $\quad - \cos(2x) \cdot \cos(2y) - \cos(2y) \cdot \cos(2z) - \cos(2z) \cdot \cos(2x) + 0.3 = 0$

d) Split-P:

$1.1 \cdot \left[ \sin(2x) \cdot \cos(y) \cdot \sin(z) + \sin(x) \cdot \sin(2y) \cdot \cos(z) + \cos(x) \cdot \sin(y) \cdot \sin(2z) \right] - $ $\quad - 0.2 \cdot \left[ \cos(2x) \cdot \cos(2y) + \cos(2y) \cdot \cos(2z) + \cos(2z) \cdot \cos(2x) \right] - 0.4 \cdot \left[ \cos(2x) + \cos(2y) + \cos(2z) \right] = 0$

e) Schwarz:

$\cos(x) + \cos(y) + \cos(z) = 0$

Equations of Skeletal-TPMS desgins:

f) Schoen Gyroid:

$\sin(x) \cdot \cos(y) + \sin(y) \cdot \cos(z) + \sin(z) \cdot \cos(x) - C = 0$

g) Schwarz Diamond:

$\cos(x) \cdot \cos(y) \cdot \cos(z) + \sin(x) \cdot \sin(y) \cdot \sin(z) - C = 0$

h) Schwarz Primitive (pinched):

$\cos(x) + \cos(y) + \cos(z) - C = 0$

i) Schwarz Primitive:

$\cos(x) + \cos(y) + \cos(z) - C = 0$

j) Body Diagonals with Nodes:

$2 \cdot \left[ \cos(x) \cdot \cos(y) + \cos(y) \cdot \cos(z) + \cos(z) \cdot \cos(x) \right] - \left[ \cos(2x) + \cos(2y) + \cos(2z) \right] - C = 0$


Quick Start

A standalone release v1.0.0 has already been published and it is the simpliest way to execute the TPMSgen application.

  • Operating Systems:
    • Windows
    • MacOS
    • Linux
  • Hardware: 4GB of RAM or more

Some of the operations that TPMSgen employs to create the mesh of the desired TPMS designs also require that Blender (version 3.4.1+) software is installed in your computer. You can follow the available documentation for troubleshooting during its installation.


Run TPMSgen using local Python Interpreter

If the compiled files of the release do not work properly on your system of choice, you can solve it by running the GUI version or execute the CLI version of TPMSgen directly from your Python interpreter.

  • Python version: 3.9 or 3.10
  • Required libraries:
    • numpy
    • pyvista
    • scikit_image
    • skimage
    • trimesh
    • vtk
    • PyQt5 (only for GUI version)

Installing prerequisites for Python 3.9:

The requirements_python_3_9.txt file lists all the Python libraries that TPMSgen depends on. If needed, they can be easily installed by running the following code:

pip install -r requirements_python_3_9.txt

Installing prerequisites for Python 3.10:

The requirements_python_3_10.txt file lists all the Python libraries that TPMSgen depends on. If needed, they can be easily installed by running the following code:

pip install -r requirements_python_3_10.txt

Running TPMSgen application from terminal:

Once prerequisites have been installed, you can run the following code to open the GUI version of TPMSgen from your Python interpreter:

python TPMSgen_GUI.py

Furthermore, if your system does not satisfy some of the requisites to run that version of the code, you can always execute the CLI version of the application:

python TPMSgen_CLI.py

Interface preview / Help

Let's take a closer look at the user interface of TPMSgen through a series of screenshots. The following pictures will provide a visual representation of the program and the process to generate the mesh of the desired TPMS design and export it into .STL format. In particular, you will be able to see its layout, the different buttons and design parameters provided in the main menu, as well as the rest of the program's features.

Main menu:

This is the main menu of TPMSgen. Here, the user can easily select one of the 10 popular TPMS typologies included in its library. Then, the rest of the design parameters (C value -only for Skeletal designs- and thickness -only for Shell designs-, specimen dimensions, unit cell size, unit cell origin…) can be set. Moreover, the appropiate mesh density can be selected by modifying the unit cell mesh resolution parameter.

Main menu

Vertices generation:

When all the design parameters are properly set, the vertices of the sample can be generated by clicking on the Plot TPMS equation button. The following plot will be displayed, and the user can check the shape of the generated equation according to the choosen preferences.

Vertices

Face normals inspection:

When the desired shape is obtained, the normals' direction of the faces of the mesh must be carefully inspected in order to obtain a proper watertight .STL. To do so, click on the Check face normals button, and a new figure will appear. Depending on the typology of the choosen TPMS (Shell o Skeletal), check that the plotted normals are orientated according to the instructions that are displayed in the bottom-right corner of the main menu. If not, flip them by just by clicking on the Flip face normals button.

Face normals

Mesh preview:

After checking the orientation of the face nomals, it is now time to generate the final watertight mesh by clicking on the Generate mesh button. Depending on the selected design parameters, this process may take a few minutes. When the calculation finishes, the message in the bottom-right corner will be updated indicating the quality of the achieved mesh. If the process doesn't succeed in obtaining the expected watertight mesh, try increasing the unit cell mesh resolution value or flipping the face normals.

In all cases, the result can be plotted and exported into .STL file format by clicking on the View mesh and Export STL file buttons, respectivelly.

Mesh

Please, cite this pubication as such

To correctly cite the application it is necessary to refer to the Github repository and the paper.

A. Forés-Garriga, G. Gómez-Gras, and M. A. Pérez. Mechanical performance of additively manufactured three-dimensional lightweight cellular solids: experimental and numerical analysis, Materials & Design (2023) - Accepted 17th January 2023

@article{fores_2023,
	title = {Mechanical performance of additively manufactured three-dimensional lightweight cellular solids: experimental and numerical analysis.},
	doi = {},
	author = {A. For{\'{e}}s-Garriga, G. G{\'{o}}mez-Gras, P{\'{e}}rez, Marco A.},
	journal = {Materials & Design},
	year = {2023},
	note = { (Accepted 17th January 2023) }
}

A. Forés-Garriga, H. García de la Torre, R. Lado-Roigé, G. Gómez-Gras, and M. A. Pérez. Triply Periodic Minimal Surfaces Generator - TPMSgen, 2023. URL: https://github.com/albertforesg/TPMSgen.

@software{TPMSgen,
	author = {{A. For{\'{e}}s-Garriga, H. Garc{\'{i}}a de la Torre, R. Lado-Roig{\'{e}}, G. G{\'{o}}mez- Gras, and M. A. P{\'{e}}rez.}},
	title = {Triply Periodic Minimal Surfaces Generator - TPMSgen},
	url = {https://github.com/albertforesg/TPMSgen},
	version = {1.0},
	year = {2023},
}

Repository contributors

  • Albert Forés Garriga 1

  • Héctor García de la Torre 1

  • Ricard Lado Roigé 1

Acknowledgements

This work has been supported by the Ministry of Science, Innovation and Universities through the project New Developments in Lightweight Composite Sandwich Panels with 3D Printed Cores (3DPC) - RTI2018-099754-A-I00 and Development of Gyroid-Type Cellular Metallic Microstructures by FFF to Optimize Structural Components with High Added-Value (GRIM) - PID2021-123876OB-I00.

Footnotes

  1. Applied Mechanics and Advanced Manufactuing Research Group (GAM). IQS School of Engineering - Universitat Ramon llull (Barcelona, Spain) 2 3

About

Triply Periodic Minimal Surfaces Generator

License:MIT License


Languages

Language:Python 100.0%