Hello,

I defined the mesh with Gmsh in this way:

from mpi4py import MPI

import gmsh

gmsh.initialize()

gmsh.model.add(“single_triangle”)

large_mesh_size = 2

corner1 = gmsh.model.occ.addPoint(0, 0, 0, large_mesh_size)

corner2 = gmsh.model.occ.addPoint(1, 0, 0, large_mesh_size)

corner3 = gmsh.model.occ.addPoint(0, 1, 0, large_mesh_size)

line1 = gmsh.model.occ.addLine(corner1, corner2)

line2 = gmsh.model.occ.addLine(corner2, corner3)

line3 = gmsh.model.occ.addLine(corner3, corner1)

loop = gmsh.model.occ.addCurveLoop([line1, line2, line3])

surface = gmsh.model.occ.addPlaneSurface([loop])

gmsh.model.occ.synchronize()

gmsh.model.addPhysicalGroup(2, [surface], 1)

gmsh.model.setPhysicalName(2, 1, “TriangleSurface”)

gmsh.option.setNumber(“Mesh.Algorithm”, 1)

gmsh.option.setNumber(“Mesh.Algorithm3D”, 1)

gmsh.option.setNumber(“Mesh.MeshSizeMin”, large_mesh_size)

gmsh.option.setNumber(“Mesh.MeshSizeMax”, large_mesh_size)

gmsh.model.mesh.generate(2)

if MPI.COMM_WORLD.rank == 0:

gmsh.write(“single_triangle.msh”)

gmsh.finalize()

I want to refine the mesh by connecting the midpoints of the edges of this mesh (creating new triangles by combining the midpoints of the triangle, 4 triangles in total, barycenteric subdivision). So, for example, I have 4 new triangles for one level.

I want to repeat the same process for each new triangle and make a subdivision at the level I want. I want to keep the coarser and finer meshes and extract information about which finer triangles belong to which coarser triangles. I tried many times for this, but I could not do it completely. I’m new to Fenicsx, I would be very happy if you could help me. I am usig Dolfinx 0.8.0 and new Fenicsx.

Thank you,