Hi everyone,
I have a Field in S2 coordinates/basis and want to integrate over the surface of the whole sphere, but can't seem to get it to work.
I saw in previous answers that using Average is a good workaround, but it also doesn't work on the S2 basis.
I then tried in BallBasis with r=1, but I still get an error:
coords = d3.SphericalCoordinates('theta', 'phi', 'r')
dist = d3.Distributor(coords, dtype=dtype)
ball = d3.BallBasis(coords, shape=(Nphi, Ntheta, Nr), radius=1, dealias=dealias, dtype=dtype)
sphere = ball.S2_basis()
n = dist.Field(name='n', bases=ball)
ct1 = dist.Field(name='ct1')
ct2 = dist.Field(name='ct2')
theta_grid, phi_grid = dist.local_grids(sphere)
integral = lambda n: 4*np.pi * d3.Average(n, coords.S2coordsys)
problem = d3.IVP([n, ct1, ct2], namespace=locals())
problem.add_equation('dt(n(r=1)) = -D_CFG * (ct1 + ct2) + RE_AT * (N_CFG - integral(n(r=1)))')
No subclasses of <class 'dedalus.core.operators.Convert'> found for the supplied arguments: (Mul(-1, Add(Convert(Mul(-0.0001, Add(<Field 140217378309408>, <Field 140217378309584>))), Mul(1e-06, Add(Convert(<Field 140217378310992>), Mul(-1, Mul(144.0, Mul(3.141592653589793, Mul(4.0, Mul(1.5546823183243522e+72, Average(interp(<Field 140217378309232>, r=1))))))))))), <dedalus.core.basis.SphereBasis object at 0x7f86ecf79eb0>), {}
If I change it to use integral(n) in the equation and d3.Average(n(r=1), coords.S2coordsys) above, it is the same error.
It only works if I remove the (r=1) but I don't want to compute the problem for the whole sphere.
Has anyone encountered this issue and found a solution?
Kind regards,
Florian