@@ -550,7 +550,7 @@ def multiplication_matrix(self, subproblem, arg_basis, coeffs, ncc_comp, arg_com
550
550
Nmat = 3 * ((N + 1 )// 2 ) + min ((N + 1 )// 2 , (da + db + 1 )// 2 )
551
551
J = arg_basis .Jacobi_matrix (size = Nmat )
552
552
A , B = clenshaw .jacobi_recursion (Nmat , a_ncc , b_ncc , J )
553
- f0 = dedalus_sphere .jacobi .polynomials (1 , a_ncc , b_ncc , 1 )[0 ] * sparse .identity (Nmat )
553
+ f0 = dedalus_sphere .jacobi .polynomials (1 , a_ncc , b_ncc , 1 )[0 ]. astype ( np . float64 ) * sparse .identity (Nmat )
554
554
matrix = clenshaw .matrix_clenshaw (coeffs .ravel (), A , B , f0 , cutoff = cutoff )
555
555
convert = jacobi .conversion_matrix (Nmat , arg_basis .a , arg_basis .b , out_basis .a , out_basis .b )
556
556
matrix = convert @ matrix
@@ -2040,7 +2040,7 @@ def _radius_weights(self, scale):
2040
2040
Q0 = dedalus_sphere .jacobi .polynomials (N , self .alpha [0 ], self .alpha [1 ], z0 )
2041
2041
Q_proj = dedalus_sphere .jacobi .polynomials (N , self .alpha [0 ], self .alpha [1 ], z_proj )
2042
2042
normalization = self .dR / 2
2043
- return normalization * ( (Q0 @ weights0 ).T ) @ (weights_proj * Q_proj )
2043
+ return ( normalization * ( (Q0 @ weights0 ).T ) @ (weights_proj * Q_proj )). astype ( np . float64 )
2044
2044
2045
2045
def global_radius_weights (self , scale = None ):
2046
2046
if scale == None : scale = 1
@@ -2059,7 +2059,7 @@ def local_radius_weights(self, scale=None):
2059
2059
def constant_mode_value (self ):
2060
2060
# Note the zeroth mode is constant only for k=0
2061
2061
Q0 = dedalus_sphere .jacobi .polynomials (1 , self .alpha [0 ], self .alpha [1 ], np .array ([0.0 ]))
2062
- return Q0 [0 ,0 ]
2062
+ return np . float64 ( Q0 [0 ,0 ])
2063
2063
2064
2064
def _new_k (self , k ):
2065
2065
return AnnulusBasis (self .coordsystem , self .shape , radii = self .radii , k = k , alpha = self .alpha , dealias = self .dealias , dtype = self .dtype ,
@@ -2137,7 +2137,7 @@ def _interpolation(self, position):
2137
2137
a = self .alpha [0 ] + self .k
2138
2138
b = self .alpha [1 ] + self .k
2139
2139
radial_factor = (self .dR / position )** (self .k )
2140
- return radial_factor * dedalus_sphere .jacobi .polynomials (self .n_size (0 ), a , b , native_position )
2140
+ return radial_factor * dedalus_sphere .jacobi .polynomials (self .n_size (0 ), a , b , native_position ). astype ( np . float64 )
2141
2141
2142
2142
@CachedMethod
2143
2143
def operator_matrix (self ,op ,m ,spintotal , size = None ):
@@ -2188,7 +2188,7 @@ def multiplication_matrix(self, subproblem, arg_basis, coeffs, ncc_comp, arg_com
2188
2188
Nmat = 3 * ((N0 + 1 )// 2 ) + self .k
2189
2189
J = arg_basis .operator_matrix ('Z' , m , spintotal_arg , size = Nmat )
2190
2190
A , B = clenshaw .jacobi_recursion (Nmat , a_ncc , b_ncc , J )
2191
- f0 = dedalus_sphere .jacobi .polynomials (1 , a_ncc , b_ncc , 1 )[0 ] * sparse .identity (Nmat )
2191
+ f0 = dedalus_sphere .jacobi .polynomials (1 , a_ncc , b_ncc , 1 )[0 ]. astype ( np . float64 ) * sparse .identity (Nmat )
2192
2192
# Conversions to account for radial prefactors
2193
2193
prefactor = arg_basis .jacobi_conversion (m , dk = self .k , size = Nmat )
2194
2194
if self .dtype == np .float64 :
@@ -2299,7 +2299,7 @@ def local_radius_weights(self, scale=None):
2299
2299
@CachedAttribute
2300
2300
def constant_mode_value (self ):
2301
2301
Qk = dedalus_sphere .zernike .polynomials (2 , 1 , self .alpha + self .k , 0 , np .array ([0 ]))
2302
- return Qk [0 ]
2302
+ return np . float64 ( Qk [0 ])
2303
2303
2304
2304
def _new_k (self , k ):
2305
2305
return DiskBasis (self .coordsystem , self .shape , radius = self .radius , k = k , alpha = self .alpha , dealias = self .dealias , dtype = self .dtype ,
@@ -2399,7 +2399,7 @@ def operator_matrix(self, op, m, spin, size=None):
2399
2399
def interpolation (self , m , spintotal , position ):
2400
2400
native_position = self .radial_COV .native_coord (position )
2401
2401
native_z = 2 * native_position ** 2 - 1
2402
- return dedalus_sphere .zernike .polynomials (2 , self .n_size (m ), self .alpha + self .k , np .abs (m + spintotal ), native_z )
2402
+ return dedalus_sphere .zernike .polynomials (2 , self .n_size (m ), self .alpha + self .k , np .abs (m + spintotal ), native_z ). astype ( np . float64 )
2403
2403
2404
2404
@CachedMethod
2405
2405
def radius_multiplication_matrix (self , m , spintotal , order , d ):
@@ -2436,7 +2436,7 @@ def multiplication_matrix(self, subproblem, arg_basis, coeffs, ncc_comp, arg_com
2436
2436
J = arg_basis .operator_matrix ('Z' , m , spintotal_arg )
2437
2437
A , B = clenshaw .jacobi_recursion (N , a_ncc , b_ncc , J )
2438
2438
# assuming that we're doing ball for now...
2439
- f0 = dedalus_sphere .zernike .polynomials (2 , 1 , a_ncc , b_ncc , 1 )[0 ] * sparse .identity (N )
2439
+ f0 = dedalus_sphere .zernike .polynomials (2 , 1 , a_ncc , b_ncc , 1 )[0 ]. astype ( np . float64 ) * sparse .identity (N )
2440
2440
prefactor = arg_basis .radius_multiplication_matrix (m , spintotal_arg , diff_regtotal , d )
2441
2441
if self .dtype == np .float64 :
2442
2442
coeffs_filter = coeffs .ravel ()[:2 * N ]
@@ -2869,7 +2869,7 @@ def local_grid_colatitude(self, scale):
2869
2869
def _native_colatitude_grid (self , scale ):
2870
2870
N = int (np .ceil (scale * self .shape [1 ]))
2871
2871
cos_theta , weights = dedalus_sphere .sphere .quadrature (Lmax = N - 1 )
2872
- theta = np .arccos (cos_theta ) .astype (np .float64 )
2872
+ theta = np .arccos (cos_theta .astype (np .float64 )) # TODO: xprec doesn't yet support arccos
2873
2873
return theta
2874
2874
2875
2875
def global_colatitude_weights (self , scale = None ):
@@ -3529,13 +3529,13 @@ def _radius_weights(self, scale):
3529
3529
Q0 = dedalus_sphere .jacobi .polynomials (N , self .alpha [0 ], self .alpha [1 ], z0 )
3530
3530
Q_proj = dedalus_sphere .jacobi .polynomials (N , self .alpha [0 ], self .alpha [1 ], z_proj )
3531
3531
normalization = self .dR / 2
3532
- return normalization * ( (Q0 @ weights0 ).T ) @ (weights_proj * Q_proj )
3532
+ return ( normalization * ( (Q0 @ weights0 ).T ) @ (weights_proj * Q_proj )). astype ( np . float64 )
3533
3533
3534
3534
@CachedAttribute
3535
3535
def constant_mode_value (self ):
3536
3536
# Note the zeroth mode is constant only for k=0
3537
3537
Q0 = dedalus_sphere .jacobi .polynomials (1 , self .alpha [0 ], self .alpha [1 ], np .array ([0.0 ]))
3538
- return Q0 [0 ,0 ]
3538
+ return np . float64 ( Q0 [0 ,0 ])
3539
3539
3540
3540
@CachedMethod
3541
3541
def radial_transform_factor (self , scale , data_axis , dk ):
@@ -3548,7 +3548,7 @@ def interpolation(self, position):
3548
3548
a = self .alpha [0 ] + self .k
3549
3549
b = self .alpha [1 ] + self .k
3550
3550
radial_factor = (self .dR / position )** (self .k )
3551
- return radial_factor * dedalus_sphere .jacobi .polynomials (self .n_size (0 ), a , b , native_position )
3551
+ return radial_factor * dedalus_sphere .jacobi .polynomials (self .n_size (0 ), a , b , native_position ). astype ( np . float64 )
3552
3552
3553
3553
@CachedMethod
3554
3554
def transform_plan (self , grid_size , k ):
@@ -3636,7 +3636,7 @@ def multiplication_matrix(self, subproblem, arg_basis, coeffs, ncc_comp, arg_com
3636
3636
Nmat = 3 * ((N0 + 1 )// 2 ) + self .k
3637
3637
J = arg_radial_basis .operator_matrix ('Z' , ell , regtotal_arg , size = Nmat )
3638
3638
A , B = clenshaw .jacobi_recursion (Nmat , a_ncc , b_ncc , J )
3639
- f0 = dedalus_sphere .jacobi .polynomials (1 , a_ncc , b_ncc , 1 )[0 ] * sparse .identity (Nmat )
3639
+ f0 = dedalus_sphere .jacobi .polynomials (1 , a_ncc , b_ncc , 1 )[0 ]. astype ( np . float64 ) * sparse .identity (Nmat )
3640
3640
# Conversions to account for radial prefactors
3641
3641
prefactor = arg_radial_basis .jacobi_conversion (ell , dk = self .k , size = Nmat )
3642
3642
if self .dtype == np .float64 :
@@ -3740,18 +3740,18 @@ def _native_radius_grid(self, scale):
3740
3740
def _radius_weights (self , scale ):
3741
3741
N = int (np .ceil (scale * self .shape [2 ]))
3742
3742
z , weights = dedalus_sphere .zernike .quadrature (3 , N , k = self .alpha )
3743
- return weights
3743
+ return weights . astype ( np . float64 )
3744
3744
3745
3745
@CachedAttribute
3746
3746
def constant_mode_value (self ):
3747
3747
Qk = dedalus_sphere .zernike .polynomials (3 , 1 , self .alpha + self .k , 0 , np .array ([0 ]))
3748
- return Qk [0 ]
3748
+ return np . float64 ( Qk [0 ])
3749
3749
3750
3750
@CachedMethod
3751
3751
def interpolation (self , ell , regtotal , position ):
3752
3752
native_position = self .radial_COV .native_coord (position )
3753
3753
native_z = 2 * native_position ** 2 - 1
3754
- return dedalus_sphere .zernike .polynomials (3 , self .n_size (ell ), self .alpha + self .k , ell + regtotal , native_z )
3754
+ return dedalus_sphere .zernike .polynomials (3 , self .n_size (ell ), self .alpha + self .k , ell + regtotal , native_z ). astype ( np . float64 )
3755
3755
3756
3756
@CachedMethod
3757
3757
def transform_plan (self , grid_shape , regindex , axis , regtotal , k , alpha ):
@@ -3855,7 +3855,7 @@ def multiplication_matrix(self, subproblem, arg_basis, coeffs, ncc_comp, arg_com
3855
3855
if (d >= 0 ) and (d % 2 == 0 ):
3856
3856
J = arg_radial_basis .operator_matrix ('Z' , ell , regtotal_arg , size = Nmat )
3857
3857
A , B = clenshaw .jacobi_recursion (N0 , a_ncc , b_ncc , J )
3858
- f0 = dedalus_sphere .zernike .polynomials (3 , 1 , a_ncc , regtotal_ncc , 1 )[0 ] * sparse .identity (Nmat )
3858
+ f0 = dedalus_sphere .zernike .polynomials (3 , 1 , a_ncc , regtotal_ncc , 1 )[0 ]. astype ( np . float64 ) * sparse .identity (Nmat )
3859
3859
radial_factor = arg_radial_basis .radius_multiplication_matrix (ell , regtotal_arg , diff_regtotal , d , size = Nmat )
3860
3860
conversion = arg_radial_basis .conversion_matrix (ell , regtotal_out , dk , size = Nmat )
3861
3861
prefactor = conversion @ radial_factor
@@ -4903,7 +4903,7 @@ def _radial_matrix(basis, m):
4903
4903
N = basis .shape [1 ]
4904
4904
z0 , w0 = dedalus_sphere .zernike .quadrature (2 , N , k = 0 )
4905
4905
Qk = dedalus_sphere .zernike .polynomials (2 , n_size , basis .alpha + basis .k , abs (m ), z0 )
4906
- matrix = (w0 [None , :] @ Qk .T ).astype (basis . dtype )
4906
+ matrix = (w0 [None , :] @ Qk .T ).astype (np . float64 )
4907
4907
matrix *= basis .radius ** 2
4908
4908
matrix *= 2 * np .pi # Fourier contribution
4909
4909
else :
@@ -4925,8 +4925,8 @@ def _radial_matrix(basis, m):
4925
4925
z0 , w0 = dedalus_sphere .jacobi .quadrature (N , a = 0 , b = 0 )
4926
4926
r0 = basis .dR / 2 * (z0 + basis .rho )
4927
4927
Qk = dedalus_sphere .jacobi .polynomials (n_size , basis .alpha [0 ]+ basis .k , basis .alpha [1 ]+ basis .k , z0 )
4928
- w0_geom = r0 * w0 * (r0 / basis .dR )** (- basis .k )
4929
- matrix = (w0_geom [None , :] @ Qk .T ).astype (basis . dtype )
4928
+ w0_geom = r0 * w0 * (r0 . astype ( np . float64 ) / basis .dR )** (- basis .k ) # TODO: xprec does not yet support power
4929
+ matrix = (w0_geom [None , :] @ Qk .T ).astype (np . float64 )
4930
4930
matrix *= basis .dR / 2
4931
4931
matrix *= 2 * np .pi # Fourier contribution
4932
4932
else :
@@ -4992,7 +4992,7 @@ def _radial_matrix(basis, ell):
4992
4992
N = basis .shape [2 ]
4993
4993
z0 , w0 = dedalus_sphere .zernike .quadrature (3 , N , k = 0 )
4994
4994
Qk = dedalus_sphere .zernike .polynomials (3 , n_size , basis .alpha + basis .k , ell , z0 )
4995
- matrix = (w0 [None , :] @ Qk .T ).astype (basis . dtype )
4995
+ matrix = (w0 [None , :] @ Qk .T ).astype (np . float64 )
4996
4996
matrix *= basis .radius ** 3
4997
4997
matrix *= 4 * np .pi / np .sqrt (2 ) # SWSH contribution
4998
4998
else :
@@ -5014,8 +5014,8 @@ def _radial_matrix(basis, ell):
5014
5014
z0 , w0 = dedalus_sphere .jacobi .quadrature (N , a = 0 , b = 0 )
5015
5015
r0 = basis .dR / 2 * (z0 + basis .rho )
5016
5016
Qk = dedalus_sphere .jacobi .polynomials (n_size , basis .alpha [0 ]+ basis .k , basis .alpha [1 ]+ basis .k , z0 )
5017
- w0_geom = r0 ** 2 * w0 * (r0 / basis .dR )** (- basis .k )
5018
- matrix = (w0_geom [None , :] @ Qk .T ).astype (basis . dtype )
5017
+ w0_geom = r0 ** 2 * w0 * (r0 . astype ( np . float64 ) / basis .dR )** (- basis .k ) # TODO: xprec does not yet support power
5018
+ matrix = (w0_geom [None , :] @ Qk .T ).astype (np . float64 )
5019
5019
matrix *= basis .dR / 2
5020
5020
matrix *= 4 * np .pi / np .sqrt (2 ) # SWSH contribution
5021
5021
else :
@@ -5147,7 +5147,7 @@ def _interpolation_vectors(sphere_basis, Ntheta, s, theta):
5147
5147
Lmin = max (abs (m ), abs (s ))
5148
5148
interp_m = dedalus_sphere .sphere .harmonics (sphere_basis .Lmax , m , s , z )[None , :]
5149
5149
forward_m = forward ._forward_SWSH_matrices [m ][Lmin - abs (m ):]
5150
- interp_vectors [m ] = interp_m @ forward_m
5150
+ interp_vectors [m ] = interp_m . astype ( np . float64 ) @ forward_m
5151
5151
else :
5152
5152
interp_vectors [m ] = np .zeros ((1 , Ntheta ))
5153
5153
return interp_vectors
0 commit comments