So, apperantly mshr is on its way out. So, how to generate a surface mesh of triangles in either pymesh or gmsh and more specifically, how do I get it into fenics?
And furhtermore, what is wrong with this code, why does it not work?
N=6
sphere=Sphere(Point(0,0,0,1)
mesh=generate_mesh(sphere,N)
surface=BoundaryMesh(mesh,“exterior”)
V=FunctionSpace(surface,‘P’,1)
Y=Expression('3sqrt(10)(x[0]x[0]-x[1]x[1])(7[x[2][x[2]-1)’,degree=2)
u_n=project(Y,V)
u=TrialFunction(V)
v=TrialFunction(V)
a=inner(grad(u),grad(v))dx
u=Function(V)
L=u_nvdx
solve(a==L,u)
Is there something wrong with how I define forms on my surface?
Oh, my bad, of course I mean that mshr still works, it is just that it is on its way out (according to my “sources”). More problmatic is that I cannot control the mesh size. What if I want to mesh a sphere with like 4 triangles? (Which is stupid, I know that, but I want to be able to control what’s going on)
but how do I control how fine the mesh is and the “h”, that is to say the largest size of the triangle? And furthermore, how do I take that and write it as a mesh that I can use in FEniCS?
yes, I try to do that, but I get the error:
“AttributeError: ‘numpy.ndarray’ object has no attribute ‘items’”
running the above code, regardless if I write mesh created by meshio with write or if I try to write the cells with point and triangles.