I'm trying to solve a nonlinear heat equation $$ \frac{\partial T}{\partial t} = f(T,z,t) $$
where $$ f(T,z,t) = \alpha(T)\frac{\partial^2 T}{\partial z^2}+\beta(T)\left(\frac{\partial T}{\partial z }\right)^2+\gamma(z,t)\frac{\partial T}{\partial z } $$ $\alpha, \beta$ are nonlinear in $T$ and $\gamma$ is nonlinear in $z$ and $t$. The boundary conditions I have are a Neumann condition $T(0,t) = c$ and a time-varying boundary condition $T(a,t) = S(t)$ at the other end of the boundary. I'm having trouble getting fixed-point iteration to update while obeying the boundary conditions.
To solve this I've tried a Crank-Nicholson scheme with fixed-point iteration. I divide up the interval $[0,a]$ into 500 grid points. As I want to use an implicit fixed-point iteration scheme, I want to update the interior points of the grid as
$$ \begin{equation}T^{i+1}(z) = T^0(z) + \frac{\Delta t}{2}\left( f(T^0,z,t^0)+f(T^i,z,t^i)\right)\end{equation} $$
To ensure boundary conditions are respected, I first set $T^i(0) = c$ and $T^i(a) = S(t^i)$.
I discretize $f(T^i,z_j,t^i)$ (for an interior point) as: $$ f(T^i,z_j,t^i) = \alpha(T^i_j)\left(\frac{T_{j+1}^i-2T_j^i+T_{j-1}^i}{2 (\Delta z)^2}\right)+\beta(T^i_j)\left(\frac{(T_{j+1}^i)^2-2T_{j+1}^i T_{j-1}^i+(T_{j-1}^i)^2}{4 (\Delta z)^2}\right)+\gamma(z_j,t^i)\left(\frac{T_{j+1}^i-T_{j-1}^i}{2 \Delta z}\right) $$
and update all interior $T^{i+1}(z_j)$ according to the equation above. However I've noticed that even after one iteration, I am seeing a gap open up between the boundary values and the interior points. In the image below, orange is the initial condition: a line between the two boundary points. Green is the temperature after one iteration. I don't know why my solution is diverging already: could this be a sign that fixed-point iteration is not applicable here?
