Numerical solution to hyperbolic PDE - grid leapfrog - what to do at boundary

Click For Summary

Discussion Overview

The discussion revolves around the numerical solution of a hyperbolic partial differential equation (PDE) related to sound waves, specifically focusing on the implementation of a staggered grid scheme and the challenges associated with boundary conditions. Participants explore how to handle boundary values in their calculations and consider alternative schemes for better accuracy.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes a staggered grid scheme for solving the equations governing sound waves, highlighting the need for boundary values to compute future states.
  • Another participant suggests that first-order derivatives at the boundary can be computed easily, offering to explain the method if desired.
  • A later reply expresses uncertainty about the boundary handling, emphasizing the need for clarity on how to compute boundary grid points for the numerical scheme.
  • One participant proposes using integer points instead of midpoints for spatial descriptions and offers assistance with the numerical scheme, questioning whether the specified scheme is mandatory.
  • A participant insists that the scheme must remain as specified in their assignment, noting that their current implementation works under certain conditions but seeks a more robust solution for waves escaping the grid.
  • Another participant recommends looking into "absorbing boundary conditions" as a method to simulate waves running off into infinite space, suggesting that it involves some mathematical techniques.

Areas of Agreement / Disagreement

Participants express differing views on how to handle boundary conditions, with some proposing methods for computing boundary values while others seek alternative schemes. There is no consensus on the best approach to take for the boundary conditions or the numerical scheme.

Contextual Notes

Participants mention the limitations of their current methods, including the challenges of implementing periodic boundary conditions and the need for a proper mathematical framework to allow waves to escape the grid.

Who May Find This Useful

This discussion may be of interest to those working on numerical methods for hyperbolic PDEs, particularly in the context of wave propagation and boundary condition implementation.

trelek2
Messages
86
Reaction score
0
Hi!

I'm implementing a scheme to solve the following equation
\frac{\partial \psi}{\partial t}=-c_{s} \cdot \frac{\partial \phi}{\partial x}
\frac{\partial \phi}{\partial t}=-c_{s} \cdot \frac{\partial \psi}{\partial x}

c_{s} is just the isothermal velocity of sound. The equations are for a sound wave...

I'm solving the equation using a staggered grid, using the following scheme. n are the time grid points. j are the spatial grid points. 1/2 means middle - between two grid points.
\frac{1}{\Delta t}(\psi^{n+1/2}_{j}-\psi^{n-1/2}_{j})=- \frac{c_{s}}{\Delta x}(\phi^{n}_{j+1/2}-\phi^{n}_{j-1/2})
\frac{1}{\Delta t}(\phi^{n+1}_{j+1/2}-\phi^{n}_{j+1/2})=- \frac{c_{s}}{\Delta x}(\psi^{n+1/2}_{j+1}-\psi^{n+1/2}_{j})

It is also worth knowing that \phi corresponds to the pressure value at a given grid point, and that \psi corresponds to the velocity at a given grid point.

Of course I start with an initially known \phi spatial distribution. Then using a backward euler I calculate the \psi at t=-1/2. Then I obtain \psi at t=1/2 and from that \phi at t=1. But what should I do at the boundary of the spatial grid?It doesn't say in the scheme how to obtain the boundary \phi_{j-1/2}. I know it will be "outside" the grid, but the value needs to be known to calculate \psi_{j} half a time step later... For the purpose of my calculation I can just set it to the value from the previous time step since I have a waves traveling from the middle of the grid and I finish the calculation before they would escape the grid. But what if I wanted to continue with the calculation so that the waves would run off the grid?

Thanks for any advice!

Ps. can anyone suggest any slightly more higher order scheme to solve this PDE?

PS.2 sorry for the new lines after each thing. What have I done wrong?
 
Last edited:
Physics news on Phys.org
You can compute the first order derivatives on the boundary quite easily if this is what you want. If this is what you want, let me know and I will explain the way to do it.
 
I'm not sure if that's what i want...

What I need is:
Look at the numerical scheme used to compute the solution.
knowing the "phi" spatial distribution at time=n, I calculate the "psi" spatial distribution at time=n+1/2. From that I can obtain the phi spatial distribution at time=n+1, But except for the j-1/2 boundary spatial grid point which I later need to calculate "psi" at time=n+3/2...

Do you see what I mean now? I don't know how to deal with the boundary grid points...
 
I personally would not take the mid points to do my spatial description at the mid-points, I would do it at integer points and I can have equations for derivatives at the end points.

I can offer my assistance with the numerical scheme, does it have to be the one you specified?
 
It has to be this scheme. It is stated in my assignment to implement it.

The code I wrote works fine, because I'm solving a sound wave that arises in the middle of the grid and by the time the programme finishes, the resulting sound waves don't leave the grid. So I can naively put the equilibrium value for pressure at these points.

However I would like to write this scheme properly so that the waves would be able to run off the grid... Or maybe I could put a boundary that would reflect the waves?

I have already tried periodic boundary conditions but they don't yield reasonable results...

Actually, if you know any other schemes that would be useful in solving this particular equation or perhaps the diffusion equation, i'd be very grateful for a link...
 
Last edited:
You need to look up "absorbing boundary conditions". There are ways to mimic having the waves run off into infinite space. It involves a little mathematical trickery.
 

Similar threads

  • · Replies 36 ·
2
Replies
36
Views
5K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 36 ·
2
Replies
36
Views
8K