An Energy Approach to the Calculation of Forces Acting on Solid Bodies in Ferrofluids