44import numpy as np
55from dedalus .core import coords , distributor , basis , field , operators , arithmetic , problems , solvers
66from dedalus .tools .cache import CachedFunction
7- from scipy .special import sph_harm
7+ from scipy .special import sph_harm_y
88
99Nphi_range = [32 ]
1010Ntheta_range = [16 ]
@@ -157,16 +157,17 @@ def test_gradient_scalar_explicit(Nphi, Ntheta, dealias, dtype):
157157 f = d .Field (bases = b )
158158 f .preset_scales (dealias )
159159 if np .iscomplexobj (dtype ()):
160- f ['g' ] = sph_harm (m , l , phi , theta )
160+ f ['g' ] = sph_harm_y (m , l , theta , phi )
161161 else :
162- f ['g' ] = sph_harm (m , l , phi , theta ).real
162+ f ['g' ] = sph_harm_y (m , l , theta , phi ).real
163163 # Evaluate gradient
164164 u = operators .Gradient (f ).evaluate ()
165165 ug_phi = 1j * np .exp (2j * phi )* np .sqrt (15 / (2 * np .pi ))* np .sin (theta )/ 2
166166 ug_theta = np .exp (2j * phi )* np .sqrt (15 / (2 * np .pi ))* np .cos (theta )* np .sin (theta )/ 2
167167 ug = np .array ([ug_phi , ug_theta ]) / radius
168168 if np .isrealobj (dtype ()):
169169 ug = ug .real
170+ print (u ['g' ]- ug )
170171 assert np .allclose (u ['g' ], ug )
171172
172173
@@ -348,9 +349,9 @@ def test_laplacian_scalar_explicit(Nphi, Ntheta, dealias, dtype):
348349 f = d .Field (bases = b )
349350 f .preset_scales (dealias )
350351 if np .iscomplexobj (dtype ()):
351- f ['g' ] = sph_harm (m , l , phi , theta )
352+ f ['g' ] = sph_harm_y (m , l , theta , phi )
352353 else :
353- f ['g' ] = sph_harm (m , l , phi , theta ).real
354+ f ['g' ] = sph_harm_y (m , l , theta , phi ).real
354355 # Evaluate Laplacian
355356 u = operators .Laplacian (f ).evaluate ()
356357 assert np .allclose (u ['g' ], - f ['g' ]* (l * (l + 1 ))/ radius ** 2 )
@@ -367,9 +368,9 @@ def test_laplacian_scalar_implicit(Nphi, Ntheta, dealias, dtype):
367368 f = d .Field (bases = b )
368369 f .preset_scales (dealias )
369370 if np .iscomplexobj (dtype ()):
370- f ['g' ] = sph_harm (m , l , phi , theta )
371+ f ['g' ] = sph_harm_y (m , l , theta , phi )
371372 else :
372- f ['g' ] = sph_harm (m , l , phi , theta ).real
373+ f ['g' ] = sph_harm_y (m , l , theta , phi ).real
373374 # Poisson LBVP
374375 u = d .Field (bases = b )
375376 tau = d .Field ()
@@ -397,8 +398,8 @@ def test_laplacian_scalar_implicit(Nphi, Ntheta, dealias, dtype):
397398# l0 = 1
398399# m1 = 1
399400# l1 = 2
400- # f['g'][0] = sph_harm (m0,l0,phi, theta)
401- # f['g'][1] = sph_harm (m1,l1,phi, theta)
401+ # f['g'][0] = sph_harm_y (m0,l0,theta,phi )
402+ # f['g'][1] = sph_harm_y (m1,l1,theta,phi )
402403# lap = lambda A: operators.Laplacian(A,c)
403404# problem = problems.LBVP([u])
404405# problem.add_equation((lap(u),f))
0 commit comments