There are plenty of examples across this forum. Consider for instance:
or
Gmsh also has a large range of tutorials:
or my tutorial using pygmsh https://jsdokken.com/converted_files/tutorial_pygmsh.html#second