Numerical solution of continuity equation, implicit scheme, staggered grid

In summary, the conversation discusses the implementation of an implicit scheme for the continuity equation, with \rho being the density, \alpha as a weighing constant, d as a parameter relating grid spacing to flow velocity, j as the spatial grid, and n as the time grid. The problem with this scheme is that it is implicit and difficult to implement. The solution proposed is to shift the scheme to the left by 1/2, making it more convenient. It is suggested to substitute known values for the initial time and use a matrix-vector system to solve for the unknowns at time n+1.
  • #1
trelek2
88
0
Hi!

I'm trying to implement an implicit scheme for the continuity equation.
The scheme is the following:
http://img28.imageshack.us/img28/3196/screenshot20111130at003.png
With [TEX]\rho[/TEX] being the density, [TEX]\alpha[/TEX] is a weighing constant. d is a parameter that relates the grid spacing to the velocity of flow. j is the spatial grid and n is the time grid.

The problem with this scheme is the fact that it is implicit and effectively I have no idea how to successfully implement it. I tried by doing the following:
Assume have initial time n=0 spatial (j) grid full. Also assume I know spatial boundaries (j=-1/2 and j=max) at time n+1.

Then I set j=1/2 equal to a variable x.
Next rearrange so that have j=3/2 in terms of variable x and boundary.
Do likewise for all the (half)grid points so that they can be written in terms of x. then when I reach the opposite boundary of grid (j=max) solve for x. So then I have j=1/2 and hence can substitute x into all the other equations to fill the grid points with data.

This can't work since:
When writing expression for any grid point in terms of x, i divide by [tex]0.5d(1-\alpha)[/tex]. Which is roughly 0.5. So going through all the grid points I end up with 0.5^400 (400 grid points) in the denominator which is bound to kill the calculation.

Can anyone tell me how to deal with this implicit scheme?
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
Are you sure you want to work at the 1/2 nodes? Shifting everything to the left by 1/2 and you will get a scheme with unknowns at j-1,j,j+1, which will be MUCH more convenient.

First of all, assume everything at timestep n known. When n=0, you can substitute the initial conditions. Put all unknowns (the solution at n+1) to the left and all known terms to the right. This is generally a good idea for any numerical scheme.

I will now for simplicity move your scheme 1/2 node to the left. The result is:
[itex]\rho_{j} + 0.5d(1-\alpha)(\rho_{j+1}-\rho_{j-1}) = -0.5d(...)[/itex]

When you have N nodes to discretize space, from j=0..N, then j=0 and j=N are on the boundaries.
Suppose j=1. We then get:
[itex]\rho_{1} + 0.5d(1-\alpha)(\rho_{2}-\rho_{0}) = -0.5d(...)[/itex]

[itex]\rho_{0}[/itex] is on a boundary, so if a boundary condition was imposed on x=0, then you can substitute its value (and move it to the right of the equal sign).

As long as the boundary conditions have not been substituted yet, you will have N-2 equations (j=1..N-1) for N unknowns (j=0..N).
So you have a matrix-vector system of the form [itex][A][\rho^{n+1}]=[/itex]
After substituting the boundary conditions, you should have a system of N-2 equations with N-2 unknowns.
This matrix-vector system is tri-diagonal for which very efficient algorithms exist.
If you solve this, you will get the solution at time n+1.

Hope this helps
 

1. What is the continuity equation and why is it important in numerical solutions?

The continuity equation is a fundamental equation in fluid mechanics that describes the conservation of mass. It states that the rate of change of mass within a control volume must be equal to the net mass flux into or out of the control volume. In numerical solutions, the continuity equation is important because it ensures that the mass is conserved and the solution is physically realistic.

2. What is an implicit scheme and how does it differ from an explicit scheme?

An implicit scheme is a numerical method that uses the solution at the current time step to calculate the solution at the next time step. This means that the equations are solved simultaneously, resulting in a more accurate and stable solution. In contrast, an explicit scheme calculates the solution at the next time step using only the data from the current time step, which can be less accurate and may require smaller time steps for stability.

3. What is a staggered grid and why is it commonly used in numerical solutions?

A staggered grid is a type of grid in which the variables are located at different points, rather than being all located at the same point. This can be seen in the placement of velocity and pressure variables in a fluid flow problem. Staggered grids are commonly used in numerical solutions because they can reduce numerical errors and provide a more accurate representation of the physical system.

4. How does the numerical solution of the continuity equation on a staggered grid differ from that on a regular grid?

On a staggered grid, the continuity equation is solved separately for the velocity and pressure variables, while on a regular grid, both variables are solved simultaneously. This is because the staggered grid separates the variables onto different points, whereas the regular grid has all variables located at the same point. Additionally, the discretization and solution methods may differ between the two types of grids.

5. What are some challenges in numerically solving the continuity equation on a staggered grid?

One challenge in numerically solving the continuity equation on a staggered grid is maintaining the accuracy and stability of the solution while handling the staggered variable placement. This can require more complex discretization and solution methods. Another challenge is ensuring that the boundary conditions for the velocity and pressure variables are properly enforced on the staggered grid.

Similar threads

  • Differential Equations
Replies
3
Views
1K
  • Differential Equations
Replies
3
Views
372
Replies
1
Views
1K
  • Differential Equations
Replies
7
Views
4K
  • Differential Equations
Replies
1
Views
770
  • Differential Equations
Replies
4
Views
2K
Replies
5
Views
4K
Replies
2
Views
796
  • Differential Equations
Replies
5
Views
2K
Replies
2
Views
1K
Back
Top