Some questions about creating mesh on fenics

Hi, all, I’m working on the mesh with fenics. My mesh is that :

from fenics import *
import numpy as np
import matplotlib.pyplot as plt
from mshr import *
#fluid and structure mesh
domain1 = Rectangle(Point(0.0, 0.0), Point(6.0, 1.0))
domain2 = Rectangle(Point(2.95, 0.0), Point(3.05, 0.75))
mesh_f = generate_mesh(domain1 - domain2, 200)

The mesh_f is a big rectangle subtracting a small rectangle. I only want to refine the mesh_f on the inner boundary. Can i create mesh from boundary and assign the number of mesh points on every edges?
For example, I want to create a circle mesh which left semicircle boundary have 10 points and the right semicircle boundary have 20 points. Does fenics create this mesh?

Another question: is there a complete example showing how to import .msh files (from gmsh) on fenics and fenicsx ?

Thank you!

Im not sure if mshr can do this. Note that mshr has also been deprecated and not updated for 3 years, and the last actual update of functionality is 5-6 years ago (Bitbucket).

There are tons of examples on this forum, for instance: Error while importing gmsh mesh - #4 by dokken from earlier today.

I’ve also published several tutorials on the subject:
https://jsdokken.com/dolfinx-tutorial/chapter3/subdomains.html#read-in-msh-files-with-dolfinx

1 Like