Skip to content

Densities on the grid: Field.deposit_density and node volumes - #20

Merged
max-models merged 1 commit into
develfrom
velocity-moments
Nov 3, 2026
Merged

max-models merged 1 commit into
develfrom
velocity-moments

Conversation

@max-models

@max-models max-models commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Adds Field.deposit_density(positions, values, weighting=LINEAR): it scatters the marker values into a zero copy of the field, exchanges the halos on a split field, divides by the node volumes and adds the result. With the products w, w v, w v v, ... as components it gives the velocity moments of any order (n, n u, n, ...) in one deposit; the products come from mpiparticles (moment_values), so mpifield stays free of velocities.

  • Field.node_volumes(): the volume each node collects, half a cell on a bounded edge.
  • Field.on_grid takes num_ghost_points, so a split field can carry the halo a quadratic deposit needs.
  • A method card with a SymPy rule (the density times the volumes is the total).
  • Tests: conservation for both weightings and all edge types, uniform density up to the edges, the split deposit against the serial one under MPI.
  • Example 14 derives density, flow, temperature and heat flux from the moments of a drifting Maxwellian.

@max-models max-models changed the title Velocity moments of any order on the grid Densities on the grid: Field.deposit_density and node volumes Nov 3, 2026
@max-models
max-models merged commit 6b63310 into devel Nov 3, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant