I would like to solve numerically the diffusion equation, where the sink term depends linearly on the field, and there is field-independent sink:
$\frac{\partial^2 u(x)}{\partial x^2} =f(x)u(x) - \kappa(x)$
At the moment I am solving the above using a finite difference scheme, where I modify the standard laplacian matrix, to encompass the $f(x)u(x)$ term in the diagonal components. I then solve a linear system of the form:
$Ax = b$
Where b is a vector composed of the discretised $\kappa(x)$ term, and $A$ is the standard finite difference laplacian (forgetting about boundary conditions), with modified diagonal components.
The above works fine, but the issue is that I am solving it for the quasi-steady-state at each time step (basically $f(x)$ and $\kappa(x)$ change over time). Since I am required to modify $A$ according to the linear source term at each time step, this means I am required to solve the system afresh each time.
What I would prefer is a method where I modify $b$ each time step, and keep $A$ constant. This would allow me to take advantage of $A$'s constancy, and do the bulk of solving once, and then just apply it at each time step.
I have tried a scheme whereby I use the current time step's value of $u_i$ on the RHS opposed to the future value, leading to a scheme of the form:
$\frac{u^{t+1}_{i+1} + u^{t+1}_{i-1} - 2u^{t+1}_i}{2h} = f_i u^t_i - \kappa_i$
However, this does not seem to work, and leads to instability/non-convergent behaviour.
Does anyone know of any schemes which would allow me to keep $A$ constant, and only modify $b$?
Alternatively, more generally can anyone tell me if there are other methods which might be better than finite difference in this case?
Best,
Ben