Flux expulsion in niobium superconducting radio-frequency cavities of different purity and essential contributions to the flux sensitivity

Magnetic flux trapped during the cooldown of superconducting radio-frequency cavities through the transition temperature due to incomplete Meissner state is known to be a significant source of radio-frequency losses. The sensitivity of flux trapping depends on the distribution and the type of defects and impurities which pin vortices, as well as the cooldown dynamics when the cavity transitions from a normal to superconducting state. Here we present the results of measurements of the flux trapping sensitivity on 1.3 GHz elliptical cavities made from large-grain niobium with different purity for different cooldown dynamics and surface treatments. The results show that lower purity material results in a higher fraction of trapped flux and that the trapped flux sensitivity parameter $S$ is significantly affected by surface treatments but without much change in the mean free path $l$. We discuss our results within an overview of published data on the dependencies of $S(l,f)$ on $l$ and frequency $f$ using theoretical models of rf losses of elastic vortex lines driven by weak rf currents in the cases of sparse strong pinning defects and collective pinning by many weak defects. Our analysis shows how multiscale pinning mechanisms in cavities can result in a maximum in $S(l)$ similar to that observed by the FNAL and Cornell groups and how pinning characteristics can be extracted from the experimental data. Here the main contribution to $S$ come from weak pinning regions at the cavity surface, where dissipative oscillations along trapped vortices perpendicular to the surface propagate into the bulk well beyond the layer of rf screening current.

Magnetic flux trapped during the cooldown of superconducting radio-frequency cavities through the transition temperature due to incomplete Meissner state is known to be a significant source of radio-frequency losses. The sensitivity of flux trapping depends on the distribution and the type of defects and impurities which pin vortices, as well as the cooldown dynamics when the cavity transitions from a normal to superconducting state. Here we present the results of measurements of the flux trapping sensitivity on 1.3 GHz elliptical cavities made from large-grain niobium with different purity for different cooldown dynamics and surface treatments. The results show that lower purity material results in a higher fraction of trapped flux and that the trapped flux sensitivity parameter S is significantly affected by surface treatments but without much change in the mean free path l. We discuss our results within an overview of published data on the dependencies of S(l, f ) on l and frequency f using theoretical models of rf losses of elastic vortex lines driven by weak rf currents in the cases of sparse strong pinning defects and collective pinning by many weak defects. Our analysis shows how multiscale pinning mechanisms in cavities can result in a maximum in S(l) similar to that observed by the FNAL and Cornell groups and how pinning characteristics can be extracted from the experimental data. Here the main contribution to S come from weak pinning regions at the cavity surface, where dissipative oscillations along trapped vortices perpendicular to the surface propagate into the bulk well beyond the layer of rf screening current. However, the analysis of S as a function of only the mean free path is incomplete since cavity treatments change not only l but pinning characteristics as well. The effect of cavity treatments on pinning is primarily responsible for the change of S without much effect on l observed in this work. It also manifests itself in different magnitudes and peak positions in S(l), and scatter of the S-data coming from the measurements on different cavities which have undergone different treatments affecting both l and pinning. Optimizations of flux pinning to reduce flux sensitivity at low rf fields is discussed.

I. INTRODUCTION
The performance of superconducting radio-frequency (SRF) cavities is measured in terms of the dependence of the unloaded quality factor Q 0 = G/R s on the accelerating gradient, E acc , where the factor G depends on the cavity geometry, and R s (E acc ) is an average surface resistance. Recent advances in the processing of bulk niobium cavities have resulted in significant improvements of the quality factor and reducing R s via diffusion of impurities over a few micrometers from the inner surface of the cavities [1,2]. It has been shown both experimentally and theoretically that additional rf losses result from a residual magnetic flux trapped in the superconductor in the form of quantized magnetic vortices during the cavity cooldown through the superconducting transition temperature, T c . Understanding the physics of this process is important to minimize the amount of trapped magnetic flux and reduce the RF losses. For instance, it was found that the amount of trapped flux is affected by the cooling rate, as well as the magnitude and direction of the temperature gradient during the cavity transition to the superconducting state [3][4][5][6][7][8]. * dhakal@jlab.org The typical material used for the fabrication of SRF cavities is bulk, 3 − 5 mm thick, fine-grain (∼ 50 µm average grain size) niobium with the normal state residual resistivity ratio (RRR) of ∼ 300. Large-grain niobium, with grain size typically greater than ∼ 1 cm, is an alternative material for the fabrication of SRF cavities [9]. One study showed that the losses due to trapped magnetic flux in a large-grain Nb cavity were lower than typically measured in fine-grain cavities of comparable purity and for similar temperature gradients [10]. Furthermore, experiments on SRF cavity-grade Nb samples showed that pinning in large-grain Nb is weaker than in fine-grain niobium [11]. The ability to expel flux in fine-grain cavities improved after annealing in a vacuum furnace at 900-1000 • C [12], which typically results in grain growth and reduction of density of dislocations.
Flux trapping occurs due to pinning of flexible line vortices by materials defects distributed throughout the cavity wall. Yet not all of these vortices contribute to the rf losses as the rf dissipation is due to the oscillation of vortex segments driven by the rf current at the surface. Figure 1 depicts four representative configurations of pinned vortices in the equatorial region of the cavity: normal to the surface, pinned by strong single pins or pinned collectively by array of weak pins, parallel to the surface, or pinned deeper in the bulk.
There can be multiple pinning mechanisms even in high-purity niobium, with stronger pinning by large nonsuperconducting precipitates like hydrides, grain boundaries, dislocation networks and weaker collective pinning of randomly distributed small precipitates or impurities resulting in local variations of mean free path, δl or critical temperature, δT c (see, e.g., a review [13][14][15]). It is known that impurities can play a major role in determining the performance of niobium SRF cavities, and treatments such as low-temperature baking (LTB) [16] or doping by thermal diffusion [1,2] allow changing the superconducting properties at the surface. Such treatments could not only change the mean free path in the normal state but also affect the spatial distribution, density and strength of pinning centers. Experimentally, the impact of trapped vortices on Q 0 (E acc ) is characterized by a trapped flux sensitivity, S = R res /B 0 , given by the ratio of the residual surface resistance, R res and the magnitude of the trapped flux, B 0 . Such quantity reflects the overall dissipation due to vortices trapped by different pinning centers and for different configurations, some of which are shown in Fig. 1.

