Skip to content

Swarm.advection fails on a rank that holds no particles: estimate_dt reshapes an empty (0, 1, dim) velocity array with -1 #693

Description

@lmoresi

Swarm.advection calls estimate_dt(V_fn) before stepping. On a rank with no local particles the evaluated velocity has shape (0, 1, dim) and

vel = vel.reshape(vel.shape[0], -1)

raises ValueError: cannot reshape array of size 0 into shape (0,newaxis) (numpy cannot infer -1 for a zero-size array). Any parallel run whose swarm is empty on some rank at some step dies there: measured with passive tracers released at the inlet of the DFG cylinder benchmark on four ranks (all ranks but the inlet's are empty at the first step), ~/+Simulations/navier_stokes_supg/cylinder/runs/dfg_supg_r40_C1_tracers.log.

Fix on feature/navier-stokes-supg: give reshape the explicit trailing size, vel.reshape(vel.shape[0], vel.shape[1] * vel.shape[2]). A second, separate point for the same routine: max_magvel is rank-local (the .max() of the local particles, and the empty-rank except returns None), so with step_limit=True the substep count can differ between ranks and the advection's collectives would mismatch; the default step_limit=False does not reach it.

Underworld development team with AI support from Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions