# Transforming a 1D cartesian variable-coefficient diffusion code into a 1D adially symmetric one

So I have a code that I use which solves a 1D variable coefficient diffusion problem in cartesian coordinates:

$\frac{\partial u}{\partial t}=\frac{\partial}{\partial x}\left(D(x)\frac{\partial u}{\partial x}\right)$.

It solves the equation implicitly using a backward euler discretization. it works fine, but I want to convert it into a spherically symmetric code. The problem is that I can't find information on how to do this for variable coefficients. I would appreciate if someone shows me the specific modifications I need to make.

Also, how much different those the solution for this equation looks in a 1D cartesian slab vs a 1D spherically symmetric radial slab? If they look about the same then maybe I shouldn't do the modifications. Thanks!

If you take axial and azimuthal symmetry into consideration, you can derive a similar equation in $r$ that includes metric terms, i.e.: \begin{equation} \frac{\partial u}{\partial t} = \frac{1}{r} \frac{\partial}{\partial r} \left( D(r) r \frac{\partial u}{\partial r} \right) \quad , \end{equation} As you can see, it does not really matter in this approach whether your diffusion coefficient is constant or not.