# Interpolation of velocities on staggered grid (in PIC)

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-velocities
• 4x3 array for the (green) y-velocities
• 3x3 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) cells
• A = the sample point in the Q region
• Aren't there boundary conditions at the boundaries that can be used for the interpolation? – Abhilash Reddy M Oct 25 '16 at 18:47
• @AbhilashReddyM Thank you for pointing me to the right direction - I'm just starting with PIC, so I don't know a lot of (basic) stuff yet. I have another question: let's consider the inverse problem when I need to transfer velocities from particles to the grid (inverse bilinear interpolation) - should I also utilize boundary conditions? How'd I e.g. 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)? – sarasvati Oct 25 '16 at 19:38
• Sorry. I don't actually work with PIC methods. – Abhilash Reddy M Oct 25 '16 at 19:45
• @AbhilashReddyM OK. I'll update my question to include the inverse problem too. – sarasvati Oct 25 '16 at 19:58

For the fluid->particle problem, @AbhilashReddyM gave you the answer, the boundary condition will give you the value of $v_x$ at the boundaries.
• Could you please explain the "particle's x-velocity component"->"staggered grid" conversion at boundary? Consider this grid's cell [2,1]. There's a particle b. It has (pink) velocity v_b. v_b has x-velocity component called v_bx (purple). How do I transfer v_bx to the staggered grid (the grid is represented by the orange bars on cell's faces). Do I just split v_bx via linear interpolation between gx_2 and gx_3? If not, how would a boundary condition help me? (to be continued) – sarasvati Nov 18 '16 at 17:09
• (continuing) AFAIK in PIC, there's BC stating that the velocity component normal to the boundary should be 0 - which seems to be fullfilled in the case of particle b's x-velocity component: the cell that b is in has boundary normal perpendicular to both gx_2 and gx_3. So how can such a boundary condition help me to splat b's velocity to the grid? Thank you. – sarasvati Nov 18 '16 at 17:13
• Let's say I have the slip condition defined - now, I don't understand how this BC could help me in the case of particle b. Can you please state a concrete example how v_bx would be transfered to the grid? (I obviously tried to google this problem up, but I've seen no concrete definition of how to do the particle->grid interpolation at boundary. For example take a look at page 21 of this PDF - there's stated how to interopolate velocity at the interior cells, but not at boundaries.) – sarasvati Nov 19 '16 at 0:29