SUMMARYA new scheme for differentiating complex mesh-based numerical models (e.g. finite element models), the Independent Set Perturbation Adjoint method (ISP-Adjoint), is presented. Differentiation of the matrices and source terms making up the discrete forward model is realized by a graph coloring approach (forming independent sets of variables) combined with a perturbation method to obtain gradients in numerical discretizations. This information is then convolved with the 'mathematical adjoint', which uses the transpose matrix of the discrete forward model. The adjoint code is simple to implement even with complex governing equations, discretization methods and non-linear parameterizations. Importantly, the adjoint code is independent of the implementation of the forward code. This greatly reduces the effort required to implement the adjoint model and maintain it as the forward model continues to be developed; as compared with more traditional approaches such as applying automatic differentiation tools. The approach can be readily extended to reduced-order models. The method is applied to a one-dimensional Burgers' equation problem, with a highly non-linear high-resolution discretization method, and to a two-dimensional, non-linear, reduced-order model of an idealized ocean gyre.