maka89
- 66
- 4
Hey! I'm currently solving the heat equation using finite differences. I have a conductivity k(u) that varies greatly with temperature. It even drops to zero at u=0.
I have discretized the equations the following way:
\frac{\partial}{\partial x}\left( k(u) \frac{\partial u}{\partial x}\right) = \alpha \frac{\partial u}{\partial t}
\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}
My question is basically how to choose k_{i+1/2} in a clever way. One way is to use k_{i+1/2} = (k_{i}+k_{i+1})/2(If k is discretized). Another to use k_{i+1/2} = k(x_i + \Delta_x/2).
But the method I am considering is to choose k_{i+1/2} in such a way that the total heat moved between the gridpoints is equal to k_{i+1/2}(u_{i+1}-u_{i}), assuming that u(x) is linear between the gridpoints.
Thus we get: 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 or k_{i+1/2} = \frac{1}{(u_{i+1}-u_{i})} \int_{u_i}^{u_{i+1}} k(u) du.
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:
\frac{\partial}{\partial x}\left( k(u) \frac{\partial u}{\partial x}\right) = \alpha \frac{\partial u}{\partial t}
\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}
My question is basically how to choose k_{i+1/2} in a clever way. One way is to use k_{i+1/2} = (k_{i}+k_{i+1})/2(If k is discretized). Another to use k_{i+1/2} = k(x_i + \Delta_x/2).
But the method I am considering is to choose k_{i+1/2} in such a way that the total heat moved between the gridpoints is equal to k_{i+1/2}(u_{i+1}-u_{i}), assuming that u(x) is linear between the gridpoints.
Thus we get: 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 or k_{i+1/2} = \frac{1}{(u_{i+1}-u_{i})} \int_{u_i}^{u_{i+1}} k(u) du.
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: