A model of a magnetic field in the geomagnetosphere