Wall losses in microwave cavities will generate a phase difference between the components of the field, and give rise to spatial phase variations which are related to the geometry of complicated shaped metal boundaries. Such effects are important to the design of the cavities used in the field of atomic frequency standards. Past attempts at calculating spatial phase variations in microwave cavities have been either limited to 1-D models or based upon an idealized model of the cavity, which simplifies its boundary shapes and neglects the effect of the source. In this paper, a numerical implementation of an electromagnetic field approach is used to overcome these limitations. The finite element method (FEM) is used to solve the driven form of the electromagnetic wave equation. The results show good agreement with transmission line predictions for a structure having simply shaped metal walls. The spatial phase distribution is then calculated for a 2-D approximation of the fountain cavity operating in the cylindrical TE/sub 011/ mode, which has been recommended for use in a Cs fountain frequency standard. A physical interpretation of the gradient of the phase in the cavity is presented, which shows it to be proportional to power flow.