Mould filling processes, in which a material flow front advances through a mould, are typical examples of moving boundary problems. The moving boundary is accompanied by a moving contact line at the mould walls causing, from a macroscopic modelling viewpoint, a stress singularity. In order to be able to simulate such processes, the moving boundary and moving contact line problem must be overcome. A numerical model for both two-and three-dimensional mould filling simulations has been developed. It employs a pseudo-concentration method in order to avoid elaborate three-dimensional remeshing, and has been implemented in a finite element program. The moving contact line problem has been overcome by employing a Robin boundary condition at the mould walls, which can be turned into a Dirichlet (no-slip) or a Neumann (free-slip) boundary condition depending on the local pseudo-concentration. Simulation results for two-dimensional test cases demonstrate the model's ability to deal with flow phenomena such as fountain flow and flow in bifurcations. The method is by no means limited to two-dimensional flows, as is shown by a pilot simulation for a simple three-dimensional mould. The reverse problem of mould filling is the displacement of a viscous fluid in a tube by a less viscous fluid, which has had considerable attention since the 1960's. Simulation results for this problem are in good agreement with results from the literature.