Edit: (copying from my comment)
Let's consider the inverse problem when I need to transfer velocities from particles to the grid (inverse bilinear interpolation). How'd I transfer a particle's x-velocity to the velocities located at cell's face in the Q region? Would the particle's velocity be distributed among the 2 face-velocities (as opposed to 4 face velocities in non-boundary locations)?
I'm implementing staggered grid for a PIC simulation (pressures in the center of a cell, velocities on faces) and I'm trying to find out how to interpolate the velocities. To simplify my problem, let's consider the 2D case;
- red dot = pressure (irrelevant to my question)
- blue bar = the x-axis component of velocity
- green bar = the y-axis component of velocity
If I was to implement the grid based on the above image, I'd store 3 arrays:
3x4
array for the (blue) x-velocities4x3
array for the (green) y-velocities3x3
array for the (red) pressures
The problem with these array's sizes is interpolation of velocities at the grid boundaries – imagine you'd want to interpolate the (blue) x-velocity (from the 3x4
array) for particles that are located in the lower half of the bottom cells (the lower half of a cell is the part of the cell, that is below the blue bar representing x-velocities - take a look at the second image below – it's the area marked as Q
).
When I'd want to interpolate the x-velocity in the center (non-boundary) cells, everything would be OK – I'd choose 4 nearest (blue) velocities for a given position in the grid and based on the 4 velocities, I'd bilinearly interpolate the velocity.
However, when I'd try to interpolate in the lower-half of the bottom cells, I'd no longer have 4 velocities to interpolate from – only the 2. The interpolation would degrade from bilinear into linear! (And I suppose that's incorrect implementation of staggered grid interpolation.)
The obvious fix would be to store the velocities on grid's verticies instead of on faces. The velocity for a face could then be linearly interpolated from 2 neighboring verticies when needed. Is this the conventional/preferred/best way how to solve interpolation of velocities on staggered grid?
- green bars = x-velocities stored on grid's verticies
- orange bars = linearly interpolated x-velocities from 2 green bars
- yellow points = the sample point for which velocity needs to be interpolated
Q
= the lower(upper)-half of the bottom(top) cellsA
= the sample point in theQ
region
Q
region? Would the particle's velocity be distributed among the 2 face-velocities (as opposed to 4 face velocities in non-boundary locations)? $\endgroup$