FIG. 1.
A sketch of the curved cavity wall with trapped vortices in the equator region (not in scale). Dots represent pinning centers, and red lines represent flexible line vortices. The rf current flows in the inner surface layer within the London penetration depth ∼ λ. Vortices 1 and 2 have segments normal to the surface, 1 is pinned by one strong pin, and 2 is pinned collectively by several weak pins. Vortex 3 has two pinned segments parallel to the surface within λ. Vortex 4 is not exposed to the rf field and does not contribute to rf losses.
Recent studies focused on the dependence of S at low rf field (∼ 20 mT) on the mean free path and the frequency [17][18][19] of fine-grain, high-purity elliptical cavities. In such studies, different mean free path values resulted from different annealing processes. However, such processes can also alter the pinning characteristics. The objective of this work is twofold: (i) to evaluate the low-field S-parameter in large-grain cavities with different bulk impurities concentration and structural defects to infer the ability of such impurities and defects to pin vortices and (ii) to compare the results with published data and with theoretical models of the rf dissipation of vortices pinned with different orientations with respect to the surface and with different pinning strength.
The paper is organized as follows. In Sec. II the experimental setup used for the measurements of S is described. In Sec. III we present the results of our measurements of the flux sensitivity parameter S. In Sec. IV we compare our experimental data with other data published in the literature and fit the data using different theoretical models to infer flux pinning characteristics and other important superconducting parameters. In Sec. V we discuss contributions of different pinning mechanisms to S and the effect of the mean free path on superconducting parameters which control S. Sec. VI gives the main conclusions of our work.
II. EXPERIMENTAL SETUP Three 1.3 GHz single-cell cavities made from discs cut from ingots with different purity were used for this study. The cell shape is that of the cavities for the TESLA/XFEL project [20], cavity TC1N1 is a centercell shape (G = 269.8 Ω), cavities G2 and KEK-R5 are end-cell shape (G = 271.6 Ω). The cavity name, ingot Nb manufacturer and main interstitial impurities for each ingot are shown in Table I.
The cavity TC1N1 and G2 were fabricated and processed at Jefferson Lab [21,22], whereas the cavity KEK-R5 was fabricated and processed initially at KEK [23][? ]. All three cavities were electropolished, removing ∼ 20 µm of material from the inner surface, prior to this study.
To explore the effect of the surface preparation on the flux expulsion and the sensitivity of R res to trapped flux, the cavity G2 was re-measured after nitrogen doping. The doping procedure consisted of annealing the cavity at 800 • C for 3 hours in vacuum, followed by 2 minutes of exposure to nitrogen at pressure ∼ 25 mTorr. The nitrogen was then evacuated and the cavity temperature was maintained at 800 • C for 6 minutes. The cavity was electropolished to remove ∼ 7 µm from the inner surface.
Another treatment which affects the near-surface superconducting rf properties of niobium is the LTB. After electropolishing, the cavity KEK-R5 was baked at 120 • C for 24 hours in ultra-high vacuum and re-tested.
The setup of the experiment is shown in Fig. 2. A Helmholtz coil of diameter ∼ 30 cm was used to create a uniform magnetic field around the cell. Three singleaxis cryogenic flux-gate magnetometers (FGM) (Mag-F, Bartington) were mounted on the cavity surface parallel to the cavity axis in order to measure the residual magnetic flux density at the cavity outer surface during the cooldown process. Two magnetic sensors were placed at the equator, ∼ 180 • apart, whereas one sensor was placed on the beam tube, close to the iris, to ensure the uniformity of the magnetic flux before the cooldown. The magnetic field uniformity within the cavity enclosure is ∼ ±1 mG. Six calibrated temperature sensors (Cernox, Lakeshore) were mounted on the cavity: two at the top iris, ∼ 180 • apart, two at the bottom iris, ∼ 180 • apart, and two at the equator, close to the flux-gate magnetometers. The distance between the temperature sensors at top and bottom iris is ∼ 20 cm. The measurement procedure is as follows: (i) the magnetic field was initially set below 2 mG using the field compensation coil that surrounds the vertical dewar, without any current applied to the Helmholtz coils. (ii) the standard cavity cool-down process was applied, resulting in ∼ 4 K temperature difference between the top and bottom iris, corresponding to a temperature gradient of ∼ 0.2 K/cm. The temperature and magnetic field were recorded until the dewar was full with liquid He and a uniform temperature of 4.3 K was achieved. (iii) Q 0 (T ) at low rf field (peak surface rf magnetic field B p ∼ 10 mT) from 4.3 − 1.5 K was measured using the standard phaselock technique. (iv) The cavity was warmed-up above T c (∼ 9.2 K). (v) The cavity was cooled back down to 4.3 K while keeping the temperature difference between two irises below 0.1 K and recording the temperature and magnetic field. (vi) Q 0 (T ) from 4.3−1.5 K was measured once more. (vi) The cavity was warmed up above T c and the current on the Helmholtz coils is set to a certain value. Steps (ii) to (v) were repeated for three different values of magnetic field. Fig. 3 shows the results of a magnetostatic finite element analysis using the software COMSOL [24] for a single-cell cavity of the same geometry as the one used for our experiments. A magnetic field of 10 mG was applied along the cavity axis and the color map shows the distribution of the magnetic field calculated for a perfectly diamagnetic cavity in the ideal superconducting state. Figure 3(b) shows the ratio of the magnetic field just outside the equator in the superconducting state divided by the applied field as a function of the permeability of the cavity. Different values of permeability represent different amount of trapped magnetic field.

