- edited description
dubious mesh quality
I'm playing around with mshr and started with creating an ordinary ball,
import dolfin
from mshr import *
import meshio
ball = Sphere(dolfin.Point(0, 0, 0), 1.0)
m = generate_mesh(ball, 100, "cgal")
meshio.write('test.e', m.coordinates(), {'tetra': m.cells()})
(for some reason named Sphere
in mshr).
The level of refinement is quite high, but what I'm getting is
It appears as if a rough mesh is created once and then refined without taking the original geometry into account.
Comments (6)
-
reporter -
You are right, mshr does this by triangulating the csg primitives, then evaluate the boolean operations to obtain an explicit surface description, then remeshing the surface and finally meshing the volume. The initial triangulation of the primitive is not fine enough in this case.
The solution is to take the meshing criteria into account when triangulating the primitives, but this requires some work. I will be working on subdomain support in 3D the coming weeks and hope to also fix this as part of the effort. In the meantime there is an easy workaround: There is an optional third argument to the constructor of Sphere which controls how fine the triangulation will be. Increase this sufficiently, try eg. with 15:
ball = Sphere(dolfin.Point(0, 0, 0), 1.0, 15)
PS: Is
Sphere
not a good name for the primitive? -
I expect that @nschloe's point on the name 'sphere' is something that has come up before; the object is a polyhedron rather than a sphere, and it doesn't approach a sphere upon refinement.
-
reporter With
15
I'm still getting100
is betterIs
Sphere
not a good name for the primitive?Well, a sphere is the surface of a ball, so I kind of expected to get a shell mesh at first. Renaming the geometry to
Ball
or the mesh generation togenerate_volume_mesh
(whatever is more appropriate) would clear this up, but this is really a nitpick. -
Ah, I agree, that is inconsistent. The name was taken from the old UnitSphereMesh in Dolfin, but that also seems inconsistent (since it generated a volume mesh). So lets add a
generate_volume_mesh()
and keepgenerate_mesh()
for backward compatability. (At a later point I would like to add agenerate_surface_mesh()
also).@garth-wells : The object is a sphere (it is represented as a center point and a radius). The problem is that when the mesh generator is invoked, the conversion to polyhedron does not take the requested mesh resolution into account. I will fix that soon.
-
reporter - changed status to duplicate
Duplicate of #26.
- Log in to comment