The principle of the detection relies on the continuous atomlaser scheme [18]. Atoms are localised in a static magnetic trap and are prepared in a Bose–Einstein condensate in a given hyperfine state. Photon absorption from a driving microwave field leads to resonant hyperfine transitions from the trapped to an untrapped state of the atoms. Counting the outcoupled atoms [21], once spatially separated from the trap, characterises the strength of the magnetic field component of the microwave radiation field and gives information on the photon number. A possible geometry is sketched in Fig. 1. In order to enhance the coupling, we consider the near-field of a microwave coplanar waveguide resonator as a source of the radiation field.

### The Bose–Einstein condensate

We consider ultracold ^{87}Rb atoms prepared in the hyperfine manifold \(F=2\) of the ground state \(5 ^{2}\mathrm{S}_{1/2}\), placed in an external magnetic field \(\mathbf{B}(\mathbf {r})\) in the presence of gravity. The total atomic angular momentum \(\hat{\mathbf{F}}\) interacts with the magnetic field according to the Zeeman term \(H_{Z} = g_{F} \mu_{\mathrm{B}} \hat{\mathbf{F}}{\mathbf{B}}(\mathbf {r})\), where \(\mu_{\mathrm{B}} = e\hbar/2 m_{e}\) is the Bohr magneton, \(g_{F}\) is the Landé factor, and \(\hat{\mathbf{F}}\) is measured in units of *ħ*. The dominant component of the magnetic field \(\mathbf{B(\mathbf {r})}\) is a homogeneous offset field \(B_{\mathrm{offs}}\) pointing along the *z* direction. The eigenstates of the spin component \(\hat{F}_{z}\), labelled by \(m_{F}=-2,-1,0,1,2\), are well separated by the Zeeman shift \(\hbar\omega_{0}=\mu_{\mathrm{B}}B_{\mathrm{offs}}/2\) (see Fig. 2), the \(m_{F}=2\) level being the highest in energy (due to the fact that \(g_{F=2}=1/2\)). The inhomogeneous component of the magnetic field \(\mathbf{B}(\mathbf {r})\) creates a harmonic trapping potential \(V_{\mathrm{T}}(\mathbf {r})=\frac{M}{2} [\omega_{x}^{2}x^{2}+ \omega_{y}^{2}y^{2}+\omega_{z}^{2}z^{2} ]\) around the minimum of the total magnetic field in which we assume atoms to be confined in the low-field seeking state \(\vert 2,1 \rangle\). Here \(\omega _{x}\), \(\omega_{y}\) and \(\omega_{z}\) are the trap frequencies in the *x*, *y*, and *z* directions, respectively, and *M* is the atomic mass. In the presence of gravity, the atoms are still under the effect of an effective harmonic trapping potential \(V_{\mathrm{T}}^{\text{eff}}(\mathbf {r})=V_{ \mathrm{T}}(\mathbf {r})+Mgy=\frac{M}{2} [\omega_{x}^{2}x^{2}+ \omega _{y}^{2} (y+g/\omega_{y}^{2} )^{2}+\omega _{z}^{2}z^{2} ]-Mg ^{2}/2\omega_{y}^{2}\), where *g* is the gravitational acceleration. As a result, the trapped atomic cloud is displaced from the minimum of the magnetic field into the minimum of this effective potential, \(-g/\omega_{y}^{2}\), which is the so-called gravitational sag.

