Finite difference method for the diffusion-advection equation

Click For Summary
SUMMARY

The discussion focuses on the finite difference method for solving the diffusion-advection equation in a two-dimensional context. The participants clarify the correct formulation of the finite difference scheme, emphasizing the use of subscript indices (i, j) instead of directional indices (N, S, E, W). The final scheme is confirmed as: -4\frac{\mu}{h^2} U_{i,j}+(\frac{v_{1}}{2 h}+\frac{\mu}{h^2})U_{i+1,j}+(\frac{v_{2}}{2 h} +\frac{\mu}{h^2})U_{i,j+1} - (\frac{v_{1}}{2 h}-\frac{\mu}{h^2})U_{i-1,j} - (\frac{v_{2}}{2 h} - \frac{\mu}{h^2})U_{i,j-1} + \tau = f_{ij}. Additionally, guidance is provided on transitioning to set up the pentadiagonal matrix A for solving the problem.

PREREQUISITES
  • Understanding of finite difference methods
  • Familiarity with the diffusion-advection equation
  • Knowledge of matrix operations and structures, specifically pentadiagonal matrices
  • Basic concepts of numerical methods for partial differential equations
NEXT STEPS
  • Research the implementation of finite difference methods in MATLAB or Python
  • Study the properties and applications of pentadiagonal matrices
  • Learn about stability and convergence criteria for numerical methods
  • Explore advanced topics in numerical solutions for the diffusion-advection equation
USEFUL FOR

Mathematicians, engineers, and computational scientists working on numerical simulations of fluid dynamics, particularly those interested in the diffusion-advection equation and finite difference methods.

LogarithmLuke
Messages
82
Reaction score
3
Homework Statement
Consider the diffusion-advection equation given by ## \mu \Delta u + \mathbf{v} \cdot \nabla u = f \ \text{in} \ \Omega ## with some appropiate boundary conditions. Here the velocity field ##\mathbf{v} : \Omega \rightarrow \mathbb{R}^2## and the source function ## f: \Omega \rightarrow \mathbb{R} ## may depend on the position. Here ##\Delta## is the Laplace operator, and ##\nabla## is the gradient.

Solve the problem on a unit square with Dirichlet boundary conditions. Set up a finite difference scheme using central differences for both the first and second derivatives of ##u##. Implement the scheme. Write your program so it can solve the problem for different choices of ##\mathbf{v}##
Relevant Equations
-
So for my scheme I obtained ##\frac{\mu}{h^2} U_{p}+(\frac{v_{1}}{2 h}-\frac{\mu}{h^2})U_{E}+(\frac{v_{2}}{2 h} - \frac{\mu}{h^2})U_{N} - (\frac{v_{1}}{2 h}+\frac{\mu}{h^2})U_{W} - (\frac{v_{2}}{2 h} + \frac{\mu}{h^2})U_{N} + \tau = f## however I am not sure this is correct. I am quite new to the finite difference method, and honestly find it quite difficult. I am also not sure how to go about setting up the A matrix and progressing onward to solve the rest of the problem. Any help would be greatly appreciated.
 
Physics news on Phys.org
You have N, W, and E. What happened to S?

I assume that this is a 2D problem, correct? You should be using subscript indexes of I and J on U, not N, S, E, and W.
 
Yes this is a 2D problem. The last ##U_N## should have been a ##U_S##. Ok so using subscript indicies i and j instead I obtain the following scheme:

##4\frac{\mu}{h^2} U_{i,j}+(\frac{v_{1}}{2 h}-\frac{\mu}{h^2})U_{i+1,j}+(\frac{v_{2}}{2 h} -\frac{\mu}{h^2})U_{i,j+1} - (\frac{v_{1}}{2 h}+\frac{\mu}{h^2})U_{i-1,j} - (\frac{v_{2}}{2 h} + \frac{\mu}{h^2})U_{i,j-1} + \tau = f## where ##\tau## is an error term.

Does this seem correct? I realized I had forgotten a factor 4 when I recalculated it.
 
Last edited:
I think you have the signs wrong on the diffusion terms. I haven't checked the advection terms yet. Are you assume that the two velocity components are independent of x and y? The f term should be subscripted i,j unless f is constant.
 
Im not familiar with what the diffusion terms and advection terms of the equation are. I did not think about whether the velocity components were independent of x and y, I simply dotted the components with the nabla vector for u, where I replaced the partial derivatives with central differences.
 
The signs of the terms involving ##\mu## are wrong.
 
So this is the correct scheme? ##-4\frac{\mu}{h^2} U_{i,j}+(\frac{v_{1}}{2 h}+\frac{\mu}{h^2})U_{i+1,j}+(\frac{v_{2}}{2 h} +\frac{\mu}{h^2})U_{i,j+1} - (\frac{v_{1}}{2 h}-\frac{\mu}{h^2})U_{i-1,j} - (\frac{v_{2}}{2 h} - \frac{\mu}{h^2})U_{i,j-1} + \tau = f_{ij}## How would I transition further to set up the pentadiagonal(?) matrix A to solve the problem?
 
LogarithmLuke said:
So this is the correct scheme? ##-4\frac{\mu}{h^2} U_{i,j}+(\frac{v_{1}}{2 h}+\frac{\mu}{h^2})U_{i+1,j}+(\frac{v_{2}}{2 h} +\frac{\mu}{h^2})U_{i,j+1} - (\frac{v_{1}}{2 h}-\frac{\mu}{h^2})U_{i-1,j} - (\frac{v_{2}}{2 h} - \frac{\mu}{h^2})U_{i,j-1} + \tau = f_{ij}##
. Looks OK.
How would I transition further to set up the pentadiagonal(?) matrix A to solve the problem?
You define a solution vector ##y_k##, and then associate the U values with this vector in order, row-by-row or column-by-column.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
0
Views
888
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K