  We have recently developed a position-dependent quantization scheme for
describing the ladder and effective photon-number operators associated with the
electric field to analyze quantum optical energy transfer in lossy and
dispersive dielectrics [Phys. Rev. A, 89, 033831 (2014)]. While having a simple
connection to the thermal balance of the system, these operators only described
the electric field and its coupling to lossy dielectric bodies. Here we extend
this field quantization scheme to include the magnetic field and thus to enable
description of the total electromagnetic field and discuss conceptual
measurement schemes to verify the predictions. In addition to conveniently
describing the formation of thermal balance, the generalized approach allows
modeling of the electromagnetic pressure and Casimir forces. We apply the
formalism to study the local steady state field temperature distributions and
electromagnetic force density in cavities with cavity walls at different
temperatures. The calculated local electric and magnetic field temperatures
exhibit oscillations that depend on the position as well as the photon energy.
However, the effective photon number and field temperature associated with the
total electromagnetic field is always position-independent in lossless media.
Furthermore, we show that the direction of the electromagnetic force varies as
a function of frequency, position, and material thickness.
