Skip to content

Small meshes fail in parallel #594

@connorjward

Description

@connorjward

Running the code

from firedrake import *
from gusto import Domain


m = PeriodicIntervalMesh(3, 10)  # increasing 3 to 5 here makes the error go away
mesh = ExtrudedMesh(m, layers=3, layer_height=10/3)
domain = Domain(mesh, 0.1, 'CG', 1)

with mpiexec -n 2 python myfile.py throws

Traceback (most recent call last):
  File "/home/connor/Code/firedrake-dev3/src/gusto/mydemo.py", line 7, in <module>
    domain = Domain(mesh, 0.1, 'CG', 1)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/connor/Code/firedrake-dev3/src/gusto/gusto/core/domain.py", line 152, in __init__
    self.set_height_above_surface()
  File "/home/connor/Code/firedrake-dev3/src/gusto/gusto/core/domain.py", line 179, in set_height_
above_surface
    columnwise_height, index_data = self.coords.get_column_data(CG1_height, self)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/connor/Code/firedrake-dev3/src/gusto/gusto/core/coordinates.py", line 193, in get_co
lumn_data
    data_range = np.max(coords_X) - np.min(coords_X)
                 ^^^^^^^^^^^^^^^^
  File "/home/connor/Code/firedrake-dev3/lib/python3.12/site-packages/numpy/_core/fromnumeric.py",
 line 3199, in max
    return _wrapreduction(a, np.maximum, 'max', axis, None, out,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/connor/Code/firedrake-dev3/lib/python3.12/site-packages/numpy/_core/fromnumeric.py",
 line 86, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: zero-size array to reduction operation maximum which has no identity

which is because an array getting passed to np.max has zero size. I expect this is because one rank has no cells kept on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPull requests or issues to relating to something not working correctlyparallelRelates to parallel capability

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions