Advection equation and Crank-Nicolson

  • Thread starter ads.
  • Start date
In summary, the conversation is about numerically modeling the advection equation using the Crank-Nicolson scheme. The person is having trouble applying the boundary condition for the grid point N in the scheme because of the centered space discretization. They suggest extending the domain or making it periodic as possible solutions. However, the person is unsure of how to implement these methods and cannot use a periodic domain.
  • #1
ads.
8
0
Hi, I want to numerically model the advection equation using the Crank-Nicolson scheme. Yes, I know that it is highly oscillatory but that is the point of the exercise as I want to highlight this. The problem I'm having is how do I apply the BC for grid point N in the scheme. The advection equation only needs one boundary condition at point 0 in the domain, but becuase of the centred space disretisation the scheme requires an artificial boundary condition at the other end. The basic equation is

[tex]\-\frac{\sigma}{4}f_{i-1}^{n+1}+f_{i}^{n+1}+\frac{\sigma}{4}f_{i+1}^{n+1}=\frac{\sigma}{4}f_{i-1}^{n}+f_{i}^{n}-\frac{\sigma}{4}f_{i+1}^{n}[/tex]

So say I want the value at N+1 to be the same as N, that requires

[tex]\left.\frac{\partial f}{\partial x}\right|_{N}=\frac{f_{N+1}^{n}-f_{N-1}^{n}}{2\triangle x}=0[/tex]

and hence

[tex]f_{N+1}=f_{N-1}[/tex]

So if we sub that into the main scheme we get

[tex] f_{N}^{n+1}=f_{N}^{n}[/tex]

So according to this the final grid point always remains at the initial condictions, which is clearly wrong. Does anyone know what is wrong with my assumptions?

Thanks for any info.
 
Physics news on Phys.org
  • #2
Lots of ways, some better/easier than others.

You can try making your domain a cell too large at every boundary where you need to enforce a BC at the cell edge, then interpolate.

You can also make the domain periodic, but then you get periodic solutions (which may or may not be acceptable).
 
Last edited:
  • #3
olivermsun said:
Lots of ways, some better/easier than others.

You can try making your domain a cell too large at every boundary where you need to enforce a BC at the cell edge, then interpolate.

You can also make the domain periodic, but then you get periodic solutions (which may or may not be acceptable).

I'm not quite sure how you implement the method you suggested. If you extend your domain, aren't you still going to have the same problem except with a larger domain? The solution still has to be in the form of a tridiagonal matrix.

Unfortunately I can't use a periodic domain as I want to see the solution at the final time compared with the initial time.
 

1. What is the advection equation?

The advection equation is a partial differential equation that describes the transport of a scalar quantity through a medium by a fluid flow. It takes into account the velocity and direction of the fluid flow, and can be used to model various physical phenomena such as heat transfer, mass transfer, and chemical reactions.

2. How is the advection equation solved?

The advection equation can be solved numerically using various methods, such as the finite difference method or the finite volume method. These methods discretize the equation into smaller parts and use iterative calculations to approximate the solution at each point. The most common method for solving the advection equation is the Crank-Nicolson method.

3. What is the Crank-Nicolson method?

The Crank-Nicolson method is a numerical method for solving partial differential equations, including the advection equation. It is a finite difference method that uses a combination of forward and backward time steps to approximate the solution at each point. This method is known for its accuracy and stability, and is widely used in various fields of science and engineering.

4. What are the advantages of using the Crank-Nicolson method?

One of the main advantages of using the Crank-Nicolson method is its second-order accuracy, which means that the error in the solution is reduced compared to other methods. It is also unconditionally stable, meaning that it can handle larger time steps without causing the solution to become unstable. Additionally, the Crank-Nicolson method is easy to implement and can handle complex boundary conditions.

5. In which fields is the advection equation and Crank-Nicolson method commonly used?

The advection equation and the Crank-Nicolson method are commonly used in various fields such as fluid dynamics, meteorology, oceanography, and atmospheric sciences. They are also used in engineering applications, such as in the design of heat exchangers and chemical reactors. In addition, they are used in mathematical modeling and simulations to study physical processes and phenomena in different systems.

Similar threads

  • Differential Equations
Replies
8
Views
4K
  • Differential Equations
Replies
1
Views
2K
  • Differential Equations
Replies
1
Views
2K
Replies
3
Views
618
  • Mechanical Engineering
Replies
9
Views
1K
Replies
3
Views
494
  • Differential Equations
Replies
1
Views
750
  • Differential Equations
Replies
3
Views
1K
  • Introductory Physics Homework Help
Replies
8
Views
400
  • Differential Equations
Replies
5
Views
2K
Back
Top