- #1
- 88
- 0
Hi!
I'm implementing a scheme to solve the following equation
[tex]\frac{\partial \psi}{\partial t}=-c_{s} \cdot \frac{\partial \phi}{\partial x}[/tex]
[tex]\frac{\partial \phi}{\partial t}=-c_{s} \cdot \frac{\partial \psi}{\partial x}[/tex]
[tex]c_{s}[/tex] 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.
[tex]\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})[/tex]
[tex]\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})[/tex]
It is also worth knowing that [tex]\phi[/tex] corresponds to the pressure value at a given grid point, and that [tex]\psi[/tex] corresponds to the velocity at a given grid point.
Of course I start with an initially known [tex]\phi[/tex] spatial distribution. Then using a backward euler I calculate the [tex]\psi[/tex] at t=-1/2. Then I obtain [tex]\psi[/tex] at t=1/2 and from that [tex]\phi[/tex] 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 [tex]\phi_{j-1/2}[/tex]. I know it will be "outside" the grid, but the value needs to be known to calculate [tex]\psi_{j}[/tex] 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 [tex] thing. What have I done wrong?
I'm implementing a scheme to solve the following equation
[tex]\frac{\partial \psi}{\partial t}=-c_{s} \cdot \frac{\partial \phi}{\partial x}[/tex]
[tex]\frac{\partial \phi}{\partial t}=-c_{s} \cdot \frac{\partial \psi}{\partial x}[/tex]
[tex]c_{s}[/tex] 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.
[tex]\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})[/tex]
[tex]\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})[/tex]
It is also worth knowing that [tex]\phi[/tex] corresponds to the pressure value at a given grid point, and that [tex]\psi[/tex] corresponds to the velocity at a given grid point.
Of course I start with an initially known [tex]\phi[/tex] spatial distribution. Then using a backward euler I calculate the [tex]\psi[/tex] at t=-1/2. Then I obtain [tex]\psi[/tex] at t=1/2 and from that [tex]\phi[/tex] 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 [tex]\phi_{j-1/2}[/tex]. I know it will be "outside" the grid, but the value needs to be known to calculate [tex]\psi_{j}[/tex] 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 [tex] thing. What have I done wrong?
Last edited: