Finite difference method for the diffusion-advection equation

In summary: Then you can solve for A using the Euler-Lagrange equation.In summary, you need to solve for the A matrix.
  • #1
LogarithmLuke
83
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
  • #2
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.
 
  • #3
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:
  • #4
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.
 
  • #5
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.
 
  • #6
The signs of the terms involving ##\mu## are wrong.
 
  • #7
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?
 
  • #8
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.
 

Related to Finite difference method for the diffusion-advection equation

1. What is the finite difference method for the diffusion-advection equation?

The finite difference method is a numerical technique used to approximate the solutions of differential equations, such as the diffusion-advection equation. It involves dividing the domain of the equation into a grid and approximating the derivatives at each grid point using finite difference formulas. By solving the resulting system of equations, an approximate solution to the original differential equation can be obtained.

2. How does the finite difference method work for the diffusion-advection equation?

The finite difference method works by first discretizing the domain of the diffusion-advection equation into a grid, with each grid point representing a specific location in the domain. Next, the derivatives in the equation are approximated using finite difference formulas, which use the values at neighboring grid points to estimate the derivative at a specific point. The resulting system of equations is then solved using numerical methods to obtain an approximate solution to the original equation.

3. What are the advantages of using the finite difference method for the diffusion-advection equation?

One advantage of the finite difference method is its simplicity and ease of implementation. It also allows for a straightforward representation of boundary conditions and can handle complex geometries. Additionally, the method is efficient for solving problems with large domains and can handle nonlinear equations.

4. What are the limitations of the finite difference method for the diffusion-advection equation?

One limitation of the finite difference method is that it can only approximate the solution to the original equation, and the accuracy of the approximation depends on the size of the grid used. Additionally, the method may not be suitable for problems with discontinuities or sharp gradients. It also requires a uniform grid, which may not be feasible for certain problems.

5. How is the finite difference method for the diffusion-advection equation used in real-world applications?

The finite difference method is widely used in various fields, including fluid dynamics, heat transfer, and financial modeling. It is often used to solve diffusion-advection equations in environmental studies, such as modeling the transport of pollutants in a river or the spread of disease in a population. It is also used in engineering applications, such as simulating heat transfer in a cooling system or predicting the flow of fluids in a pipe.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
0
Views
240
  • Calculus and Beyond Homework Help
Replies
5
Views
1K
  • Calculus and Beyond Homework Help
Replies
7
Views
598
  • Calculus and Beyond Homework Help
Replies
6
Views
356
  • Calculus and Beyond Homework Help
Replies
3
Views
532
  • Calculus and Beyond Homework Help
Replies
13
Views
2K
  • Electrical Engineering
Replies
4
Views
937
  • Calculus and Beyond Homework Help
Replies
3
Views
920
  • Programming and Computer Science
Replies
8
Views
2K
Back
Top