# Explicit solution of heat/diffusion equation

1. Nov 23, 2007

### Holofernes

I am trying to use a explicit FDM for transient 1d conditions with linear elements for specific diffusion equation:

ds/dt=D(x)*d2s/dx2+R(s)

the problem is that I am using different, nonlinear functions describing diffusion constant D(x) and reaction rate R(s).
The diffusion parameter is dependent on position along x and in general case is a function with non-continuous dD(x)/dx at some points. I am using average value of diffusion parameter for each linear element but the solution seems to be not right. I think that is the problem, because when I use constant D everything looks all right. Especially plot of d2s/dx2 is very wired.
What I am doing wrong?
Thanks.

2. Nov 23, 2007

### Chris Hillman

Huh?

FDM?

Wired as in wire-frame plot? Or is that "weird"?

3. Nov 23, 2007

### Holofernes

'wired' as strange. it has to many bumps. should be less compicated in places where D is changing

4. Nov 28, 2007

### Chris Hillman

Gentle hint

So, weird as in "strange"? Too many bumps? Less complicated? And what is FDM? "Finite difference method", perchance? Is your diffusion equation
$$\frac{\partial u}{\partial t} = f(x) \, \frac{\partial^2 u}{\partial x^2}+ g(u)$$
where u is an unknown function of x,t and f,g are known functions of one variable, and where f is continuous but only piecewise differentiable? You hinted at initial conditions--- what are they?

Last edited: Nov 28, 2007