Computing spherical surface integral for a Field in S2 basis

13 views
Skip to first unread message

Florian Schopper

unread,
Nov 3, 2025, 11:10:29 AM (9 days ago) Nov 3
to Dedalus Users
Hi everyone,

I have a Field in S2 coordinates/basis and want to integrate over the surface of the whole sphere, but can't seem to get it to work.
I saw in previous answers that using Average is a good workaround, but it also doesn't work on the S2 basis.
I then tried in BallBasis with r=1, but I still get an error:

coords = d3.SphericalCoordinates('theta', 'phi', 'r')
dist = d3.Distributor(coords, dtype=dtype)
ball = d3.BallBasis(coords, shape=(Nphi, Ntheta, Nr), radius=1, dealias=dealias, dtype=dtype)
sphere = ball.S2_basis()

n = dist.Field(name='n', bases=ball)
ct1 = dist.Field(name='ct1')
ct2 = dist.Field(name='ct2')

theta_grid, phi_grid  = dist.local_grids(sphere)
integral = lambda n: 4*np.pi * d3.Average(n, coords.S2coordsys)
problem = d3.IVP([n, ct1, ct2], namespace=locals())
problem.add_equation('dt(n(r=1)) = -D_CFG * (ct1 + ct2) + RE_AT * (N_CFG - integral(n(r=1)))')

this produces the error:
No subclasses of <class 'dedalus.core.operators.Convert'> found for the supplied arguments: (Mul(-1, Add(Convert(Mul(-0.0001, Add(<Field 140217378309408>, <Field 140217378309584>))), Mul(1e-06, Add(Convert(<Field 140217378310992>), Mul(-1, Mul(144.0, Mul(3.141592653589793, Mul(4.0, Mul(1.5546823183243522e+72, Average(interp(<Field 140217378309232>, r=1))))))))))), <dedalus.core.basis.SphereBasis object at 0x7f86ecf79eb0>), {}

If I change it to use integral(n) in the equation and d3.Average(n(r=1), coords.S2coordsys) above, it is the same error.

It only works if I remove the (r=1) but I don't want to compute the problem for the whole sphere.

Has anyone encountered this issue and found a solution?

Kind regards,
Florian

Jeffrey S. Oishi

unread,
Nov 3, 2025, 11:11:49 AM (9 days ago) Nov 3
to dedalu...@googlegroups.com
Hi Florian,

This is not yet implemented. We will be implementing it soon.

Jeff

--
You received this message because you are subscribed to the Google Groups "Dedalus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dedalus-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/dedalus-users/5bafe44d-155a-4642-adb1-80d3c3018c36n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages