Advection equation and Crank-Nicolson

  • Context: Graduate 
  • Thread starter Thread starter ads.
  • Start date Start date
Click For Summary
SUMMARY

The discussion focuses on numerically modeling the advection equation using the Crank-Nicolson scheme, specifically addressing the challenge of applying boundary conditions at the grid point N. The primary equation presented is a discretized form of the advection equation, which reveals that the final grid point remains at its initial condition, indicating a flaw in the assumptions made. Participants suggest methods such as extending the domain or using periodic boundary conditions, although the latter is not suitable for the user's objective of comparing final and initial solutions.

PREREQUISITES
  • Understanding of the advection equation and its numerical modeling
  • Familiarity with the Crank-Nicolson scheme for time discretization
  • Knowledge of boundary condition application in numerical methods
  • Experience with tridiagonal matrix systems in numerical analysis
NEXT STEPS
  • Research techniques for applying boundary conditions in finite difference methods
  • Explore methods for extending computational domains in numerical simulations
  • Investigate the implications of periodic boundary conditions in numerical modeling
  • Learn about stability and convergence criteria in the Crank-Nicolson scheme
USEFUL FOR

Mathematicians, computational scientists, and engineers involved in numerical modeling of differential equations, particularly those focusing on fluid dynamics and wave propagation.

ads.
Messages
8
Reaction score
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

\-\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}

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

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

and hence

f_{N+1}=f_{N-1}

So if we sub that into the main scheme we get

f_{N}^{n+1}=f_{N}^{n}

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
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:
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.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 9 ·
Replies
9
Views
1K
  • · Replies 9 ·
Replies
9
Views
2K
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
961