Diffusion Equation with source term

Click For Summary
SUMMARY

The discussion focuses on solving a diffusion equation with a source term using numerical methods, specifically the finite differences method in MATLAB or C++. The equation under consideration is dT/dt = d2T/dx2 + S(x), where S(x) is defined by a Gaussian profile. The Crank-Nicolson method is recommended for its stability, while the Forward Euler method is suggested as a simpler alternative despite its limitations with non-linear sources.

PREREQUISITES
  • Understanding of diffusion equations and source terms
  • Familiarity with numerical methods, specifically finite differences
  • Proficiency in MATLAB or C++ programming
  • Knowledge of the Crank-Nicolson and Forward Euler methods
NEXT STEPS
  • Research the implementation of the Crank-Nicolson method for diffusion equations
  • Learn about the Forward Euler method and its applications in numerical integration
  • Explore MATLAB's built-in functions for solving differential equations
  • Investigate the effects of different source term profiles on diffusion equations
USEFUL FOR

Mathematicians, physicists, and engineers involved in numerical analysis, particularly those working with diffusion processes and numerical integration techniques.

iva.mn87
Messages
1
Reaction score
0
I have been asked to solve a diffusion equation with a source term using finite differences method. I need to numerically integrate the following equation either in MATLAB or C++.

The equation is

dT/dt = d2T/dx2 + S(x)

The form of S(x) is some function given by a Gaussian profile.

Could anyone have a solution to the problem!

Thanks!
 
Physics news on Phys.org
What exactly is the problem? How far have you gotten?

I've been working on the same problem, and I solved it by using the Crank-Nicolson method. Look it up on e.g. Wikipedia.

A worse, but far simpler method (especially since the source is non-linear) is to use the Forward Euler method:
[tex]\frac{T(x,t+\Delta t)-T(x,t)}{\Delta t} = \frac{T(x-\Delta x,t)-2T(x,t)+T(x+\Delta x,t)}{(\Delta x)^2} + S(x)[/tex]

Solve for [tex]T(x,t+\Delta t)[/tex] and you get
[tex]T(x,t+\Delta t) = \frac{T(x-\Delta x,t)-2T(x,t)+T(x+\Delta x,t)}{(\Delta x)^2}\Delta t + S(x)\Delta t+T(x,t)[/tex]

So if you know the value of T(x,t) for every x at some time t, you can calculate the value for a future time [tex]t+\Delta t[/tex]
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 8 ·
Replies
8
Views
4K
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 41 ·
2
Replies
41
Views
10K