A. Cool-down and flux expulsion
The ratio of the residual dc magnetic field measured after (B sc ) and before (B n ) the superconducting transition qualitatively explains the effectiveness of the flux expulsion during the transition. A value of B sc /B n = 1 represents complete trapping of magnetic field during cooldown, whereas a flux expulsion ratio of 1.7 at the equator and 0.4 at the iris would result from the ideal superconducting state, as shown in Fig. 3(b). Experimentally, B sc /B n depends on the Nb material and on the temperature gradient along the cavity axis during the cool-down. Values of B sc /B n close to the theoretical estimate could be achieved with high temperature gradient (∆T > 10 K) [4,10,12,17]. A representative plot of the residual magnetic field at the FGMs locations measured during one cool-down cycle for cavity G2 is shown in Fig. 4. The average value of B sc /B n for the two FGMs at the equator was 1.45 ± 0.05, whereas B sc /B n = 0.35 for the FGM close to the iris. The jumps in magnetic flux density occurred at 8.9 K for sensor m1, 9.1 K for sensors m2 and 9.3 K for sensor m3. The temperature difference between the top and bottom iris when the bottom iris reached 9.2 K was 2.6 K. Figure 5 shows the average flux expulsion ratio at the equator measured for the three cavities (TC1N1, KEK- R5 and G2) after removal of ∼ 20 µm from the inner surface by electropolishing and after N-doping of cavity G2 and LTB of cavity KEK-R5. All three cavities showed good flux expulsion with B sc /B n ∼ 1.5 when the temperature difference between irises was greater than 4 K.

B. rf measurements
The average rf surface resistance was obtained from the measurement of Q 0 (T ) at low rf field (B p ∼ 10 mT) for two different cool-down conditions, one with uniform temperature (∆T < 0.1 K) and one with high temper- Average flux expulsion ratio at the equator as a function of the temperature difference (iris-to-iris) on cavities after EP surface treatment, N-doping (G2) and LTB (KEK-R5). The lines are sigmoidal fits to the data and are a guide to the eye. ature gradient (∆T > 4 K). Such measurements were repeated at different applied dc magnetic field, B a , prior to each cool-down. The R s (T ) data are shown, as an example, in Fig. 6 for cavity G2. The data were fitted with the following equation: where the BCS surface resistance R BCS was computed numerically from the Mattis-Bardeen (M-B) theory [25] using the Halbritter code [26]. The mean free path, l and the ratio ∆/k B T c were regarded as fit parameters, where ∆ is the energy gap at T = 0, and k B is the Boltzmann constant. We took T c = 9.2 K, the coherence length, ξ 0 = 39 nm and the London penetration depth, λ 0 = 32 nm for Nb in the clean limit, ξ 0 l at T = 0. The values of l and ∆/k B T c did not change, within experimental uncertainty, with different cool-down conditions or applied dc magnetic field < 50 mG. The weighted average values of l and ∆/k B T c from eight data sets for each cavity are shown in Table II. These mean free path values indicate that the surfaces of all three cavities were in a moderate dirty limit l ξ 0 . The extracted value of ∆/k B T c is ∼ 20% lower in the low-purity cavity as compared to the other two. Since the mean free path may vary over the scale λ(T ) perpendicular to the surface the temperature range used to extract l is indicated between parenthesis in Table II.
The curves of Q 0 (B p ) measured at 2.0 K after cooldown with ∆T > 4 K and B n < 5 mG for each cavity and treatment listed in Table II are shown in Fig. 7 and they are fairly typical for those treatments. There was no field emission in any of the tests. A multipacting barrier occurred at 136 mT during the test of G2, causing a drop in the Q-value. Figure 8 shows the residual resistance as a function of the dc magnetic field before the cavity transitions from the normal to superconducting state, B n , in the two cooldown conditions, one which leads to good flux expulsion (∆T > 4 K) and one which leads to nearly complete flux trapping (∆T < 0.1 K).
For uniform cool-down, the measurements of B sc /B n indicate that nearly all the magnetic flux is trapped, B n ∼ B 0 , therefore R res (B n ) can be described by: where R res0 accounts for contributions to the residual resistance other than trapped flux, such as nonsupercon- Q0(Bp) measured at 2.0 K after cool-down with ∆T > 4 K and Bn < 5 mG for each cavity and treatment listed in Table II. The arrows indicate the quench field.
ducting nano-precipitates, suboxide layer at the surface, broadening of the density of states [27], etc. For cooldown with large ∆T , only a fraction η t of the applied field is trapped so R res (B n ) can be described by: The slope from a least-square linear fit of R res (B n ) for ∆T < 0.1 K is the trapped flux sensitivity, whereas the fraction of the applied field which is trapped can be obtained from the slope of a least-square linear fit of R res (B n ) for ∆T > 4 K. The values of S, R res0 and η t are listed in Table II for the three cavities. A common value of R res0 was obtained by the least-square fit from the two data sets for each cool-down condition. The slope of R res (B n ) for cavity G2 after N-doping is close to the value after EP if the cavity is cooled in a large temperature gradient, however it increases by a factor of ∼ 2 after a uniform cool-down. The residual resistance of cavity KEK-R5 after LTB increased by ∼ 3 nΩ and S increased by ∼ 40%, compared to the values after EP. After this set of measurements, the cavity KEK-R5 was re-processed by annealing at 800 • C/3 h in a vacuum furnace, followed by ∼ 20 µm removal by EP and LTB at 120 • C/24 h. The measurements of R res (B n ) were repeated and the results were within one standard deviation from the results of the previous test after LTB, indicating the reproducibility of the results.
In order to obtain information about the normal state mean free path near the surface, we measured the resonant frequency and the quality factor while warming up the cavities from ∼ 5 K to ∼ 10 K using a vectornetwork analyzer, from which R s (T ) and the change in rf penetration depth ∆λ(T ) can be obtained in this temperature region [16]. These measurements were done on cavities TC1N1 after EP, KEK-R5 after LTB and G2 after N-doping at a peak surface rf magnetic field in the range 0.03 − 0.3 mT and the data are shown in Figs. 9 and 10. The data in the superconducting state were fitted using the numerical solution of M-B theory. The ratio ∆/k B T c was obtained from the fit of R s (T ), whereas l(7.5 − 9.1 K) and T c are weighted averages of the results from the fit of both R s (T ) and ∆λ(T ). The normal-state dc resistivity at 10 K, ρ n , was calculated from the value of the surface resistance at 10 K using a numerical solution of the surface impedance of normal metals [28].
To calculate the surface RRR = ρ(293 K)/ρ n , we took ρ(293 K) = 14.7 µΩ cm. The value of mean free path can be calculated as follows [27]: where is Planck constant, e is the electron charge and n 0 is the electron density. We used n 0 = 7 · 10 28 m −3 obtained from the measurements of the Hall coefficient R H = 1/en 0 in Nb [29]. Table III lists the values of T c , ∆/k B T c and l from fitting of the surface impedance in the superconducting state, as well as the surface RRR, the skin depth, δ n , and l in the normal state at 10 K.

