Eulerian-Lagrangian coupling in PICurv is built from interpolation (grid -> particle) and scatter/normalization (particle -> grid).
For a particle inside a host cell with local coordinates \((a_1,a_2,a_3)\in[0,1]^3\), trilinear interpolation uses 8 source-point weights:
\[ \phi_p = \sum_{m=1}^{8} w_m(a_1,a_2,a_3)\,\phi_m, \qquad \sum_m w_m = 1. \]
PICurv supports two grid-to-particle interpolation methods, selectable at runtime via the interpolation_method YAML key (or -interpolation_method flag).
The recommended method. For each particle, the 8 nearest cell centers are identified via octant detection (based on existing host-cell weights), forming a "dual cell." Trilinear interpolation is performed directly from these cell-centered field values to the particle position.
Key properties:
lUcat, lDiffusivity, etc.) and ghosted cell center coordinates (lCent). No extra ghost exchange is needed beyond what the solver already provides.ApplyPeriodicCorrectionsToCellCenters() supplies translated coordinate images, including at periodic edges and corners. A particle that crosses a periodic seam is wrapped by the walking search (5. Particle Boundary Policies), so a dual cell next to the seam combines in-domain centres with translated images.Code path: InterpolateAllFieldsToSwarm dispatches to InterpolateEulerFieldFromCenterToSwarm.
The original two-stage method:
sum/count).This is second-order on uniform Cartesian grids but degrades to first-order on curvilinear grids because the unweighted averaging does not account for the asymmetric placement of cell centers around nodes.
Code path: InterpolateAllFieldsToSwarm dispatches to InterpolateEulerFieldFromCornerToSwarm.
For velocity only, FaceFlux uses the face fluxes Ucont the pressure projection makes discretely divergence-free. Inside the host cell, with weights \(a_1, a_2, a_3\) measured from each axis's minimum face, every flux family and its face-area vector are interpolated linearly between the two faces of that family,
\[ U^i(a) = (1-a_i)\,U^i_- + a_i\,U^i_+, \qquad S_i(a) = (1-a_i)\,S_{i,-} + a_i\,S_{i,+}, \]
and the Cartesian velocity solves \(S_i(a)\cdot u = U^i(a)\) (ContravariantToCartesianInCell, the cell-centre solve of Contra2Cart, which is the case \(a = 1/2\)). On a cell whose face-area vectors do not vary along their own axis, \(\nabla\cdot u\) equals the cell's discrete flux divergence, so a divergence-free flow gives a divergence-free particle velocity and a uniform tracer density is preserved; a wall face carries no flux, so the wall-normal velocity is zero there. Each component is linear only along its own axis, so the method is first-order accurate (see p08_cap_interp_faceflux).
Code path: InterpolateAllFieldsToSwarm dispatches Ucat to InterpolateEulerVelocityFromFacesToSwarm; other fields use the Trilinear path.
Both methods share the same underlying trilinear kernels:
YAML (solver.yml):
C flag: -interpolation_method 0 (Trilinear), 1 (CornerAveraged) or 2 (FaceFlux).
Enum: InterpolationMethod in include/variables.h. Stored in SimCtx.interpolationMethod.
Scatter computes per-cell sums, then normalizes by particle count:
\[ \bar{\phi}_{i,j,k} = \begin{cases} \dfrac{\sum_{p\in cell(i,j,k)} \phi_p}{N_{i,j,k}}, & N_{i,j,k}>0, \\ 0, & N_{i,j,k}=0. \end{cases} \]
Code touchpoints:
Current standard scatter path actively maps particle Psi to Eulerian Psi; additional fields are scaffolded and can be enabled with matching vector/DM contracts.
Coupling quality depends on:
Inconsistency in any of these usually appears as noisy particle statistics or nonphysical reconstructed Eulerian fields.