Heat Equation with cylindrical rod

1. Apr 29, 2013

baseball07

Hello, I am looking to apply to heat equation to a cylindrical rod and solving with explicit finite difference scheme. I have never worked with cylindrical coordinates before, what would be the best way to model this? I am having a hard time understanding the advantage of using cylindrical. Isn't it the same as if I "unrolled" it and took the problem as either a 2-D or 3-D planar geometry with the same surface area? Does anyone have any sample code I can see on how to implement?

2. Apr 29, 2013

AlephZero

You are right, it is similar to a 2-D plane system, except the thickness is not constant, it is $2\pi x$ or $2 \pi y$ depending which axis is the the center line of the cylinder.

When you have set up the finite difference from the differential equation in cylindrical coordinates, you should be able to see how to replace the "variable thickness" terms in the difference scheme with a "constant thickness", and that will give you the exactly the same difference scheme as you used for a 2D plane problem.

This makes it easy to write one program that can solve both plane and axisymmetrcic problems, if you want to do that.

3. Apr 29, 2013

Staff: Mentor

The advantage in using cylindrical coordinates lies in applying the boundary conditions at the outer radius. In cylindrical coordinates, one of the coordinates at the boundary is constant (the radial coordinate), while, in cartesian coordinates, both x and y vary on the boundary, and worse yet, the grid points do not all lie on the boundary. To unroll the cylinder, you have to deform it, and this changes the geometry (and the solution).

I would also like to encourage you not to use an explicit finite difference scheme. I'm sure that this limits the size of the time step you can take for numerical stability. Please consider using an implicit scheme, which can easily be implemented using a tri-diagonal matrix solver.

Chet

4. Apr 30, 2013

baseball07

Thank you for all the suggestions, I will look more deeply into the equations and post questions. As far as explicit stepping, I have some very basic 1-D code and was never able to rewrite it using crank nicholson. I was running into problems in that I did not know how to incorporate the Neumann BC into the matrix (the other is a dirichlet). If someone can help me with this, PM me and I can send you over my code.

5. Apr 30, 2013

bigfooted

With a Neumann condition, you know the value of a node depending on a neighboring value, e.g. for a N-node discretization on [0,R] with Neumann on the left boundary $\frac{\partial u}{\partial r}|_{r=0} = 0$
$u_{1}-u_{0}=0$
discretization for the diffusion term at node 1 is
$u_{2} -2u_1 + u_{0}=0$
You can now replace this with the Neumann bc
$u_{2} - 2u_1 + u_{1}=0$, or:
$u_{2} - u_1=0$

so your unknowns run from u_1...u_N.
If your favorite language starts counting at zero, it will be more convenient to place r=0 at node -1 so your unknowns run from u0..u_N-1

The Crank-Nicolson method is unconditionally stable for the heat equation and the explicit Euler is not (Explicit Euler is mainly used as a classroom example of a simple but bad numerical method).