% mesh_sphere.m — The built-in "cubed sphere". % % surfacemesh.sphere inflates a cube mesh onto the sphere. The first % argument is the number of nodes per dimension (order p plus one); the % second is the number of refinement levels. mip load --install flatironinstitute/flatironinstitute/surfacefun p = 16; nref = 2; dom = surfacemesh.sphere(p + 1, nref); figure(1); plot(dom), camlight title('Cubed sphere'); % A few queries about the mesh: fprintf('patches: %d\n', length(dom)); fprintf('order per patch: %d\n', order(dom)); fprintf('degrees of freedom:%d\n', numel(dom)); fprintf('surface area err: %.2e (vs 4*pi)\n', surfacearea(dom) - 4*pi); fprintf('enclosed vol err: %.2e (vs 4/3*pi)\n', volume(dom) - 4/3*pi); fprintf('bounding box: [%g %g %g %g %g %g]\n', boundingbox(dom));