I am simulating heat transfer through a 1-dimensional wall with convection on both sides. For the wall, I implemented a finite difference model like this:
$$ u(x, t + ∆t) ≈ u(x, t) + c [u(x + ∆x, t) − 2u(x, t) + u(x − ∆x, t)] $$
where $c = α \frac{∆t}{(∆x)^2}$ and $α$ is the thermal diffusivity. The implementation of this model works fine if I look at only the wall and assume that the temperatures on both ends of the wall are known at all times. Now I would like to extend the model to include convection on both sides of the wall. It looks like the best way to do it is to use convective boundary conditions, as shown here:
$T_{\infty}$ and $h$ are known on both sides, but variable over time. $k$ is known and constant.
I am struggling to find a starting point for the implementation of these boundary conditions as an extension of the above model. Anything that helps me get started will be highly appreciated!
Intuitively, I would guess that for $x = 0$, the above equation would have to look something like this:
$$ u(0, t + ∆t) ≈ u(0, t) + c [u(0 + ∆x, t) − 2u(0, t)] + a * T_{\infty} $$
where $a$ is a function of $h$ and $∆t$. And for $x = L$, an analogous equation will have to be used. Could that be right?