Periodic conditions 3D gmsh

Good day! I have tube channel:


I import my mesh from gmsh.

import numpy as np
import meshio
msh = meshio.read("gmsh/3D_channel.msh")
def create_mesh(mesh, cell_type, prune_z=False):
    cells = mesh.get_cells_type(cell_type)
    cell_data = mesh.get_cell_data("gmsh:physical", cell_type)
    out_mesh = meshio.Mesh(points=mesh.points, cells={cell_type: cells}, cell_data={"name_to_read":[cell_data]})
    if prune_z:
        out_mesh.prune_z_0()
    return out_mesh

tetra_mesh = create_mesh(msh, "tetra", prune_z=True)
meshio.write("mesh.xdmf", tetra_mesh)

triangle_mesh = create_mesh(msh, "triangle", prune_z=True)
meshio.write("facet_mesh.xdmf", triangle_mesh)

from dolfin import * 

mesh = Mesh()
with XDMFFile("mesh.xdmf") as infile:
    infile.read(mesh)

V = VectorFunctionSpace(mesh, 'P', 2)
Q = FunctionSpace(mesh, 'P', 1)

dim = mesh.topology().dim()
print('Dim:',dim)

mvc = MeshValueCollection("size_t", mesh, dim-1) 
with XDMFFile("facet_mesh.xdmf") as infile:
    infile.read(mvc, "name_to_read")
facet_domains = cpp.mesh.MeshFunctionSizet(mesh, mvc)

How i can realize periodic conditions wia facet_domains ? Numbers domains for periodic contitions are 6 and 7. Thanks for you answer.

In dolfin, you need to be able to describe the mapping geometrically, as shown in: Bitbucket

In dolfinx, I have made a package that relies on MeshTags (an integer marking one boundary, as obtained from GMSH) and a geometrical mapping (mapping to the other surface): dolfinx_mpc/demo_periodic3d.py at master · jorgensd/dolfinx_mpc · GitHub.

1 Like