A variational approach is used to solve the linear Stokes problem with
a three-dimensional viscosity in a spherical shell. A semi-spectral m
ethod is proposed to discretize the problem. To minimize the energy fu
nctional on the set of admissible velocities, the gradient method with
projection is employed. The method can be used in studies of planetar
y interiors with complex rheological structures.