How to create a custom mesh domain?

I am trying to write a problem with an L shape domain. I cannot seem to figure out how to make a custom domain.

I had found:

but the MeshEditor doesn’t appear in dolfinx, unfortunately.

I see in the documentation dolfinx.mesh.create_mesh

But I cannot find a reasonable example

the arguments include:

  • cells – Cells of the mesh
  • x – Mesh geometry (‘node’ coordinates), with shape (gdim, num_nodes)
  • domain – UFL mesh

I don’t understand the point of the UFL mesh here.

In:

There is some answer, and it makes sense that x now is the set of vertices and cells are which of these connects to which, but the statement:

domain = ufl.Mesh(ufl.VectorElement("Lagrange", cell, degree))

doesn’t make sense, why would a Vector space have anything to do with the mesh? I intend to use mixed elements, so will define multiple vector spaces over the mesh, so I certainly wouldn’t want there to be any a priori requirements on the vector space

If someone could point me to some code example in dolfinx that generates a custom mesh, that would be great, thank you!

A mesh is defined with a finite element because a mesh can consist of non-affine cells (higher order triangles/tets with curved edges, or quad/hex elements). Thus you need a set of basis functions mapping from the reference element to the physical element (to for instance compute jacobians in integrals).

The vector space used in the mesh initialization does not limit what function spaces one can use in variational problems.

A trivial one cell example is recently posted: Computing element-wise spatial derivatives of the solution - #4 by dokken

OK, thank you for the explanation and reference.