- #1
maka89
- 68
- 4
Hey! I'm currently solving the heat equation using finite differences. I have a conductivity [itex]k(u)[/itex] that varies greatly with temperature. It even drops to zero at [itex]u=0[/itex].
I have discretized the equations the following way:
[itex]\frac{\partial}{\partial x}\left( k(u) \frac{\partial u}{\partial x}\right) = \alpha \frac{\partial u}{\partial t}[/itex]
[itex]\frac{1}{\Delta x^2}\left( k_{i+\frac{1}{2}}(u_{i+1}-u_i) - k_{i-\frac{1}{2}}(u_{i}-u_{i-1}) \right) = \alpha \frac{\partial u}{\partial t}[/itex]
My question is basically how to choose [itex] k_{i+1/2} [/itex] in a clever way. One way is to use [itex] k_{i+1/2} = (k_{i}+k_{i+1})/2[/itex](If k is discretized). Another to use [itex]k_{i+1/2} = k(x_i + \Delta_x/2)[/itex].
But the method I am considering is to choose [itex] k_{i+1/2} [/itex] in such a way that the total heat moved between the gridpoints is equal to [itex] k_{i+1/2}(u_{i+1}-u_{i}) [/itex], assuming that u(x) is linear between the gridpoints.
Thus we get: [itex]k_{i+1/2}\frac{(u_{i+1}-u_{i})}{\Delta x}\Delta x = \int_{u_i}^{u_{i+1}} k(u) \frac{\partial u}{\partial x} dx = \int_{u_i}^{u_{i+1}} k(u) du [/itex] or [itex]k_{i+1/2} = \frac{1}{(u_{i+1}-u_{i})} \int_{u_i}^{u_{i+1}} k(u) du[/itex].
What do you guys think of the approach? Is it reasonable? This essentially becomes a finite volume method does it not? Will it work even in two dimensions, without further complications?
I have discretized the equations the following way:
[itex]\frac{\partial}{\partial x}\left( k(u) \frac{\partial u}{\partial x}\right) = \alpha \frac{\partial u}{\partial t}[/itex]
[itex]\frac{1}{\Delta x^2}\left( k_{i+\frac{1}{2}}(u_{i+1}-u_i) - k_{i-\frac{1}{2}}(u_{i}-u_{i-1}) \right) = \alpha \frac{\partial u}{\partial t}[/itex]
My question is basically how to choose [itex] k_{i+1/2} [/itex] in a clever way. One way is to use [itex] k_{i+1/2} = (k_{i}+k_{i+1})/2[/itex](If k is discretized). Another to use [itex]k_{i+1/2} = k(x_i + \Delta_x/2)[/itex].
But the method I am considering is to choose [itex] k_{i+1/2} [/itex] in such a way that the total heat moved between the gridpoints is equal to [itex] k_{i+1/2}(u_{i+1}-u_{i}) [/itex], assuming that u(x) is linear between the gridpoints.
Thus we get: [itex]k_{i+1/2}\frac{(u_{i+1}-u_{i})}{\Delta x}\Delta x = \int_{u_i}^{u_{i+1}} k(u) \frac{\partial u}{\partial x} dx = \int_{u_i}^{u_{i+1}} k(u) du [/itex] or [itex]k_{i+1/2} = \frac{1}{(u_{i+1}-u_{i})} \int_{u_i}^{u_{i+1}} k(u) du[/itex].
What do you guys think of the approach? Is it reasonable? This essentially becomes a finite volume method does it not? Will it work even in two dimensions, without further complications?
Last edited: