Lattice Boltzmann simulation of droplet formation in T-junction and flow focusing devices