The homogeneous offset magnetic field splits the magnetic sublevels of the \(F=1\) manifold as well (see Fig. 2), the splitting between consecutive levels also being \(\hbar\omega_{0}\) (here the \(m_{F}=-1\) level is the highest in energy as \(g_{F=1}=-1/2\)). As the untrapped state of the atoms, we select the state \(\vert 1,0 \rangle\), as it is insensitive to the offset and trapping magnetic fields, and atoms in this state simply fall out of the trap due to gravity. In our setup in Fig. 1 we assume that the dominant component of the CPW’s magnetic field is \(B_{x}(t)\) (cf. Sect. 2.2). \(B_{x}(t)\) is orthogonal to \(B_{\mathrm{offs}}\) and oscillates in time with an angular frequency of \(\omega_{\mathrm{CPW}}\), thus, it can induce transitions between the trapped hyperfine state \(\vert 2,1 \rangle\) and the untrapped \(\vert 1,0 \rangle\) state (as indicated by the green arrow in Fig. 2). We note that there are other possible hyperfine transitions in the ground state manifolds, with a trappable inital state and an untrapped final state, as discussed in Appendix A. Our choice is motivated by the fact that the untrapped state \(\vert 1,0 \rangle\) can fall out of the cloud below the trap due to gravity and is therefore more easily detectable by atom counting techniques, than a state that is repulsed by the trapping magnetic field.

In the mathematical description it is convenient to choose the origin of the *y* axis such that the single-particle potential for the atoms in state \(\vert 1,0 \rangle\) be given by \(V_{ \vert 1,0 \rangle}=Mgy\), corresponding to the fact that the origin coincides with the center of the atomic cloud. Then the total single-particle potential affecting the trapped atomic state is given by \(V_{ \vert 2,1 \rangle}(\mathbf {r})=\hbar \omega_{\mathrm{t}}+V _{\mathrm{T}}(\mathbf {r})\), where \(\omega_{\mathrm{t}}=\varOmega+\omega _{0}+\frac{Mg ^{2}}{2\hbar\omega_{y}^{2}}\) is the transition frequency at the center of the cloud in the presence of gravity, \(\varOmega=2 A_{\mathrm{hfs}} \approx2\pi\times6.8347\) GHz being the hyperfine splitting of the \(5 ^{2}\mathrm{S}_{1/2}\) state, and \(V_{\mathrm{T}}(\mathbf {r})\) is the harmonic part of \(V_{\mathrm{T}}^{\mathrm{eff}}\) in the transformed coordinate system which now has the same form as the trapping potential without gravity.

In the magnetically trapped \(\vert 2,1 \rangle\) state, we assume a pure Bose–Einstein condensate (BEC) described by the second-quantized field operator \(\hat{\varPsi}_{ \vert 2,1 \rangle}(\mathbf {r},t)= \sqrt{N_{0}} \varPhi_{\mathrm{BEC}}(\mathbf {r})\times e^{-i(\omega_{\mathrm{t}}+\mu/\hbar)t}\), where the wavefunction \(\varPhi_{\mathrm{BEC}}\) is the stationary solution of the Gross–Pitaevskii equation with chemical potential *μ* and atom number \(N_{0}\). Atoms in the state \(\vert 1,0 \rangle\), which can be described by the field operator \(\hat{\varPsi}_{ \vert 1,0 \rangle }(\mathbf {r},t)\) are only affected by gravity and, due to collisions with the condensate atoms, by the influence of the mean-field potential \(N_{0}g_{s} \varPhi_{\mathrm{BEC}}^{2}(\mathbf {r})\), with \(g_{s}=4\pi\hbar^{2}a_{s}/M\), and scattering length \(a_{s}\) (\(a_{s}=5.4\) nm for ^{87}Rb).

We consider a setup where at the location of the BEC the microwave magnetic field is quasi-homogeneous in the *x* direction, and oscillates in time with a frequency of \(\omega _{\mathrm{CPW}}\), i.e., \(B_{x}(t)=B_{x}\cos(\omega_{\mathrm {CPW}}t)\). As discussed in Appendix A, in our case, it is the electron spin magnetic moment which determines the coupling of the atomic magnetic moment with this magnetic field, so that the corresponding perturbation can be written as \(V_{I}=g_{S} \mu_{\mathrm{B}} B_{x}(t) \hat{S}_{x}\), where \(\hat{S}_{x}=(\hat{S} _{+}+\hat{S}_{-})/2\), \(S_{x}\) being the *x* component of the electron spin operator, with \(S_{+}\) and \(S_{-}\) the spin raising and lowering operators. We assume that initially no atoms populate the \(\vert 1,0 \rangle\) state. To leading order in the small quantum field amplitude \(\hat{\varPsi}_{ \vert 1,0 \rangle}\), the equation of motion in rotating-wave approximation reads

