# DMPlexCreateTPSMesh#

Create a distributed, interpolated mesh of a triply-periodic surface

## Synopsis#

```
#include "petscdmplex.h"
#include "petscdmplex.h"
PetscErrorCode DMPlexCreateTPSMesh(MPI_Comm comm, DMPlexTPSType tpstype, const PetscInt extent[], const DMBoundaryType periodic[], PetscBool tps_distribute, PetscInt refinements, PetscInt layers, PetscReal thickness, DM *dm)
```

Collective

## Input Parameters#

The communicator for the**comm -**`DM`

objectType of triply-periodic surface**tpstype -**Array of length 3 containing number of periods in each direction**extent -**array of length 3 with periodicity, or**periodic -**`NULL`

for non-periodicDistribute 2D manifold mesh prior to refinement and extrusion (more scalable)**tps_distribute -**Number of factor-of-2 refinements of 2D manifold mesh**refinements -**Number of cell layers extruded in normal direction**layers -**Thickness in normal direction**thickness -**

## Output Parameter#

The**dm -**`DM`

object

## Notes#

This meshes the surface of the Schwarz P or Gyroid surfaces. Schwarz P is the simplest member of the triply-periodic minimal surfaces. https://en.wikipedia.org/wiki/Schwarz_minimal_surface#Schwarz_P_(“Primitive”) and can be cut with “clean” boundaries. The Gyroid https://en.wikipedia.org/wiki/Gyroid is another triply-periodic minimal surface with applications in additive manufacturing; it is much more difficult to “cut” since there are no planes of symmetry. Our implementation creates a very coarse mesh of the surface and refines (by 4-way splitting) as many times as requested. On each refinement, all vertices are projected to their nearest point on the surface. This projection could readily be extended to related surfaces.

See [MSA+18]

The face (edge) sets for the Schwarz P surface are numbered \(1(-x), 2(+x), 3(-y), 4(+y), 5(-z), 6(+z)\).
When the mesh is refined, “Face Sets” contain the new vertices (created during refinement).
Use `DMPlexLabelComplete()`

to propagate to coarse-level vertices.

## Developer Notes#

The Gyroid mesh does not currently mark boundary sets.

## References#

- MSA+18
Ian Maskery, Logan Sturm, Adedeji O Aremu, Ajit Panesar, Christopher B Williams, Christopher J Tuck, Ricky D Wildman, Ian A Ashcroft, and Richard JM Hague. Insights into the mechanical properties of several triply periodic minimal surface lattice structures made by polymer additive manufacturing.

*Polymer*, 152:62–71, 2018.

## See Also#

DMPlex: Unstructured Grids, `DM`

, `DMPLEX`

, `DMPlexCreateSphereMesh()`

, `DMSetType()`

, `DMCreate()`

## Level#

beginner

## Location#

## Examples#

## Implementations#

DMPlexCreateTPSMesh_Internal() in src/dm/impls/plex/plexcreate.c

Index of all DMPlex routines

Table of Contents for all manual pages

Index of all manual pages