Mathematical modeling of casting processes in electromagnetic field