I need to solve a PDE using finite difference method with the Newton-Raphson Method. In the merhod, I need to calculate the Jacobian matrix of the residual of the discretised PDE.
The PDE may be like:
$$ K\frac{\partial{C}}{\partial{t}} - \nabla\cdot(\lambda\nabla{C}) = q. $$
So the residual $R$ of one time step ($\Delta t$) is
$$ R = K (\partial{C}) - \nabla\cdot(\lambda\nabla{C})\Delta t - q\Delta t $$
Then I need to write the Jacobian of the residual (wrt. $C$; i.e., $\frac{\partial{R}}{\partial{C}}$) for minimizing the residual and finding the solution. Could anyone tell me that what is the discretized form of $\frac{\partial{R}}{\partial{C}}$? A two dimensional spatial discretization (x, y) is OK. Thank you.