I'm trying to solve the following system of coupled differential equations, the two-temperature model for $e$ = electrons and $l$ = lattice.
$$ \rho_{e}C_{p,e}\frac{\partial T_{e}}{\partial t} = k_{e}\frac{\partial^{2}T_{e}}{\partial x^{2}} - G(T_{e}-T_{l}) + S(x,t) $$ $$ \rho_{l}C_{p,l}\frac{\partial T_{l}}{\partial t} = k_{l}\frac{\partial^{2}T_{l}}{\partial x^{2}} + G(T_{e}-T_{l}) $$
I was thinking of re-casting them into a form suitable for the Crank-Nicolson method, which would be the following if $T_{e}=u_{i}^{n}$ and $T_{l}=v_{i}^{n}$ where $i$ is the space node and $n$ is the time node.
$$ A_{o}u_{i+1}^{n+1} + B_{o}u_{i}^{n+1} + A_{o}u_{i-1}^{n+1} = A_{1}u_{i+1}^{n} + B_{1}u_{i}^{n} + A_{1}u_{i-1}^{n+1} + C_{1}v_{i}^{n} + D_{1}S_{i}^{n} $$ $$ A_{2}v_{i+1}^{n+1} + B_{2}v_{i}^{n+1} + A_{2}v_{i-1}^{n+1} = A_{3}v_{i+1}^{n} + B_{3}u_{i}^{n} + A_{3}v_{i-1}^{n+1} + C_{3}v_{i}^{n} $$
where $A_{o}=-\frac{dt}{\rho_{e}C_{p,e}}\frac{k_{e}}{2dx^{2}}, \ A_{1} = -A_{o}, $ $B_{o}=1+\frac{dt}{\rho_{e}C_{p,e}}\frac{k_{e}}{dx^{2}}, \ B_{1} = 1-\frac{dt}{\rho_{e}C_{p,e}}\frac{k_{e}}{dx^{2}} + G, \ C_{1} = \frac{dt}{\rho_{e}C_{p,e}}G, \ D_{1} = \frac{dt}{\rho_{e}C_{p,e}}$
$A_{2}=-\frac{dt}{\rho_{l}C_{p,l}}\frac{k_{l}}{2dx^{2}}, \ A_{3}=-A_{2}$ $B_{2} = 1+\frac{dt}{\rho_{l}C_{p,l}}\frac{k_{l}}{2dx^{2}}, \ B_{3}=1-\frac{dt}{rho_{e}Cp_{e}}\frac{k_{l}}{2dx^{2}}+G, \ C_{3} = -\frac{dt}{\rho_{l}C_{p,l}}G$
Analytically, this works out but I'm drawing a blank on how to implement it (I want to use Python). I can do each of the equation systems by themselves easily enough, but I was trying to solve both in the same matrix system. I've seen certain attempts at this sort of problem by converting the two unknowns at the updated time into a vector $\vec{W}_{i}^{n+1}=(u_{i}^{n+1},v_{i}^{n+1})^{T}$ but due to the coefficients being different for each (apart from the coupling constant G) I wasn't sure how to go about it.