$$\begin{aligned} i\hbar\frac{\partial}{\partial t}\hat{\varPsi}_{ \vert 1,0 \rangle} = \biggl[- \frac{ \hbar^{2}\nabla^{2}}{2M}+Mgy+ N_{0}g_{s} \varPhi_{\mathrm{BEC}}^{2}( \mathbf {r}) \biggr] \hat{\varPsi}_{ \vert 1,0 \rangle} -\hbar \eta \varPhi_{\mathrm{BEC}}(\mathbf {r}) e^{i\Delta\cdot t} , \end{aligned}$$

(1)

where \(\eta=\sqrt{3}\mu_{\mathrm{B}} B_{x} \sqrt{N_{0}}/4 \sqrt{2}\hbar\) and \(\Delta=\omega_{\mathrm{CPW}}-\omega_{{\text{t}}}- \mu/\hbar\) is the detuning of the microwave frequency from the transition frequency at the center of the atomic cloud. Here we considered the BEC as an undepleted reservoir, i.e., the quantum fluctuation \(\delta\hat{\varPsi}_{ \vert 2,1 \rangle}\) was neglected in comparison with \(\varPhi_{\mathrm{BEC}}\) as it corresponds to a second-order process. Furthermore, we assumed that the quantum field components in the \(\vert 1,m_{F}\neq0 \rangle\), or the \(\vert 2,m_{F}\neq1 \rangle\) sublevels are also negligible when the \(\vert 2,1 \rangle\rightarrow \vert 1,0 \rangle\) transition is on resonance with the microwave frequency as they are detuned by \(\Delta\omega\geq\hbar\omega_{0}\). Finally, we neglect the transitions \(\vert 1,0 \rangle\rightarrow \vert 2,1 \rangle\) back to the condensate, originating from the matrix element \(\langle2,1 \vert \hat {S}_{+} \vert 1,0 \rangle \neq0\), because we assume that the atoms fall out of the trap before completing a Rabi cycle. Within these approximations, the dynamics of the outcoupled field \(\hat{\varPsi}_{ \vert 1,0 \rangle}(\mathbf {r},t)\) is decoupled from the other Zeeman states.

The solution to the partial differential equation (1) is outlined in Appendix B. Here we note that the outcoupled atom field \(\hat{\varPsi}_{ \vert 1,0 \rangle}\) can be constructed by using plane waves in the horizontal directions, and the solutions of the quantum mechanical free-fall problem, i.e., the Airy functions, in the vertical direction. The absolute square of the outcoupled atom field describes the local density of atoms at a position **r**, even if the underlying Airy-type of wavefunctions are not normalizable, and, according to Eq. (10) can be expressed as

$$\begin{aligned} N(\mathbf {r}) = \bigl\langle \hat{\varPsi}_{ \vert 1,0 \rangle }^{\dagger} (\mathbf {r}) \hat{\varPsi}_{ \vert 1,0 \rangle} (\mathbf {r}) \bigr\rangle = \biggl(\frac{\hbar \eta}{Mgl_{0}} \biggr)^{2} D(\mathbf {r}), \end{aligned}$$

(2)

where \(l_{0}= (\hbar^{2}/2M^{2}g )^{1/3}\) is the natural length of the Airy function. \(D(\mathbf {r})\) is a density function in coordinate space with the dimension of 1/volume, and it accounts for the fact that in the outcoupling process the energy of the microwave magnetic field is distributed among the three coordinate directions in the outcoupled atom field. Its value for a given detuning Δ between the frequency of the microwave field and the transition frequency of the atoms inside the cloud, is mainly affected by the overlap between the Airy function and the BEC wave function (the latter being dependent on the geometrical shape of the cloud), and the distance of the spatial location **r** from the atomic BEC as can be seen from Eq. (11) and (12). In Ref. [18] it was shown that for a spherical BEC of radius \(a\gg l_{0}\), \(D(\mathbf {r})\) is maximum when \(\Delta\approx0\), i.e., when the detuning of the frequency of the outcoupling magnetic field from the transition frequency at the center of the BEC is zero, therefore, in what follows, we will focus on this case.

