Skip to content

Boundary Reseeding

Particles that leave the flow domain can be recycled through inlet/outlet cap surfaces.

BoundaryReseeder computes a time-resolved inflow weight for every cap face:

max(-v . n, 0) * area

This means particles are only reseeded where the current flow is entering the domain. The approach handles backflow and caps that are partially inflow and partially outflow at the same time.

Volumetric Seed Layer

Pass the tracking time step to spread reseeded particles over a thin inward layer:

import mrsimtracks as mt

reseeder = mt.BoundaryReseeder(caps, flow, dt=dt)

This reduces repeated plane-seeding artifacts and helps maintain smoother particle density for downstream MR simulation.

Flux Diagnostics

Use flux_waveform() to inspect net signed cap flux over the cycle:

times, flux = reseeder.flux_waveform()

The sum across caps should be small relative to the total cap flux for a well-resolved incompressible field.

ALE Flow

For a deforming ALE mesh, use ALEBoundaryReseeder. It rebuilds cap geometry at each sampled time and weights each face by its current area and inward fluid velocity relative to the moving mesh:

max(-(Velocity - Mesh_velocity) . n, 0) * current_area
reseeder = mt.ALEBoundaryReseeder(caps, flow, dt=dt)
result = mt.track(flow, seeds=seeds, reseeder=reseeder, dt=dt)

The cap vertices must correspond to reference volume-mesh nodes. When wall nodes have zero relative velocity, mrsimtracks.dev.extract_ale_caps can build a labeled reference cap surface from the loaded series.