Gear pumps are frequently used for the transport of high-viscosity fluids, for instance, for the extrusion of polymers. The flow rate of this extrusion process is regularly controlled by an external gear pump. In this work, the 2D flow of a viscous fluid through such an external gear pump is studied using the finite element method. Local mesh refinement based on the respective distance between moving boundaries is essential to capture the relatively narrow clearances in the pump. The gear pump works against the pressure driven flow, therefore its performance is strongly dependent on material and processing parameters. The flow of Newtonian and shear-thinning fluids through the external gear pump is studied for a range of processing conditions. Pump curves are obtained that display the volumetric efficiency against the Hersey number, which is defined as viscosity times rotation speed divided by pressure difference over the pump. Analysis of the residence time of the fluid in the pump, shows that vortices are present in the inflow channel causing material to remain in the pump for longer times.