Microstructure and rheology of ferrofluids