5.1. Gravity Solver Design Note

5.1.1. Asynchronous Multilevel Poisson Correction in DISPATCH

5.1.1.1. Purpose

This document summarizes a proposed strategy for solving the Poisson equation for gravity within the DISPATCH framework using a task-local, multilevel defect-correction approach. The design is compatible with:

  • asynchronous task scheduling

  • patch-local execution

  • AMR hierarchies with partial coverage at high levels

  • periodic global domain backbone levels

The method avoids global synchronization while preserving correct large-scale gravitational structure.

5.1.1.2. Governing Equation

All patches solve the same global equation:

∇² φ = 4πG (ρ − ⟨ρ⟩_global)

where:

⟨ρ⟩_global

is a single scalar defined over the entire periodic domain.

Important:

NEVER subtract patch-local means
ALWAYS subtract global mean density

5.1.1.3. Hierarchy Structure

Assume:

root patch: periodic 16³
next several levels: fully populated hierarchy (backbone)
higher levels: sparse AMR patches

Interpretation:

backbone levels carry long-wavelength gravity
sparse levels carry only local corrections

5.1.1.4. Potential Decomposition

Each patch represents its solution as:

φ_h = P φ_H + δφ_h

where:

φ_H  = parent potential
P    = prolongation operator
δφ_h = local correction

This ensures:

coarse levels carry global gravity
fine levels carry residual corrections

5.1.1.5. Local Correction Equation

Each patch solves:

L_h δφ_h =
    4πG (ρ_h − ⟨ρ⟩_global)
    − L_h (P φ_H)

with boundary condition:

δφ_h = 0 on patch boundary

Equivalently:

φ_h boundary = P φ_H boundary

This removes responsibility for long-wavelength modes from fine patches.

5.1.1.6. Information Flow Through Hierarchy

Correct directionality:

Density:

fine → coarse  (restriction)

Potential:

coarse → fine  (prolongation)

Residual corrections:

local only

No upward propagation of potential corrections required.

5.1.1.7. Role of Backbone Levels

Backbone levels solve:

L φ = 4πG (ρ − ⟨ρ⟩_global)

over full periodic coverage.

These levels determine:

monopole
dipole
quadrupole
all long-wavelength modes

Sparse AMR levels must not attempt to modify these components.

5.1.1.8. Why Zero-Mean Constraints Apply Only to Backbone Levels

Zero-mean constraints are valid only when:

  • domain coverage is complete

  • boundaries are periodic

Sparse patches:

  • do not enclose a gravitational system

  • do not define a mean density

  • must inherit boundary conditions instead

Therefore:

never impose local mean constraints on sparse AMR patches

5.1.1.9. Residual Computation

Each patch computes:

r = 4πG (ρ − ⟨ρ⟩_global) − L_h φ

Local smoother solves:

L_h δφ = r_local

Example implementation step:

res = fourpiG*(rho - rho_mean_global) - laplace(phi)

5.1.1.10. Patch Update Algorithm

Suggested structure:

gather neighbor guard zones
gather parent correction
assemble φ = P φ_H + δφ_h
compute residual
smooth locally (SOR or Chebyshev)
update δφ_h
publish updated φ

All steps remain task-local.

5.1.1.11. Scheduling Model

Each gravity update performs limited smoothing iterations:

n_iter ≈ 2–8

Then publishes updated correction.

Gravity convergence emerges asynchronously across hierarchy.

5.1.1.12. Advantages

This approach:

  • preserves DISPATCH task-local execution model

  • respects Gauss-law structure of gravity

  • avoids global Poisson solves

  • uses backbone hierarchy as persistent multigrid carrier

  • keeps sparse AMR levels purely corrective

5.1.1.13. Summary

Backbone levels:

determine global gravitational field

Sparse AMR levels:

correct local residual structure only

Global consistency is ensured through:

  • conservative density restriction

  • potential prolongation

  • shared global density mean