forked from github.com/concept-collection/turing-surface
1% The unit sphere.
2%
3% A geometry file defines one function, `shape`, giving the Cartesian
4% coordinates of the surface over the solver's (theta, phi) grid. Both inputs
5% are npts x 1 grid fields, as are all three outputs, and every line is
6% element-wise MATLAB compiled to a WebGPU kernel — the same backend the models
7% go through.
8%
9% The host then analyses the result into spherical-harmonic coefficients, which
10% is the form the geometry is carried in: band-limited at lmax, evaluable on
11% any grid. For this file that costs nothing, because x, y and z ARE degree-1
12% harmonics — which is what makes this the case where everything downstream
13% reduces exactly to the round-sphere solver.
15function [gx, gy, gz] = shape(theta, phi)
16 st = sin(theta);
17 gx = st .* cos(phi);
18 gy = st .* sin(phi);
19 gz = cos(theta);
20end