Skip to content

Commit 65c40c6

Browse files
authored
Fix CFL in spherically symmetric runs (#174)
1 parent 336b993 commit 65c40c6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dedalus/core/basis.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3940,7 +3940,11 @@ def local_grids(self, scales=None):
39403940
def global_grid_spacing(self, axis, scales=None):
39413941
"""Global grids spacings."""
39423942
if scales is None: scales = (1,1,1)
3943-
return np.gradient(self.global_grids(scales=scales)[axis], axis=axis, edge_order=2)
3943+
grid = self.global_grids(scales=scales)[axis]
3944+
if grid.size == 1:
3945+
return np.array([np.inf,], dtype=grid.dtype)
3946+
else:
3947+
return np.gradient(grid, axis=axis, edge_order=2)
39443948

39453949
@CachedMethod
39463950
def local_grid_spacing(self, axis, scales=None):

0 commit comments

Comments
 (0)