IV. COMPARISON OF EXPERIMENTAL DATA WITH THEORETICAL MODELS
Rf dissipation due to trapped vortices has been calculated both for a pinned vortex which has a segment normal to the inner cavity surface [27,30] and for a pinned vortex which has multiple segments parallel to the inner surface [31], as illustrated by Fig. 1. Such models allow calculating the trapped flux sensitivity and its dependence on the mean free path and pinning forces. This requires solving the equation of motion of an elastic vortex under the action of the viscous, bending, pinning and the rf current driving forces causing the local displacement of the vortex line u(z, t) in the xy plane [14,15]: Here F = φ 0 B p /µ 0 λ is the amplitude of rf driving force with the angular frequency ω, η is the viscous drag coefficient, the overdot and the prime denote differentiation over time and the coordinate z perpendicular to the surface, respectively. Eq. (5) includes the sum of elementary pinning forces f p (r − r m ) produced by materials defects located at (x m , y m , z m ) and the term u accounts for elastic bending distortions. The vortex line tension generally depends on the wave number k ω of the vortex ripple but for long wavelengths λk ω 1 relevant to the cases considered below, can be approximated by [14,32] where κ = λ/ξ is the Ginzburg-Landau (GL) parameter.
Solution of the nonlinear Eq. (5) can be simplified using the fact that pinning in Nb cavities is weak, that is, typical depinning critical current densities J c are orders of magnitude lower than J c of superconducting materials with artificial pinning centers used in magnets [13]. For instance, J c ∼ 10 8 A/m 2 measured on Nb ingots [11] is 4 orders of magnitude smaller than the screening depairing current density J d φ 0 /4πµ 0 λ 2 ξ 2 · 10 12 A/m 2 which flows at the surface at H H c . This suggests that pinning may be produced by either dense arrays of weak materials defects or by sparse arrays of strong pins spaced by distances λ. In this case calculation of the vortex rf losses can be reduced to the analysis of three representative cases depicted in Fig. 1: 1. A vortex nearly parallel to the surface and pinned strongly by sparse materials defects; 2. A vortex perpendicular to the surface and pinned strongly by a materials defect spaced by from the surface. 3: A vortex perpendicular to the surface pinned collectively by randomly distributed weak defects. Calculations of R res for these cases were done in Refs. [27,30,31]. The corresponding formulas used for the analysis of the experimental data are given in the Appendices. Here we do not consider strong correlated pinning caused by planar grain boundaries like in Nb 3 Sn of α-Ti ribbons like in NbTi, or columnar defects like dislocations or radiation tracks [14,15,[33][34][35].
For vortices parallel to the surface [31], the main contribution to R res comes from vortex segments exposed to the rf current. The distance of the vortex from the surface d cannot be shorter that a critical value d m at which the attraction of the vortex to the surface exceeds the pinning force. As shown in Appendix B 1, d m is de-TABLE III. Material parameters Tc, l and ∆/kBTc obtained from fits of Rs(T ) and ∆λ(T ) between 7.5 − 9.2 K with M-B theory. The surface RRR, skin depth, δn, and mean free path in the normal state, l(10 K), were obtained from the surface resistance at 10 K.

Cavity Name Bulk RRR Treatment
Tc (K) l(7.5 − 9. termined by the following equation: where J c ∼ f p / φ 0 is a depinning current density, is a mean pin spacing, and f p is an elementary pinning force: The parameter ζ which quantifies the gain in the condensation energy at the pinning defect is maximum (ζ ∼ 1) for the strongest core pining by a dielectric precipitate of radius r 0 ξ [13][14][15]35]. For a small precipitate r 0 < ξ, we have ζ ∼ (r 0 /ξ) 3 1 [13,14]. For atomic impurities, ζ ∼ σ/ξ 2 1, is proportional to the scattering cross-section σ on the impurity in the normal state [36].
If the vortex stretched along the applied dc field B 0 [37] gets within the expulsion distance d m from a curved cavity surface, it splits into two disconnected parts, as shown in Fig. 1. The parallel vortex segments exist within a belt of width h along the equator, where h can be evaluated from the condition R 2 (R − d m ) 2 + h 2 . Hence, h (2Rd m ) 1/2 , where R is the curvature radius of the cavity and d m ∼ (λ/2) ln(J d /κJ c ) follows from Eq. (7) with a logarithmic accuracy in ln For R 0.1 m, λ = 40 nm, J c ∼ 10 −3 J d , and κ = 1, Eq. (9) gives h ∼ 0.1 mm. The flux sensitivity is then S ∼ R res γ /B 0 , where γ = 2πhR/A is the fraction of the cavity surface area A contributing to the trapped flux losses. Our calculations of S using the formulae for R res (B 0 ) [31] at γ ∼ 10 −4 have shown that pinned vortex segments parallel to the surface result in S which is some 4 orders of magnitude smaller than S values observed on Nb cavities. Therefore, the main contribution to the flux sensitivity in Nb cavities comes from trapped vortices perpendicular to the surface [30]. Two essential contributions to S are considered below.
For a perpendicular vortex pinned by a strong defect at z = , the trapped flux sensitivity is given by [30]: Here the rf current causes bending disturbance extending over the ripple length L ω along the vortex line [30] L where g = ln(λ/ξ) + 1/2, f is the rf frequency and η = φ 2 0 /2πξ 2 ρ n . For Nb with λ ≈ ξ and ρ n = 10 −9 Ω m, we have L ω 180 nm at 1 GHz. Thus, oscillating bending distortions of the elastic vortex can extend well beyond the rf field penetration depth, L ω being practically independent of T and decreasing as the m.f.p. decreases. For instance, in the dirty limit, λ λ 0 (ξ 0 /l) 1/2 and ξ √ ξ 0 l, we have L dirty ω L clean ω l/ξ 0 . If the pin distance exceeds L ω the flux sensitivity is independent of the pinning force. The factor γ in Eq. (10) takes into account the spatial distribution of trapped vortices over the cavity surface (see Appendix B): where n(r) is the local areal density of vortices coming out of the inner cavity surface, H(r) is a tangential component of RF magnetic field at the surface. For a statistically-homogeneous distribution of trapped vortices piercing the cavity along the dc field B n , the ratio n(r)φ 0 /B n → cos θ(r) depends only on the angle θ(r) between the normal to the cavity surface and B n , and γ depends only on the cavity shape and the rf mode. For the TM 010 mode in the elliptical cavities studied in this work, we calculated γ = 0.61 numerically and used this value in the analysis of the experimental data.
Since the amplitude of the rf ripples along the vortex line decreases exponentially over the length L ω , pins spaced by L ω from the surface have no effect on R res , whereas pins closer to the surface reduce R res . For sparse pins, R res is dominated by dissipative oscillations of free vortex segments between the pins. Thus, vortex segments of length > L ω cause the highest rf losses independent of details of the pinning forces f p (u). The net rf power is determined by statistical averaging of R res over the random pin spacing from the surface [30,31] where G( ) is a distribution function of the pin spacings. Random distribution of the nearest pin positions along the cavity surface manifests itself in strong fluctuations of local vortex losses in hotspots caused by vortex bundles pinned deep inside the cavity wall and having long dangling segments of length L ω at the surface.
In the case of weak collective pinning of a perpendicular vortex, Eq. (5) can be simplified to the following equation for small displacement of the vortex u(z, t): Here the term −αu describes the effect of pinning, and the Labusch spring constant α [13-15, 32] is evaluated in Appendix C for arrays of small nanoprecipitates or atomic impurities. The rf current flowing at the surface causes oscillations of the vortex line which extend over the complex Campbell penetration length [13,15,32]: For weak collective pinning at GHz frequencies, ωη α, Eq. (16) reduces to Eq. (12), giving L ω → λ c which can significantly exceed λ, as it was shown above. In this case the rf losses occur not only in the surface layer of the rf currents but also come from oscillations of long segments of vortex lines extending deep inside the cavity wall over the length ∼ L ω λ. In the static limit λ c reduces to the Larkin pinning correlation length L c ξ(J d /J c ) 1/2 which defines a length scale of bending distortion along the vortex line [14,15,38]. For Nb with λ ≈ ξ ≈ 40 nm, J d φ 0 /4πµ 0 λ 2 ξ = 2 · 10 12 Am −2 and J c ∼ 10 8 − 10 9 Am −2 [11,13], we have J c ∼ (10 −4 − 10 −3 )J d and L c 2 − 4 µm, consistent with the fits of experimental data presented below.
The trapped flux sensitivity in the case of weak collective pinning is given by (see Appendix B): where s = λ/λ c = √ k + iχ and k = αλ 2 / . In this work we focus on trapped vortex losses at low fields, H p H c 200 mT, leaving aside complex issues of nonlinear vortex losses at high fields. Low-frequency vortex losses at high rf fields have been addressed theoretically both for weak collective pinning and hysteretic depinning of vortices from strong pins [32]. A quasi-static theory of collective pinning was used to address the linear dependence of the vortex surface resistance on the rf field amplitude [39] observed on Nb cavities. In what follows we use Eqs. (10) and (17) to reveal manifestations of different pinning mechanisms in the observed dependencies of S on the mean free path in Nb cavities.

A. Mean free path dependence
The electron mean free path can be altered by surface treatments so getting the values of l from the cavity measurements is not always straightforward. Usually l is extracted from fitting the observed surface impedance, Z s (T ), using numerical solutions of the M-B theory [25,26]. The l values can vary depending on the temperature-dependent depth probed by rf current [16]. There are many uncertainties in evaluating l from the M-B fits coming from both the BCS model assumptions and/or computational intensive grid-search methods to find a global minimum of chi-squared [40]. Additional contributions to the rf losses can result from a proximity coupled thin suboxide metallic layer [42,43], common broadening of the gap peaks in the idealized BCS density of state [27], significant effects of strong electron-phonon coupling in Nb [44] or two-level systems [45] which are not taken into account in the M-B model. By contrast, obtaining l from the Drude Eq. (4) only requires knowledge of ρ n and the electron density.
At GHz frequencies the normal skin depth is about 3−10 larger than the rf penetration depth at T < 0.85T c , so measurements of Z n (T, f ) in the normal state probe a thicker surface layer across which l can vary due to materials treatment. However, measurements of Z n (T ) at microwave frequencies on Nb coupons at T slightly above T c may give a more reliable information about l in the 40 − 100 nm thick surface layer relevant to SRF cavities. Evidences of variation of l across the surface were obtained from muon spin rotation (µSR) experiments on Nb samples treated by EP and LTB which showed that l changes from l 2 to 16 nm within the depth in the 100 nm surface layer [41]. The M-B fit of R s (T ) in LTB cavities gave l ∼ 26 nm and l 200 nm in cavities treated by EP [16]. The values of l(1.5 − 4.3 K) ∼ 26 nm extracted fom the M-B fits for all three EP cavities shown in Table II are lower than typical, which may be due to the cavities' treatment history.
Our flux sensitivity data plotted as a function of l are shown in Fig. 11 (a) and (b). To see how different cavity treatments manifest themselves in the observed flux sensitivity, we also plotted the S(l) data observed on finegrain 1.3 GHz cavities made of high-purity Nb and of the same shape as the cavities in our work [17,18]. In Ref. 18 fifteen different cavities were subjected to different annealing treatments followed by EP. In Ref. 17 six different cavities were subjected to different annealing followed by different amount of material removal by EP. The S-values of Ref. 17 were multiplied by a correction factor of 0.58 [46] to be compared with the data of Refs. 18 and 19 and our work. As far as we are aware, all flux sensitivity data shown in Fig. 11 have been obtained using the same experimental methodology, where the l values have been extracted from the M-B fits of the temperature-dependent surface impedance [25,26].
Both S(l) data sets of Refs. 17 and 18 have clear maxima as functions of the m.f.p. but with very different values of the peak position and magnitude, l max and S max . This indicates that different treatments of cavities done in Refs. 17 and 18 produce different distribution and type of pinning centers which manifest themselves in different flux trapping efficiency and rf losses. However, if the flux sensitivity data of Refs. 17 and 18 are normalized to their respective values of S max and plotted as functions l/l max , both datasets approximately collapse onto a universal bell-shape curve, as shown in Fig. 11 c. This behavior suggests a scaling of S(l) which will be discussed later. Strong scatter of experimental data likely results from the fact that all data points in Fig.  11 correspond to different cavities which have undergone different treatments resulting in particular values of l. However, such materials treatment can not only change the mean free path but also spatial distribution, strength and volume density of pins, so the data in Fig. 11 represent a convoluted effect of materials treatments on both l and pinning characteristics. Indeed, our experimental data exhibit significant changes in the S-values but rather small changes in l after the cavity treatments, indicating that they mostly affected pinning characteristics rather than the mean free path. Now we relate the correlation of S and l observed Refs. 17 and 18 and shown in Fig. 11 to different pinning mechanisms. Consider first the rf losses caused by perpendicular vortex segments pinned by strong sparse pins. Shown in Fig. 11(a) is S(l) calculated from Eq. (10) at  [17] and [18] are shown normalized to the respective peak value and plotted as a function of the mean free path scaled to the value at which S is maximum in each data set in (c).
1.3 GHz using as a fit parameter and the dependencies of λ(l), ξ(l), η(l) on mean free path from Appendix A. We used the vortex viscosity η(l) = φ 2 0 /2πξ 2 ρ n given by the Bardeen-Stephen model, although this model is valid only in the dirty limit l ξ 0 . Therefore, a discrepancy between the theory and experimental data can be expected in a moderate clean limit l ξ 0 , where the results of calculations are shown as dashed lines in Fig. 11. Here S(l) calculated at a fixed has a broad maximum at l 100 nm. The maximum in S( ) becomes more pronounced if the pin spacing is proportional to l, as it was proposed in [17]. This assumption might be justified if pinning is caused by small precipitates which also act as electron scattering centers. Figure 11(b) shows the fits of the flux sensitivity data to the model in which S(l) is caused by perpendicular vortices pinned collectively by weak small pins. Here S was calculated from Eq. (17) at 1.3 GHz and γ = 0.61, using the Labusch spring constant α(l) = α 0 (1 + ξ 0 /l) evaluated in Appendix C and regarding the pinning parameter k 0 = α 0 λ 2 0 / 0 in the clean limit as a fit parameter. As l decreases, a maximum in S(l) occurs due to interplay in the decrease of the vortex viscosity η(l) in a moderately clean limit and the increase of the pinning constant k(l) = αλ 2 / k 0 (1 + ξ 0 /l) 3 as the vortex line gets softer in the dirty limit.
As follows from Fig. 11, perpendicular trapped vortices pinned by either strong sparse pins or by collective interaction with random array of weak pins can result in bell-shape S(l) dependencies, in qualitative agreement with experiments. The fits are hardly perfect, which may reflect the fact that both l and pinning characteristics are generally affected by the cavity treatments. In addition, several pinning mechanisms operating on different scales can contribute to S, the relative weight of these contributions can vary along the cavity surface. For instance, vortex hotspots can occur either in regions devoid of strong pins or regions with weak δl pinning due to impurity fluctuations or regions with weak random δT c pinning. Networks of dislocations can be clustered in some regions of the surface and be absent in others. Because of very low densities of vortices in cavities, lateral fluctuations of pinning along the cavity surface are very strong, and different pinning mechanisms can operate simultaneously in different hotspots. Here the largest contributions to S likely come from regions with weak or no pinning in the first 100 − 200 nm at the inner surface of the cavity.
If S is mostly determined by the weak collective pinning, the value of the parameter k 0 = α 0 λ 2 0 / 0 used to fit the S(l) data in Fig. 11 (b) allows us to roughly evaluate pinning characteristics. For small dielectric nanoprecipitates of radius r 0 < ξ 0 , the mean pin spacing can be expressed in terms of k 0 using Eq. (C5): where n p = −3 is the volume density of pins. For instance, if r 0 = 5 nm, ξ 0 = λ 0 = 40 nm, and g = ln κ + 1/2 = 1/2, Eq. (18) yields λ 0 38 nm at k 0 = 4 · 10 −4 . Weaker proximity coupled metallic nanoprecipitates require a higher pin density as compared to dielectric precipitates to provide the same value of k 0 . On the other hand, Eq. (18) may overestimate the volume density of nanoprecipitates because another contribution to α comes from δl pinning due to fluctuations of the mean free path. As shown in Appendix C, δl pinning can be essential in a dirty surface layer with sparse small nanoprecipitates if the condition (C11) is satisfied.
The Labusch constant α can be expressed in terms of a depinning current density J c by equating the Larkin pinning correlation length L c ∼ ξ J d /J c [14] to the static Campbell length λ c = /α, where J d = φ 0 /4πµ 0 λ 2 ξ and is given by Eq. (6). Hence, It is instructive to express J c and L c in terms of the dimensionless pinning parameter k = αλ 2 / extracted from the fits of Eq. (17) to the flux sensitivity data: For the typical values of k 0 ∼ 10 −3 , we obtain J c ∼ 10 −3 J d and L c ∼ 30λ for clean Nb with κ 1. This shows that: 1. Pinning in Nb cavities is indeed weak, as was mentioned above. 2. Dissipative oscillations of the elastic vortex extend well beyond the layer of the surface rf current which excites these oscillations. Notice that these J c values correspond to a layer z λ c at the Nb surface where the density of structural defects which can pin vortices is typically much higher than in the bulk. Because of stronger pinning in the surface layer caused by different materials and mechanical treatments used in the cavity production, it is not surprising that the J c values extracted from the S-fits are an order of magnitude higher than global J c obtained from the measurements of magnetization loops on Nb ingots [11]. Figure 12 shows the trapped flux sensitivity normalized to the respective high-frequency limits S n = S/S hf as a function of the dimensionless frequency χ = ωηλ 2 / . The data from Refs. 17-19, and 48 are plotted along with the data from this work and are fitted to Eqs. (10) and (17) for different values of the model parameters.

B. Frequency dependence
Since χ depends on l, cavities resonating at the same frequency but with different mean free path values result in different values of χ. While most of the data shown in Fig. 12 are for 1.3 GHz cavities, there are also three data points each for 650 MHz, 2.6 GHz and 3.9 GHz elliptical cavities [19]. The data in Ref. 48 were obtained from different cavities with frequencies in the range 81 MHz -21.5 GHz and had been corrected for the cavity geometry with respect to the direction of the applied field.
It should be pointed out that in Refs. 18 and 19 the mean free path in cavities after LTB was not obtained from RF measurements but the same value l = 16 nm was assigned, based on µ-SR measurements on Nb coupons. The mean free path close to the surface was also not measured in Ref. 48 and we used the value obtained from the reported bulk RRR in order to calculate S hf and χ for such set of data. These assumptions along with the issues discussed above can contribute to the strong scatter of the data in Fig. 12. The data listed in Tables II show that the fraction of magnetic field trapped during cool-down with ∆T > 4 K increases with decreasing bulk RRR of the cavity and it is not significantly affected by surface treatments, such as N-doping and LTB. This important finding suggests that pinning is dominated by the bulk materials properties, which is consistent with the results of Ref. 12. The grain structure is similar in all three cavities, and the major differences are in the concentration of interstitial impurities, which should be uniformly distributed in the material. On the other hand, the trapped-flux sensitivity does not seem to be correlated with the bulk RRR. This can be expected since only trapped-vortex segments at the surface contribute to rf losses. The flux sensitivity S increased by ∼ 50% after LTB and ∼ 76% after N-doping, showing that surface treatments significantly affect S, consistent with published data on fine-grain Nb cavities [12,17,18]. Lower material purity can result in a larger fraction of the trapped flux because the vortex line tension 0 (1 + ξ 0 /l) −1 decreases as l decreases, therefore making it easier for a vortex to be pinned. While the surface RRR is similar to the bulk value for the low-purity cavity after EP and the medium purity cavity after LTB, it is much smaller than the bulk value for the high-purity cavity after N-doping. This suggests that the diffusion of N during the infusion process occurs over a depth of the order of the skin-depth ∼ 1 µm in this case. This result is consistent with measurements of the impurities depth profile in N-doped Nb samples [49,50].
The scatter of the S(l) data shown in Figs. 11 and 12 likely comes from the measurements of S on different cavities which have undergone different treatments affecting both l and pinning characteristics. Another contribution to the scatter of the S-data may come from the ambiguity in determining l within the top ∼ 40 nm surface layer, as it was discussed in Sec. IV A. The data from Refs. [17,18] exhibit a maximum in S(l) but the position of the maximum l m in these two sets of data differ by an order of magnitude. Such a big difference in the peak positions l m can hardly be entirely attributed to different ways of extracting l from the data used by different groups but rather indicates a significant difference in pinning strengths which causes flux trapping in the first place. After rescaling S/S max as a function of l/l max both datasets approximately collapse onto a universal curve as shown in Fig. 11 (c). Such scaling is indicative of S(p) being a function of one parameter p which absorbs both the mean free path and pinning characteristics. The single-parameter scaling takes place in S(s) given by Eq. (17) for the collective pinning model and S(ν) in Eq. (10) for strong sparse pins in the limit of χ 1 characteristic of Nb cavities (see Fig. 12). Analyzing S(l) as a function of only the mean free path does not give a complete picture of flux sensitivity since heat treatments change not only l but also spatial distributions of impurities or oxide/hydride nanoprecipitates affecting the δ or δT c collective pinning, or correlated pinning by grain boundaries or dislocation networks. For instance, our data which show a significant change in flux sensitivity without much change in l could be understood assuming that LTB or N doping facilitate either a diffusive coalescence or dispersion of pinning nanoprecipitates. In this case both the radius of precipiates r 0 and the pin spacing would change after each heat treatment but the volume fraction of a nonsuperconducting phase 4πr 3 0 n p /3 = (4π/3)(r 0 / ) 3 remain constant. As a result, the pinning parameter k 0 which controls the behavior of S(l) for the collective δT c pinning would evolve as k 0 ∝ r 2 0 at a constant ratio r 0 / in Eq. (C5). Cavity treatments could cause diffusive shrinkage or dissolution of sparse strong pinning oxide or hydride nanoprecipitates within the layer of thickness L ω at the surface, which would obviously increase flux losses. Heat treatments can also affect segregation of impurities on dislocations or grain boundaries which changes pinning forces [34]. The flux sensitivity S(l, f ) calculated for different pinning mechanisms increases as l decreases in the clean limit and then decreases at shorter l, as shown in Fig. 11. Here the maximum in S(l) results from interplay of the decrease of the vortex viscosity and increase of the pinning strength as l decreases as was also pointed out by Checchin et al. [51] using the Gittleman-Rosenblum (GR) model [52]. We showed that the observed S-values can be obtained from Eq. (10) with λ 0 or from Eq. (17) with reasonable assumptions regarding the size and concentration of defects. The position and the magnitude of the maximum of S(l) depend on frequency and the pinning strength quantified by either the Labusch constant α of the pin spacing . The main contribution to S comes from weak pinning regions in which dissipative oscillations along vortices extend into the bulk well beyond the layer of rf screening current.
Identifying a correlation between the materials defects and vortex hotspots would require rf measurements of Q(T ) and temperature maps on the cavity combined with electron microscopy of coupons cut out from the same cavity. Yet even such putative state-of-the-art experiments may not pinpoint the pinning defects responsible for the dominating rf losses of trapped flux. Indeed, the strongest hotspots are produced by perpendicular vortex segments which are either pinned collectively by many weak pins such as clusters of atomic impurities or by strong pins like nonsuperconducting precipitates, which can be hundreds nanometers away from the surface. In that case surface probes can miss the materials defects resulting in the strongest vortex losses.
Models of pinned vortices driven by the rf current must include a finite vortex line tension , otherwise there would be no pinning [13-15, 33, 35]. Indeed, at → ∞ a straight stiff vortex cannot be pinned by randomly distributed materials defects. In the limit of zero , soft vortex segments between pinning centers would bow out and reconnect under any infinitesimal Lorentz force of current [15,33,35]. These issues are relevant to the models of rf vortex losses [51,53] in which the vortex line tension was disregarded and the GR model [52] was used. However, the GR model was proposed to describe short perpendicular vortices driven by a uniform rf current in a thin film. By contrast, a rf current flowing at the cavity surface excites dissipative ripples along the elastic vortex extending over the length L ω λ and producing losses deep inside the cavity wall. This effect cannot be described by the GR model which is applicable to nearly straight perpendicular vortices in thin films or SRF thin coatings, if the film thickness is smaller than the Campbell penetration depth λ c [38]. In the static limit λ c becomes the Larkin pinning correlation length L c ∼ 10 2 λ estimated above. At 2 GHz L ω drops down to 200 nm which is about 5 times larger than λ in clean Nb.
The randomness of spatial distribution of pinning centers in the cavity wall can result in strong local fluctuations of flux trapping efficiency which are especially pronounced at low density of trapped vortices. The flux sensitivity S then results from spatial averaging over distributions of -values, pinning strengths and positions of vortex segments relative to the surface. However, S also depends on such extrinsic factors as the history of cooling the cavity through T c , temperature cooling rate and the directions and magnitudes of local temperature gradients. Moreover, local flux losses can vary significantly even if the average densities of pinning centers and trapped vortices are constant. Indeed, the regions which have pinning centers within the rf surface layer would greatly reduce flux losses, whereas pin free regions at the rf surface would have much stronger flux losses if the vortex is trapped by pins deep inside the cavity wall.

C. Optimization of flux pinning
Given the multitude of mechanisms of flux trapping and their strong dependencies on the materials treatment, one could pose the question: Is flux trapping inevitable and to what extent can the vortex losses be reduced to an acceptable level by optimizing pinning nanostructure? The answer to the first part of the question is yes: flux trapping occurs during the cavity cooldown through T c at which the energy barrier for the vortex creation vanishes so any materials defects both in the rf layer and deep inside the cavity wall can trap vortices. A fraction of these vortices escapes upon cavity cooldown but some of them remain trapped. The statistical nature of pinning and the effect of cooling conditions make distributions of trapped vortices very cavity-dependent.
The answer to the second part of the question depends on the rf field range. At low fields H H c , flux losses can be mitigated by materials defects which pin vortices at the surface, and S can be further reduced by engineering a dirty layer at the surface. At the same time, a high density of metallic pins spaced by λ would greatly increase the eddy current losses even without trapped vortices, whereas non-metallic pins such as nano pores would increase the BCS losses by reducing the currentcarrying cross-section and increasing the rf field penetration depth. At high rf fields mitigation of flux losses by pinning becomes ineffective because it cannot provide J c J d to counter the rf screening current density close to the depairing limit at H ≈ H c = 200 mT.
Previous works on artificial pinning centers in high-J c superconductors [56][57][58][59][60] have shown that the maximum J c ∼ (0.1 − 0.2)J d can be reached at the optimum volume fraction of pins x c ∼ 10% due to interplay of vortex pinning and current blocking by pins [33,35,38]. Thus, even the optimum pinning structure cannot really reduce flux losses at H 0.1H c , not to mention that such dense array of nanoprecipitate would greatly increase the eddy current and BCS losses. At high rf fields, trapped vortices can also result in a significant field dependence of R s (H), possibly contributing to the extended Q(H) rise due to the Larkin-Ovchinnikov decrease of the vortex drag η(v) with the vortex velocity [62].

VI. CONCLUSION
Our results of measurements of flux trapping and trapped flux sensitivity of large-grain cavities made for Nb ingots with different content of interstitial impurities suggest that the fraction of trapped flux increases with decreasing purity of the material and it is insensitive to surface treatments. On the other hand, the trapped flux sensitivity depends on the surface conditions such as the local mean free path and distribution of pinning centers.
The mean free path and frequency dependencies of the low-field trapped flux sensitivity observed on different elliptical cavities by different groups show similar correlations and universal behaviors after proper rescaling. Models of rf dissipation due to oscillating trapped vortices perpendicular to the surface can capture the behavior of flux sensitivity observed in this paper and previous works although the available data are not sufficient to determine which pinning mechanisms dominates.
Given a limited extent by which flux sensitivity at high fields can be mitigated by pinning defect nanostructure, we believe that a more efficient way of reducing vortex losses would be to optimize the cooling procedure of the cavity to minimize the amount of trapped flux. As was shown in previous works, this can be achieved by inhomogeneous cooling the cavity through T c , which can push out a significant portion of trapped vortices [3][4][5][6][7][8][9][10] due to strong temperature gradients [30,31].

ACKNOWLEDGMENTS
We would like to acknowledge Jefferson Lab technical staff for the cavity surface processing and cryogenic support. We thank Rongli Geng for providing the cavity G2, Ganapati Myneni and Kensei Umemori for providing the cavity KEK-R5. We also thank Mattia Checchin for providing the data from Ref. 19  line disturbed by the rf current is given by Eq. (16). The surface resistance takes the form [27]: where s = λ/λ c = √ k + iχ, and k = αλ 2 / . In the high-frequency limit, χ 1, S hf is given by Eq. (B3). To relate R res with the flux sensitivity in a cavity we write the quality factor in the form: Here R res (n) = R res (B 0 )n(r)φ 0 /B 0 depends linearly on the density of perpendicular vortices n(r). Hence, where G is a geometric cavity constant and the factor γ accounting contributions of trapped vortices at different locations on the inner cavity surface is given by Eq. (13). Consider a model spherical cavity with H 2 ∝ sin 2 θ and n(r)φ 0 /B 0 = | cos θ|, where θ is the polar angle between the direction of the dc magnetic field B 0 and the local normal unit vector to the surface. This implies a statistically uniform distribution of trapped vortices in the plane perpendicular to B 0 in which case: The integrand in the numerator of Eq. (B9) is maximum at sin θ = √ 3/2 so vortices coming out of the inner cavity surface at θ 60 • contribute most to S.
Here the impurity scattering length ∼ √ σ 0 is of the order of atomic size, so that √ σ 0 r 0 < ξ 0 , but the volume density of impurities n i can be much larger than the volume density of nanoprecipitates, n p n i .