Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Diffusion Equation with source term

  1. Sep 3, 2009 #1
    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!
     
  2. jcsd
  3. Sep 3, 2009 #2
    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]
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Diffusion Equation with source term
  1. Diffusion theory (Replies: 5)

  2. Diffusion coefficient. (Replies: 2)

  3. Diffusion path (Replies: 1)

  4. Diffusion length (Replies: 1)

Loading...