Finite difference method for the diffusion-advection equation

Click For Summary

Homework Help Overview

The discussion revolves around the finite difference method applied to the diffusion-advection equation in a two-dimensional context. Participants are exploring the formulation of a numerical scheme and the setup of the corresponding matrix for solving the problem.

Discussion Character

  • Exploratory, Mathematical reasoning, Problem interpretation, Assumption checking

Approaches and Questions Raised

  • Participants discuss the formulation of a finite difference scheme, questioning the correctness of terms and signs in the equations. There is an exploration of the implications of using different subscripts for grid points and the independence of velocity components. The original poster expresses uncertainty about the setup of the matrix A needed for solving the problem.

Discussion Status

The discussion is active, with participants providing feedback on the formulation of the scheme and raising questions about specific terms. Some guidance has been offered regarding the setup of the matrix A, but there is no explicit consensus on the final form of the scheme or the next steps.

Contextual Notes

Participants are working under the constraints of a homework assignment, which may limit the information they can share or the methods they can use. There is an acknowledgment of potential errors in the formulation of the scheme, particularly regarding the signs of terms and the treatment of velocity components.

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
1K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K