We investigate numerically magnetoconvection in a rapidly rotating sph
ere. The model consists of a fluid filled sphere, internally heated, a
nd rapidly rotating in the presence of both a mean toroidal magnetic f
ield and a mean poloidal field. Motivated by the geodynamo problem, we
take the magnetostrophic approximation, that is to say we neglect ter
ms proportional to the Ekman number and the Rossby number in the momen
tum equation. All variables are approximated spectrally in both the ra
dial and meridional directions. A modal dependence is assumed azimutha
lly. The induction and temperature equations are time stepped pseudosp
ectrally in the angular coordinate, and by collocation in the radial c
oordinate,while the momentum equation, now diagnostic, is solved at ea
ch time step to give the nonaxisymmetric velocity field. Critical Rayl
eigh numbers and corresponding frequencies are obtained at given azimu
thal wavenumber, Roberts number and strengths of the imposed toroidal
and poloidal magnetic fields. The results, which include purely magnet
ic instabilities, are discussed and compared with related studies of m
agnetoconvection, with and without the presence of an inner core, carr
ied out at small but finite Ekman number or with stress-free boundary
conditions.