This page has links to MATLAB code and documentation for the finite volume solution to the two-dimensional Poisson equation
where is the scalar field variable, is a volumetric source term, and and are the Cartesian coordinates. This equation is a model of fully-developed flow in a rectangular duct, heat conduction in rectangle, and the pressure Poisson equation for finite volume models of fluid flow.
The code allows for non-uniform meshes and variable diffusion coefficient. The code base also provides a test bed for stationary iterative methods (Gauss-Seidel, Jacobi, SOR) and preconditioned Conjugate gradient and Krylov subspace methods.