Modelling of electromagnetic fields in thin heterogeneous layers with application to field generation by volcanoes—theory and example