I have a very simple question concerning Alternating Direction Implicit (ADI) Scheme.
If I have an equation of the form:
\begin{equation*} \frac{df(x,y,t)}{dt} = \nabla^2 f(x,y,t) + f(x,y,t) \end{equation*}
with f, my unknown function.
I know how to use it for the diffusion term, but how should I handle the term $ f(x,y,t)$?
Starting from Crank-Nicolson, I can write:
\begin{equation*} \frac{f^{t+1}_{i,j} - f^{t}_{i,j}}{\Delta t} = \frac{1}{2}(\frac{f_{i+1,j}^{t} - 2 f_{i,j}^{t} + f_{i-1,j}^{t}}{dx^2} + \frac{f_{i+1,j}^{t+1} - 2 f_{i,j}^{t+1} + f_{i-1,j}^{t+1}}{dx^2} \\ + \frac{f_{i,j+1}^{t} - 2 f_{i,j}^{t} + f_{i,j-1}^{t}}{dy^2} + \frac{f_{i,j+1}^{t+1} - 2 f_{i,j}^{t+1} + f_{i,j-1}^{t+1}}{dy^2}) + \frac{1}{2}(f_{i,j}^{t} + f_{i,j}^{t+1}) \end{equation*}
Then, solving implicitly in x and explicitly in y, using ADI, with * beeing the intermediate timestep:
\begin{equation*} \frac{f^{*}_{i,j} - f^{t}_{i,j}}{\frac{\Delta t}{2}} = \frac{f_{i+1,j}^{*} - 2 f_{i,j}^{*} + f_{i-1,j}^{*}}{dx^2} + \frac{f_{i,j+1}^{t} - 2 f_{i,j}^{t} + f_{i,j-1}^{t}}{dy^2} \\ + \frac{1}{2}(f_{i,j}^{t} + f_{i,j}^{*}) \end{equation*}
And after, solving explicitly in x and implicitly in y, using ADI, taking the previous result:
\begin{equation*} \frac{f^{t+1}_{i,j} - f^{*}_{i,j}}{\frac{\Delta t}{2}} = \frac{f_{i+1,j}^{*} - 2 f_{i,j}^{*} + f_{i-1,j}^{*}}{dx^2} + \frac{f_{i,j+1}^{t+1} - 2 f_{i,j}^{t+1} + f_{i,j-1}^{t+1}}{dy^2} \\ + \frac{1}{2}(f_{i,j}^{*} + f_{i,j}^{t+1}) \end{equation*}
I know how to solve everything, my question concerns the term $f(x,y,t)$: is that correct to take the mean between the value at t and * for the first step and the mean of time * and t+1 on the second step?
Thank you very much!