Generating mesh on unit sphere by specifying the maximum element size


246
views
0
10 months ago by

Hi all, 

I am new to fenics. Is it possible to generate the mesh on unit sphere by specifying the maximum element size rather no-of divisons ?

Community: FEniCS Project

2 Answers


3
10 months ago by
In the FEniCS tutorial, you can find for the unit disk that "The cell size will be (approximately) equal to the diameter of the domain divided by the resolution" (Sec. 2.4.2 Defining the mesh). For the unit sphere, something like this seems to work:
from fenics import Point, mesh
from mshr import Sphere, generate_mesh

cell_size = 0.33
radius = 1.0
resolution = 4*radius/cell_size
sphere = Sphere(Point(0.0, 0.0, 0.0), radius)

mesh = generate_mesh(sphere, resolution)
print(mesh.hmax())
0
10 months ago by
Thanks for the quick response Adam.
You are welcome. Adam
written 10 months ago by Adam Janecka  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »