Influence of an electromagnetic field on the formation of wet metal foam