Our adaptivity libraries fundamentally only deal with linear meshes (triangles in 2D or tets in 3D). However, for the mantle convection application we use cylindrical or spherical shell meshes with P2 coordinates to better approximate the curvature of the Earth - which is then a so called isoparametric mesh because we use P2 for velocity as well.
In principle, it's fairly straightforward to drop back to a linear mesh
VP1 = VectorFunctionSpace(mesh_p2, "CG", 1)
coordinates_p1 = Function(VP1, name="P1 coordinates").interpolate(mesh_p2.coordinates)
mesh_p1 = Mesh(coordinates_p1)
which simply subsamples the coordinates on the vertices. Then I can assemble the metric on that mesh_p1 mesh, call adapt as usual; I get back a new linear mesh from which I can construct a new P2 mesh as well
new_mesh_p1 = adapt(mesh_p1, metric_p1)
VP2 = VectorFunctionSpace(new_mesh_p1, "CG", 2)
new_mesh_p2 = Mesh(Function(VP2).interpolate(new_mesh.coordinates)
Because this interpolates from a linear coordinate field, the new P2 mesh is still actually flat, but I can then use a trick to pop back the edge nodes on the boundary to lie exactly on surface sphere/circle.
So that's all fine and well but I would need to assemble the metric on the linear mesh which is not optimal. It means I first have to interpolate the solution fields onto the linear mesh, and the Hessian calculations would also occur on the linear approximation of the sphere which would be less accurate. Instead what I want to do is assemble on the P2 mesh using all of animate's metric assembly functionality, like compute_hessian(), intersect(), normalise() etc. NOTE: the metric itself would still be in a linear function space, with just one tensor per vertex, it's just the geometry that has a more accurate description. For the various Hessian reconstructions, that should just work as currently written. I think all other functionality (scaling/intersection etc.) is just point-wise so should be the same as well.
When trying this out it seems that the only required change is in _set_plex_coordinates() which currently assumes a linear coordinate field.
Our adaptivity libraries fundamentally only deal with linear meshes (triangles in 2D or tets in 3D). However, for the mantle convection application we use cylindrical or spherical shell meshes with P2 coordinates to better approximate the curvature of the Earth - which is then a so called isoparametric mesh because we use P2 for velocity as well.
In principle, it's fairly straightforward to drop back to a linear mesh
which simply subsamples the coordinates on the vertices. Then I can assemble the metric on that mesh_p1 mesh, call adapt as usual; I get back a new linear mesh from which I can construct a new P2 mesh as well
Because this interpolates from a linear coordinate field, the new P2 mesh is still actually flat, but I can then use a trick to pop back the edge nodes on the boundary to lie exactly on surface sphere/circle.
So that's all fine and well but I would need to assemble the metric on the linear mesh which is not optimal. It means I first have to interpolate the solution fields onto the linear mesh, and the Hessian calculations would also occur on the linear approximation of the sphere which would be less accurate. Instead what I want to do is assemble on the P2 mesh using all of animate's metric assembly functionality, like compute_hessian(), intersect(), normalise() etc. NOTE: the metric itself would still be in a linear function space, with just one tensor per vertex, it's just the geometry that has a more accurate description. For the various Hessian reconstructions, that should just work as currently written. I think all other functionality (scaling/intersection etc.) is just point-wise so should be the same as well.
When trying this out it seems that the only required change is in _set_plex_coordinates() which currently assumes a linear coordinate field.