Dstributed grid in BallBasis

28 views
Skip to first unread message

Zhengzhan Shang

unread,
Jun 17, 2024, 2:26:46 PMJun 17
to Dedalus Users
Hello there,

I am working with elliposidal simulations in BallBasis, and I am running into some resolution problem that requires me to know the distribution of the grid points, namely in the boundary layers. I have tried to follow the tutorial 1.3: Basis grids and scale factors, and attempted to plot out my grid distribution as well, but I failed to do so in multidimensional bases. The error I am getting is from global_grids(dist, scales), the error reads "Spherical3DBasis.global_grids() got multiple values for argument 'scales' ". The code I have for checking the distribution is as the following:


Radius = params['Radius']
ell = params['ell']
a = params['a']
Nphi = params['Nphi']
Ntheta = params['Ntheta']
Nr = params['Nr']
Ek = params['Ek']

dealias = 3/2
timestepper = d3.SBDF2
dtype = np.float64
mesh = None

# Bases
coords = d3.SphericalCoordinates('phi', 'theta', 'r')
dist = d3.Distributor(coords, dtype=dtype, mesh=mesh)
ball = d3.BallBasis(coords, shape=(Nphi, Ntheta, Nr), radius=Radius, dealias=dealias, dtype=dtype)
sphere = ball.surface

# Substitutions
phi, theta, r = dist.local_grids(ball)

# Generating global grids for normal and dealias scales
grid_normal = ball.global_grids(dist, scales=None).ravel()
grid_dealias = ball.global_grids(dist, scales=dealias).ravel()

# Plotting the grids
plt.figure(figsize=(6, 1.5), dpi=100)
plt.plot(grid_normal, 0 * grid_normal + 1, 'o', markersize=5)
plt.plot(grid_dealias, 0 * grid_dealias - 1, 'o', markersize=5)
plt.xlabel('z')
plt.ylim([-2, 2])
plt.gca().yaxis.set_ticks([])
plt.tight_layout()
plt.save('check.pdf')


So I am emailing you to see how are the grid points distributed in BallBasis, and how can I check the distribution myself?

Best regards,
Shang

Keaton Burns

unread,
Jun 18, 2024, 7:33:18 AMJun 18
to dedalu...@googlegroups.com
Hi Shang,

We’re moving towards a system of accessing the grids from the distributor object, rather than directly from the bases. If you’re running in serial, the global grids should be the same as the local grids, so I’d recommend trying dist.local_grids(ball, scales).

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 on the web visit https://groups.google.com/d/msgid/dedalus-users/3e66aa72-4cb7-4951-b0e0-aeca9e41c84fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages