CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Interpolation on staggered grid

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By FMDenaro

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 4, 2016, 16:56
Arrow Interpolation on staggered grid
  #1
New Member
 
Join Date: Nov 2016
Posts: 4
Rep Power: 10
usirev is on a distinguished road
Hi,

I'm a beginner trying to implement a basic/trivial 2D PIC simulation.
I have a question regarding bilinear interpolation of a quantity (e.g. velocities) on staggered grid (the grid is on the picture below);


I use two 2D arrays to store the velocities - one array for x-component and the other for y-component.

One of the steps in the PIC algorithm is transfering velocities from particles to grid(s).
Let's consider transfering the x-component of velocity from particles to the x-grid:
for each particle I need to find 4 surrounding staggered points (green bars in the image above) to perform the (inverse) bilinear interpolation.

Here's my question: how do I interpolate the x-velocity on the top and bottom boundary cells where there are no staggered points (green bars) below my particle (blue dot in the image)?
How would you interpolate the blue particle's x-velocity component to the grid in the image above?

My attempts to solution:
  1. I considered storing the velocity components on the grid vertices (the black dots in the image) for interpolation from particles to grid and from grid to particles.
    After transfering particles -> grid, I'd create another grid (staggered, storing velocities on the face centers, like in the image) and use it to solve the poisson equation.
  2. I'd use use only linear (not bilinear) interpolation for particles in the boundary cells. (How would this approach affect the quality of the simulation?)
  3. I'd interpolate in the same way like I interpolate for the other cells - but I would store velocities only for the existing green bars (e.g. only for the above 2 green bars in the case of the blue particle from the image above).
    I suppose this would result in loss of information.
usirev is offline   Reply With Quote

Old   November 4, 2016, 17:19
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by usirev View Post
Hi,

I'm a beginner trying to implement a basic/trivial 2D PIC simulation.
I have a question regarding bilinear interpolation of a quantity (e.g. velocities) on staggered grid (the grid is on the picture below);


I use two 2D arrays to store the velocities - one array for x-component and the other for y-component.

One of the steps in the PIC algorithm is transfering velocities from particles to grid(s).
Let's consider transfering the x-component of velocity from particles to the x-grid:
for each particle I need to find 4 surrounding staggered points (green bars in the image above) to perform the (inverse) bilinear interpolation.

Here's my question: how do I interpolate the x-velocity on the top and bottom boundary cells where there are no staggered points (green bars) below my particle (blue dot in the image)?
How would you interpolate the blue particle's x-velocity component to the grid in the image above?

My attempts to solution:
  1. I considered storing the velocity components on the grid vertices (the black dots in the image) for interpolation from particles to grid and from grid to particles.
    After transfering particles -> grid, I'd create another grid (staggered, storing velocities on the face centers, like in the image) and use it to solve the poisson equation.
  2. I'd use use only linear (not bilinear) interpolation for particles in the boundary cells. (How would this approach affect the quality of the simulation?)
  3. I'd interpolate in the same way like I interpolate for the other cells - but I would store velocities only for the existing green bars (e.g. only for the above 2 green bars in the case of the blue particle from the image above).
    I suppose this would result in loss of information.

Consider that you know the velocity on the boundary...
for example, if the boundary is a wall and you work with viscous flows, you have zero x-component velocity so that you can add two values in the black nodes and using the bi-linear interpolation taking into account that you have a rectangular grid the height being a half of the upper.
FMDenaro is offline   Reply With Quote

Old   November 4, 2016, 19:42
Default
  #3
New Member
 
Join Date: Nov 2016
Posts: 4
Rep Power: 10
usirev is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
Consider that you know the velocity on the boundary...
for example, if the boundary is a wall and you work with viscous flows, you have zero x-component velocity so that you can add two values in the black nodes and using the bi-linear interpolation taking into account that you have a rectangular grid the height being a half of the upper.
Dear FMDenaro, thank you for your reply.

I'm sorry, but I think I don't understand the following part of your answer:
Quote:
Originally Posted by FMDenaro View Post
...so that you can add two values in the black nodes and using the bi-linear interpolation taking into account that you have a rectangular grid the height being a half of the upper.
Does that mean that to interpolate the x-velocity of the blue particle (from the image in my original question) to the grid, I should use (i.e. store the velocity on) the:
  • left-upper green bar AND
  • right-upper green bar AND
  • bottom-left black node AND
  • bottom-right black node
?

Another question: Should the 12 boundary grid-cells be marked as a wall? Then there could not be a particle in the 12 boundary cells and thus there would always be some green bars below my particle to store the velocity on (that would mean that particles are allowed only in the 4 cells inside the grid from the image). Is such an approach correct?
usirev is offline   Reply With Quote

Old   November 5, 2016, 04:26
Default
  #4
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Yes, you can use the two lower black nodes (lower boundary) to complete the interpolation region. Setting wall or not as BC depends on your physical problem, is not a matter of interpolation.
FMDenaro is offline   Reply With Quote

Old   November 5, 2016, 06:28
Default
  #5
New Member
 
Join Date: Nov 2016
Posts: 4
Rep Power: 10
usirev is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
Yes, you can use the two lower black nodes (lower boundary) to complete the interpolation region. Setting wall or not as BC depends on your physical problem, is not a matter of interpolation.
Just to make sure I really understand:
given a 4x4 array of cells (like in the image) I create:
  • 6x5 array for the staggered x-components of velocity (6 because apart from the green bars, I need to add the top and the bottom rows of black nodes)
  • 5x6 array for the staggered y-components of velocity (analogously to the x-components)

The 2 added rows of black nodes at the top and bottom rows for x-component grid (in the case of the y-component-grid it'd be the leftmost and the rightmost columns of black nodes)
are used ONLY for interpolation when transfering velocities from particles to grid and in the opposite direction.
When solving the Poisson equation to get divergence-free field, I'd ignore the 2 rows of black nodes and I'd use just the green bars.

Is the above right?
usirev is offline   Reply With Quote

Old   November 5, 2016, 07:02
Default
  #6
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
The pressure equation requires only red and green values for computing the source term but it is solved on the centre of the cells
usirev likes this.
FMDenaro is offline   Reply With Quote

Reply

Tags
implementation, pic, staggered grid


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Discretization of mass conservation equation in a 2D staggered grid kiwiguigou Main CFD Forum 4 April 16, 2016 16:57
Face interpolation in a quadtree grid (or non-conformal grid) in openfoam banji OpenFOAM Programming & Development 2 October 31, 2015 15:13
SIMPLE co-located grid vs Staggered grid Thamali OpenFOAM Pre-Processing 2 September 2, 2013 01:59
Grid Independent Solution Chuck Leakeas Main CFD Forum 2 May 26, 2000 12:18
Incompressible flow solver (staggered grid) J. Ehrhard Main CFD Forum 1 October 8, 1998 20:47


All times are GMT -4. The time now is 19:59.