Influence of grains on the electromagnetic ac response of superconducting materials