A coupled field-circuit approach to 3D FEM analysis of electromechanical devices