- #1
ndalchau
- 1
- 0
Dear all,
I'm trying to solve the 2d heat equation in a radially symmetric domain, numerically using the Crank-Nicolson method. i.e.
[tex]\dfrac{\partial u}{\partial t} = D\left( \dfrac{\partial^2u}{\partial r^2}+\dfrac{1}{r}\dfrac{\partial u}{\partial r}\right)[/tex]
Applying the Crank-Nicolson method basically results in a recurrence relation:
[tex](-q+\frac{z}{r})u_{i-1,j+1} + (1+2q)u_{i,j+1} - (q+\frac{z}{r})u_{i+1,j+1} = (q-\frac{z}{r})u_{i-1,j} + (1-2q)u_{i,j} + (q+\frac{z}{r})u_{i+1,j} [/tex]
where [tex]q=\dfrac{\delta t}{2(\delta r)^2}[/tex], [tex]z=\dfrac{\delta t}{4\delta r}[/tex] and [tex]u_{i,j}[/tex] is the solution at [tex]r=i\delta r, t=j\delta t[/tex].
You can write this into a matrix equation of the form [tex]Au\{j+1\}=Bu\{j\}[/tex], which basically enables you to solve the problem. This all works very nicely for the 1d heat equation (the same differential equation but without the first spatial derivative). However, I now have the problem that the solution doesn't conserve mass. That is, given some initial condition across [tex]r\in (0,R)[/tex], the sum of the solution points decreases over time.
Clearly, if the column sums of A and B are the row vector of 1s, then I am guaranteed mass conservation. However, this is not the case for my Crank-Nicolson implementation here. This results from the [tex]\frac{z}{r}[/tex] changing values and signs between neighbouring rows, which means they don't cancel.
Anyone got any comments? Is there a way of solving these parabolic PDEs in radially symmetric domains that preserves the mass conservation law? Or is my implementation incorrect maybe?
Your assistance would be greatly appreciated,
Neil
I'm trying to solve the 2d heat equation in a radially symmetric domain, numerically using the Crank-Nicolson method. i.e.
[tex]\dfrac{\partial u}{\partial t} = D\left( \dfrac{\partial^2u}{\partial r^2}+\dfrac{1}{r}\dfrac{\partial u}{\partial r}\right)[/tex]
Applying the Crank-Nicolson method basically results in a recurrence relation:
[tex](-q+\frac{z}{r})u_{i-1,j+1} + (1+2q)u_{i,j+1} - (q+\frac{z}{r})u_{i+1,j+1} = (q-\frac{z}{r})u_{i-1,j} + (1-2q)u_{i,j} + (q+\frac{z}{r})u_{i+1,j} [/tex]
where [tex]q=\dfrac{\delta t}{2(\delta r)^2}[/tex], [tex]z=\dfrac{\delta t}{4\delta r}[/tex] and [tex]u_{i,j}[/tex] is the solution at [tex]r=i\delta r, t=j\delta t[/tex].
You can write this into a matrix equation of the form [tex]Au\{j+1\}=Bu\{j\}[/tex], which basically enables you to solve the problem. This all works very nicely for the 1d heat equation (the same differential equation but without the first spatial derivative). However, I now have the problem that the solution doesn't conserve mass. That is, given some initial condition across [tex]r\in (0,R)[/tex], the sum of the solution points decreases over time.
Clearly, if the column sums of A and B are the row vector of 1s, then I am guaranteed mass conservation. However, this is not the case for my Crank-Nicolson implementation here. This results from the [tex]\frac{z}{r}[/tex] changing values and signs between neighbouring rows, which means they don't cancel.
Anyone got any comments? Is there a way of solving these parabolic PDEs in radially symmetric domains that preserves the mass conservation law? Or is my implementation incorrect maybe?
Your assistance would be greatly appreciated,
Neil