DedalusProject / dedalus

A flexible framework for solving PDEs with modern spectral methods.
http://dedalus-project.org/
GNU General Public License v3.0
513 stars 121 forks source link

[d3] Spherical calculus test fails for different (nphi, ntheta) choices #176

Closed evanhanders closed 2 years ago

evanhanders commented 2 years ago

I don't think this is intended behavior (It'd be good to have an error message if so): many of the tests in test_spherical3D_calculus.py fail when nphi = ntheta = 1 (1D radial domain). A few more tests fail for dealias = 1.5 than for dealias = 1. I'm also seeing tests fail for (nphi, ntheta) = (8, 4).

All of these errors have Nr = 8, like default.

Is there a rule of thumb like ntheta has to be >= Nr? If so it'd be good to have warnings or error messages to enforce this. If not, something's going wrong...

kburns commented 2 years ago

At first glance, it looks like many of these tests have hard-coded polynomial solutions, and these will need a minimum number of ell modes to be representable based on the degree of the polynomial. I think the rule is that N_r > N_theta/2 for the ball basis functions to make sense, but here you just need a minimum Lmax (or ntheta) for the hard-coded tests to make sense.

evanhanders commented 2 years ago

Ah, Ok. This makes sense (and I should've looked more closely). The reason this came up is because I want to do a radial derivative (grad) in a 1D Ball basis with resolution (1, 1, Nr). From playing around with the test more, I'm confident that a (8, 4, Nr) resolution caclulates scalar grad properly.

I guess a very low priority thing that would be nice is for there to be tests of calculus operations in 1D spherical bases. But maybe this is implicit elsewhere in something like an EVP or BVP solve?

kburns commented 2 years ago

I think there are tests of operators on radial functions with Nphi = Ntheta = 1 there: test_gradient_radial_scalar, test_gradient_radial_vector, test_divergence_radial_vector, test_laplacian_radial_scalar, and test_laplacian_radial_vector.

evanhanders commented 2 years ago

Ah, you're right. I missed those! Thanks for pointing them out, and sorry for bringing up an issue that wasn't an issue! Thanks.