Example C-7: Gyroid TPMS

In this example, a part is created based on the Gyroid TPMS, and is then exported.

Normally, this operation would be complicated, but the tpms module has a number of classes that define some of the more popular TPMS functions. For an explanation of the TPMS predefined structures, refer to Triply Periodic Minimal Surfaces.

First, a 3D part with a shape of 50×50×50 voxels is created with a base material of 0 (empty space) and a voxel size of 0.02 units in all directions. The parameter log_debug is set to True for demonstration purposes.

Then a Boolean mask is created based on the voxel part using the TpmsSchwarzG class. Unit cell length (l) is set to half of the part’s real size and the constant (c) is set to zero:

t = part.real_size[0] / 2
tpms_mask = mask_from_function(part=part, func=TpmsSchwarzG, l=t, c=0)

Afterwards, the Boolean mask is applied to the part with a value of 1. This means that the values of the elements selected by the mask are set to 1, making them the only non-empty elements in the model:

part.apply_mask(mask=tpms_mask, value=1)

Finally, the part is exported to an Abaqus™ input file in 3D mode with C3D8R elements. The Non-Empty elements are requested to be exported.

The code can be found in the examples folder of the main repository. It is also included below:

"""Script for Example C-7: Gyroid TPMS."""

from vcams.mask.function import mask_from_function
from vcams.mask.tpms import TpmsSchwarzG
from vcams.voxelpart import VoxelPart

# Create the part.
part = VoxelPart(size=(50, 50, 50), base_material=0, voxel_size=(0.02, 0.02, 0.02), name='Ex C-7 TPMS Gyroid',
                 description='Example C-7: A 50*50*50 porous part based on the Gyroid TPMS.', log_debug=True)

# Create a Boolean mask based on the VoxelPart object.
# Note that you can pass the TpmsSchwarzG class instead of TpmsSchwarzG.func().
t = part.real_size[0] / 2
tpms_mask = mask_from_function(part=part, func=TpmsSchwarzG, l=t, c=0)

# Apply the Boolean mask to the part.
part.apply_mask(mask=tpms_mask, value=1)

# Output the part.
part.output_abaqus_inp(file_name='ex_c7_tpms_gyroid',
                       elem_code='C3D8R', dim='3D',
                       material_elem_sets='Non-Empty')

The final model looks like Fig. 22. Note that the stepping visible in the part is due to the low resolution of the model. A bigger model will result in a better shape.

A part created based on the Gyroid TPMS.

Fig. 22 A part created based on the Gyroid TPMS.