Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Issue with Implementing ∂x + i ∂y in Spherical Coordinates on Sphere Surface

48 views
Skip to first unread message

MARTÍN IGNACIO RUBIO

unread,
Nov 14, 2024, 2:35:12 PM11/14/24
to dedalu...@googlegroups.com

Hi,


I’m working on an equation for a complex field A on the surface of a sphere, and I need to transform the operator \partial_x + i \partial_y to spherical coordinates. To do this, I tried defining the spherical coordinate derivative to get a transformation from the cartesian coordinates (also, pondered with some trigonometric functions of phi and theta) (also weighted with trigonometric functions of phi and theta for a consistent transformation) as follows: 


dphi = lambda B: d3.Differentiate(B, coords_sph['phi']) 

dtheta = lambda B: d3.Differentiate(B, coords_sph['theta']) 


However, this approach raises the following error: NotImplementedError: No subclasses of <class 'dedalus.core.operators.Differentiate'> found for the supplied arguments: (<Field 5239994848>, <dedalus.core.coords.Coordinate object at 0x13862bd40>), {}


I also tried using components of a gradient as an alternative, with:


Comp1 = lambda B: d3.AngularComponent(d3.Gradient(B, coords))

Comp2 = lambda B: d3.AzimuthalComponent(d3.Gradient(B, coords))


But this resulted in: ValueError: Not supported


Here are my definitions for the basis and field A:


dealias = 3/2

stop_sim_time = 100

timestepper = d3.RK222

timestep = 2e-3  

dtype = np.complex128


# Bases and domain

coords = d3.S2Coordinates('phi', 'theta')

dist = d3.Distributor(coords, dtype=dtype)

basis = d3.SphereBasis(coords, (Nphi, Ntheta), radius=R, dealias=dealias, dtype=dtype)


# Fields

A = dist.Field(name='A', bases=basis)


I would really appreciate any guidance on how to correctly implement these derivatives in spherical coordinates.


Thanks,

Martin RS

Galen Neil Wilcox

unread,
Nov 14, 2024, 4:21:46 PM11/14/24
to Dedalus Users
Hi Martin,

I am no expert but you may have some luck taking dot products of unit vectors with the gradient, like etheta@grad(B) + i*ephi@grad(B). See this post for setting up the unit vectors.

Otherwise, I have been working with similar operators on the sphere, and it seems best to use the built-in options if possible. Maybe there's a way to express your operator as a combination of grad, cross, curl, etc.

Best,

Galen

Keaton Burns

unread,
Nov 18, 2024, 8:54:24 AM11/18/24
to dedalu...@googlegroups.com
Hi Martin,

Unfortunately forming the unit vector fields on the sphere will cause problems, since these are not smooth vector fields. Since e_x and e_y are smooth fields, you could actually form those (or really, their projections on to the tangent space of the sphere) and use dot products to compute dx and dy. But these would be coupled operators that you probably couldn’t use implicitly. As Galen says, its recommended to use the built-in vector operators, if possible.

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/1afcf16a-06df-4420-9022-030fe5768102n%40googlegroups.com.

MARTÍN IGNACIO RUBIO

unread,
Nov 20, 2024, 3:56:13 AM11/20/24
to dedalu...@googlegroups.com
Hi Galen and Keaton,
Thanks a lot for your reply. It has been very helpful.

Best,
Martín

Reply all
Reply to author
Forward
0 new messages