[Numerical Mathematics] one-dimensional advection-diffusion approximation

In summary: It may also be helpful to plot both the exact and numerical solutions to visually compare them and see where the discrepancy lies.
  • #1
Theaumasch
25
0
Hi,

I'm having trouble with a programming problem for my numerical mathematics course. It's about the one-dimensional advection-diffusion equation

a*u'(x)-epsilon*u"(x) = 1, on the interval -1 < x < 1. The boundary values are: u(-1) = u_r, u(1) = u(l)

I have to approximate the solution in MATLAB using Chebyshev polynomials.

As is stated here , u and its first and second derivatives can be expanded in Chebyshev polynomials, I have implemented the calculation of the two D-matrices like this:

c = ones(1,N+1);
c(1) = 2;
DOne = zeros(N-1,N+1);
DTwo = zeros(N-1,N+1);

for n=0:1:N-2
for k=n+1:2:N
DOne(n+1,k+1) = 2*k/c(n+1);
end
end

for n=0:1:N-2
for k=n+2:2:N
DTwo(n+1,k+1) = (k)*((k)^2-(n)^2)/c(n+1);
end
end

Together with the two boundary conditions, I have N+1 equations in N+1 unknowns. The rest of the script was already written in advance by the lecturer, but my numerical result doesn't match the exact result at all (it seems to be random noise). The remaining part of the script does this:

- D = a*DOne-epsilon*DTwo;
- Generate a matrix A, which has the N-1 component equations and 2 boundary value equations as it's rows.
- Au = f => u = A\f. u is the numerical solution, the component of the vector f[n] is 1 for n = 0 and equal to 0 for n=1 up to and including n=N-2. f[N-1] = u_l and f[N] = u_r
- Both the exact and numerical solution are plotted.

I assume I did something wrong in the loops, but I just don't see it. Any help would be appreciated. Thanks in advance!
 
Physics news on Phys.org
  • #2
It looks like you have the right idea for generating the D matrices. Have you checked to make sure that your boundary conditions are set up correctly? Also, make sure that your parameters a and epsilon are appropriate for the problem you are trying to solve. If those look correct, then you may want to double-check your matrix A. Make sure that it is set up as an equation system with the correct boundary values and component equations.
 

FAQ: [Numerical Mathematics] one-dimensional advection-diffusion approximation

1. What is one-dimensional advection-diffusion approximation?

One-dimensional advection-diffusion approximation is a mathematical model used to describe the transport of a substance or quantity through a one-dimensional medium. It takes into account both the effects of advection (movement due to bulk flow) and diffusion (movement due to random molecular motion).

2. What are the key assumptions made in one-dimensional advection-diffusion approximation?

The key assumptions in one-dimensional advection-diffusion approximation include: 1) the medium is one-dimensional, 2) the substance being transported is well-mixed and has a constant concentration, 3) the advection and diffusion processes act independently, and 4) the velocity and diffusion coefficients are constant.

3. How is the one-dimensional advection-diffusion equation derived?

The one-dimensional advection-diffusion equation is derived by applying the principles of conservation of mass and Fick's law (which relates diffusion flux to concentration gradient) to a one-dimensional system. It takes into account both the advection and diffusion terms to describe the change in concentration over time and space.

4. What are some applications of one-dimensional advection-diffusion approximation?

One-dimensional advection-diffusion approximation has many applications in science and engineering, including atmospheric and oceanic modeling, groundwater flow and contaminant transport, drug delivery in the body, and heat and mass transfer in industrial processes.

5. What are the limitations of one-dimensional advection-diffusion approximation?

One-dimensional advection-diffusion approximation is a simplified model and may not accurately represent the behavior of a complex system. It does not take into account turbulent flow or other non-linear effects, and it may not be applicable to systems with varying boundaries or changing transport properties. Additionally, it assumes a well-mixed substance, which may not always be the case in real-world scenarios.

Back
Top