### Coplanar waveguide resonator

We consider a (superconducting) half-wavelength coplanar waveguide resonator (CPW) of length *L* with a central conductor strip of width *S* and two ground electrodes of width *w* at a distance *W* from the central conductor situated on a substrate of thickness *h* and relative permittivity \(\varepsilon_{\mathrm{r}}\) (see Fig. 1). The electric and magnetic fields of the resonator oscillate in time with a frequency of \(\omega_{\mathrm{CPW}}\), with their maxima shifted in space: The magnetic field has the largest amplitude at the center of the central conductor, where the electric field is zero, and zero at the two ends, where the electric field has a maximum amplitude. For the amplitude of the components of the magnetic field analytic formulas obtained by the quasistatic approximation are presented in Appendix C. Here we assume that the (half) transversal size of the CPW, \(b=S/2+W+w\), is much smaller than the wavelength \(\lambda =2\pi c/\omega_{\mathrm{CPW}}\) of the microwave field of the cavity (*c* being the speed of light in vacuum). In this case, the *z* component of the magnetic field, \(B_{z}(t)\), can be neglected compared to the other components (see Eq. (13)). \(B_{x}(t)\) may be considered to be the dominant component of the magnetic field around the center of the central conductor, as its amplitude \(B_{x}\) has a cosine shape in the transversal direction, and is maximum at the center. The amplitude of \(B_{y}(t)\), on the other hand, has a sinusoidal dependence on the transversal coordinate, is zero at the center, and grows approximately linearly in the transversal direction in the close neighborhood of the center, where, the amplitude \(B_{x}\), due to its cosine shape, may be approximated to be constant. In our setup, we assume that the BEC cloud is situated under the center of the CPW (see Fig. 1). Thus, we neglect the effect of \(B_{y}(t)\) on the atoms as well as the inhomogeneity of the amplitude \(B_{x}\), and approximate the latter with its value at the center of the BEC cloud. These assumptions are plausible as the atom density in the condensate is the largest around the center of the cloud and decreases rapidly in the radial direction.

As we have shown in Sect. 2.1, in order to effectively couple the CPW to the hyperfine transition \(\vert 2,1 \rangle\rightarrow \vert 1,0 \rangle\) of the BEC atoms, the microwave frequency of the resonator should be resonant with the transition frequency of the atoms at the center of the BEC, corresponding to \(\Delta=0\), i.e., \(\omega_{\mathrm{CPW}}= \omega_{\mathrm{t}}+\mu/\hbar\). Due to the effect of gravity, the transition frequencies at the top and bottom of the atom cloud are detuned by \(-Mga/\hbar\) and \(Mga/\hbar\) from \(\omega_{\mathrm{CPW}}\), respectively, with *a* being the semi-axis of the condensate in the direction of gravity. As long as the corresponding bandwidth \(2Mga/\hbar\) is larger than the linewidth of the CPW resonator mode, the full power spectrum of the field mode contributes to the outcoupling of the atoms. In the case we consider, there is an order of magnitude difference, which justifies the monochromatic approximation which was assumed when we derived Eq. (2).

As the mode wavelength corresponding to \(\omega_{\mathrm{CPW}}\) is given as \(\lambda_{g}=\lambda/ \sqrt{\varepsilon_{\text{eff}}}=2\pi c/( \omega_{\mathrm{CPW}}\sqrt{\varepsilon_{\mathrm{eff}}})\), a CPW of length \(L=\lambda_{g}/2\) is needed. We note that the effective dielectric constant \(\varepsilon_{\text{eff}}\) can be aproximated by analytical methods using the conformal mapping technique [22] cf. Appendix D.