Micromagnetic simulations of the magnetization dynamics in nanostructures with special applications to spin injection