Trace on the sphere

41 views
Skip to first unread message

Sidney Holden

unread,
Nov 18, 2025, 5:17:59 PMNov 18
to dedalu...@googlegroups.com
Hey guys,

Another thing: is the trace implemented for the SphereBasis?

I get this:

Nphi, Ntheta = 16, 32
R = 1.
dealias = 3/2
dtype = np.float64

coords = d3.S2Coordinates('phi', 'theta')
distributor = d3.Distributor(coords, dtype=dtype)
basis = d3.SphereBasis(coords, (Nphi, Ntheta), radius=R, dealias=dealias, dtype=dtype)

K = distributor.TensorField(coords, name='K', bases=basis)

print(d3.trace(K))

--------------------------------------------------------------------------- NotImplementedError Traceback (most recent call last) Cell In[41], line 12 8 basis = d3.SphereBasis(coords, (Nphi, Ntheta), radius=R, dealias=dealias, dtype=dtype) 10 K = distributor.TensorField(coords, name='K', bases=basis) ---> 12 print(d3.trace(K)) File ~/envs/dedalus_sincos/lib/python3.11/site-packages/dedalus/tools/dispatch.py:35, in MultiClass.__call__(cls, *args, **kw) 32 return exception.output 34 if len(passlist) == 0: ---> 35 raise NotImplementedError("No subclasses of {} found for the supplied arguments: {}, {}".format(cls, args, kw)) 36 elif len(passlist) > 1: 37 raise ValueError("Degenerate subclasses of {} found for the supplied arguments {}, {}: {}".format(cls, args, kw, passlist)) NotImplementedError: No subclasses of <class 'dedalus.core.operators.Trace'> found for the supplied arguments: [<Field 23454236286224>], {'out': None}

Cheers,
Sid

Keaton Burns

unread,
Nov 19, 2025, 8:58:53 AMNov 19
to dedalu...@googlegroups.com
Hi Sid,

It looks like that’s missing. Want to open an issue or pull request? It should basically be the same as PolarTrace if you want to give it a go.

Best,
-Keaton

--
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/5C0E053E-269F-4D5F-9166-7D86FF77AEF8%40flatironinstitute.org.

Mathieu Dedenon

unread,
Dec 5, 2025, 12:30:55 PM (15 hours ago) Dec 5
to Dedalus Users
Hi guys,

I opened the issue #329.
Keaton when you say it is the same as PolarTrace, do you mean one just needs to replace cs_type into coords.S2Coordinates on the first line ?

Best,
Mathieu D.
Reply all
Reply to author
Forward
0 new messages