I looked at a similar question to find out how to discretize the heat equation in 2 spacial dimensions at the boundary between two materials. I am required to use explicit method (forward-time-centered-space) to solve. I believe I have arrived at a reasonable approximation with the following:
\begin{align}\frac{T^{k+1}_{i,j}-T^k_{i,j}}{\Delta t}&=\frac1{h^2}\left[\left(\alpha^k_{i+\frac12,j}-\alpha^k_{i-\frac12,j}\right)\left(T^k_{i+\frac12,j}-T^k_{i-\frac12,j}\right)+\left(\alpha^k_{i,j+\frac12}-\alpha^k_{i,j-\frac12}\right)\left(T^k_{i,j+\frac12}-T^k_{i,j-\frac12}\right)\right.\\ &\quad\left.+\alpha^k_{i,j}\left(T^k_{i-1,j}-2T^k_{i,j}+T^k_{i+1,j}\right)+\alpha^k_{i,j}\left(T^k_{i,j-1}-2T^k_{i,j}+T^k_{i,j+1}\right)\right] \end{align}
where any index $\pm\frac12$ represents the average of the value at current index and the one right in front of or behind, i.e.: $$\frac12(T_{i\pm1}+T_{i}).$$
$k$ is the time index, $i,j$ are the spacial indices, $h$ is a grid size, and $\Delta t$ is a time step.
This was determined through the generalized heat equation in $x$ and $y$ dimensions $$\frac{\partial T}{\partial t}=\nabla\cdot\left(\alpha\nabla T\right).$$
I have two questions:
- Is the discretized form of the heat equation above correct? If not, how do I fix it?
- Is it possible to use a nondimensional time step $\tau = \frac{\alpha\Delta t}{h^2}$ for this problem even though the $\alpha$ is changing across materials? If the nondimensional time step is changing, how would I then extract the actual solution in space and time after it is finished solving?