An important issue in the numerical modelling of ocean dynamics is how to improve the predictive capabilities of models which include the representation of complex local flows around and over coastal topography. Four-dimensional (space and time) variational data assimilation represents a means to achieve this and can be realised using adjoint methods. An advantage of this approach is that it is able to fit a numerical simulation to observational data over both space and time. In this work, an adjoint method for an adaptive mesh forward model is developed and its correctness and feasibility verified. Here a forward and adjoint model, both based upon adaptive unstructured mesh finite element techniques, is tested by inverting boundary conditions in two-dimensional barotropic flow near a coastal headland. The inversion method uses independent adapting meshes for the forward and adjoint solution fields. This means that the transient characteristics of the different solution fields may be taken into account in the optimised computational meshes. The issues and advantages of this new data assimilation method are discussed. The computational efficiency of the method is presented. The robustness of the inversion (adjoint) model is tested by assimilating noisy and sparse observations into the model. It is seen that the inversion model can extract the mean observation information and produce good quality inversion results.