Impact of geometry on the magnetic flux trapping of superconducting accelerating cavities

Controlling trapped magnetic flux in superconducting radiofrequency (RF) cavities is of crucial importance in modern accelerator projects. In order to study flux trapping efficiency and sensitiv- ity of surface resistance, dedicated experiments have been carried out on different types of low-\b{eta} superconducting accelerating cavities. Even under almost full trapping conditions, we found that the measured magnetic sensitivities of these cavity geometries were significantly lower than the theoretical values predicted by commonly-used models based on local material properties. This must be resolved by taking account of geometrical effects of flux trapping and flux oscillation under RF surface current in such cavity shape. In this paper, we propose a new approach to convolute the influence of geometries. We point out a puzzling contradiction between sample measurements and recent cavity experiments, which leads to two different hypotheses to simulate oscillating flux trapped in the cavity surface. A critical reconsideration of flux oscillation by the RF Lorentz force, compared with temperature mapping studies in elliptical cavities, favoured the results of previous sample measurements, which suggested preferential flux trapping of normal component to the cavity inner surface. Based on this observation, we builded a new model to our experimental results and the discrepancy between old theory and data were resolved.


I. INTRODUCTION
Performances of a superconducting accelerating cavity made of bulk niobium can be strongly affected by the presence of a residual magnetic field while transitioning into the superconducting state. Magnetic vortices trapped by pinning centers of the cavity material during cool-down interact strongly with the radiofrequency (RF) electromagnetic fields and induce additional dissipations in the helium bath [1]. We denote these additional losses by a surface resistance R mag in nΩ.
The total surface resistance Rs of a superconductor [2] is the sum of a strongly temperature T dependent contribution R BCS , derived from the linear response of the Bardeen Cooper Schrieffer theory of superconductivity [3], and the other contribution, which is only weakly temperature dependent, defined as the residual resistance R res : with RF frequency f dependence. This R res consists of a component temperature-independent R 0 due to material imperfections (pollution, defects, grain boundaries, etc) and R mag : Recent technical advances on mechanical process and surface treatment have reduced R 0 , and therefore, understanding and controlling R mag becomes of critical importance in state-of-the-art superconducting RF cavities for many applications [4]. Previous studies [5][6][7][8][9] mainly focused on the specific elliptical cavities dedicated to high-energy electron accelerators. In this paper, we report on three more general shaped cavities developed for proton and heavy ion linear accelerators. The first is a Quarter-Wave Resonator (QWR) operating at a frequency of 88 MHz, built for the Spiral2 project [10]. The second is a Double-Spoke Resonator (DSR) operating at 352 MHz for the ESS project [11]. The third is a Single-Spoke Resonator (SSR) operating also at 352 MHz for the MYRRHA project [12].
With the ambient residual magnetic field H res in mG present at transition, R mag can be decomposed into: where η mag is the dimensionless flux trrapping efficiency coefficient with 0 < η mag < 1 [13], S mag is the magnetic sensitivity [14] expressed in nΩ/mG. From Eq. (3), three independent factors, H res , η mag , and S mag play an important role to reduce R mag and thus to fulfill the requirement for total R s of each accelerator project. The purpose of this study is to address geometrical dependence of R mag when a condition η mag ∼ 1 is satisfied. We show that the origin of such geometrical dependence may be from a preferential flux trapping angle in the cavity surface. This influences S mag that is mainly contributed from flux trapped to normal to the surface.
This report is organized as follows. In the rest of the introduction, we review the previous studies of H res , η mag , and S mag . In II, the experimental set-up at Irène Joliot Curie Laboratory (IJCLab) is presented. Section III is dedicated to the experimental results on flux trapping and the diamagnetic effect. In section IV, experimental results on flux sensitivities on our cavities are described. In order to explain our experimental findings, section V discusses several aspects of flux trapping and sensitivities. Comparing previous sample experiments, we point out one puzzle in recent cavity experiments. We critically reconsider recent theories and propose a hypothesis about geometrical dependence of R mag , which is justified by recent studies on single-cell elliptical cavities tested in unusual configuration with a horizontal magnetic field and slow cooling down.. We then compare our experimental results and this new model. The final section represents conclusions.

A. Magnetic shield to reduce Hres
To protect niobium from environmental magnetic field coming from the earth field and magnetic parts at the vicinity of a cavity, magnetic shields are usually installed around a superconducting cavity. High permeability material as permalloy (µ-metal), Cryophi®or A4K are used to funnel the magnetic field and thus strongly attenuate H res inside it. Historically, minimizing the attenuation factor, required to achieve R mag within the total budget of R s , has been a major interest of the community [15], and this has been successful for conventional elliptical cavities at 1.3 GHz.
One technical difficulty appears when one tries to shield cavities with a different geometry, namely, lowβ structures [16]. Their relatively large dimensions can significantly increase the mechanical complexity and cost to fabricate ideal magnetic shields [17] and thus can practically limit field attenuations around the cavities. Therefore, reducing the other two factors in Eq. (3) becomes motivated to relax the mechanical and financial constraint of magnetic shielding. On top of this practical use, systematic studies of η mag , and S mag are of scientific interest for the applied superconductivity under strong RF fields [18].

B. Flux expulsion and trapping
The flux trapping efficiency coefficient η mag is typically evaluated with magnetic sensors installed in close proximity with a cavity [9]. The sensor probes the magnetic field distribution altered by the diamagnetic property of the Meissner state when the material goes through superconducting transition.
Amongst all, bulk material history has a significant impact on flux trapping. Material re-crystallization by thermal treatment typically above 800 • C would ensure an almost complete flux expulsion beside some exceptions as reported [8]. Indeed, without any recrystallization process, close to 100% of the residual magnetic field is trapped as reported in [13,19,20]. Regarding the studies presented in this paper, the cavities are made of polycrystalline material without heat treatment above 650 • C and therefore we can primarily assume, based on past observations, almost full flux trapping.
The previous studies about cool-down dynamics sometimes showed contradictory results. For simple geometries like bare elliptical cavities in vertical cryostats [5,8,21], the flux expulsion improves in proportion to the thermal gradient across the cavity. This was explained by two different models proposed by Kubo [22] and Checchin [7]. However, for more general configurations, a low thermal gradient is proposed in Ref. [23] due to the possible effect of the thermoelectric currents generated by bi-metallic junctions between the niobium cavity and the helium tank made of titanium [24,25].
The experiments on the LCLS-II cryomodules [26,27] showed that such dynamic thermoelectric currents tend to vanish when the temperature is close to superconducting transition. We also observed a similar behaviour in our cryostat at IJCLab [28] and thus we do not address the effect of thermoelectric current in this paper. In LCLS-II, independently of the cool-down rate, the intrinsic static thermoelectric currents remain and act as an additional external magnetic field to be expelled during the superconducting transition. It must be noted that the cavities installed in other cryostats or cryomodules may behave differently due to the different mechanical structure from our vertical test stand.

C. Magnetic sensitivity Smag
A static model concerning a normal conducting core in a trapped vortex gives a good approximation of S mag as formulated by [1] with R n the normal resistance and H c2 the upper critical field of the material. As described in Appendix A, dynamic flux oscillation under Lorentz force driven by RF current leads to the same result, based on the model by Gittleman and Rosenblum [29]. Beyond this simple approximation, the magnetic sensitivity is extremely difficult to quantitatively predict and evaluate since it depends on many parameters [30]: • Frequency of the cavity [14,20] • Temperature of operation [31,32] • Local heating due to trapped vortices [33,34] • Impurity content of material: dislocations, segregation, precipitates, and grain boundaries [35] • Model of pinning potential [36] • Interplay of various pinning centers [37,38] • Amplitude of RF fields [18,32,[36][37][38][39] • Geometry of the cavity [18,32,37] One must take care when studying the geometrical dependence, because the measurement observable R mag averaged over the cavity inner surface cannot directly separate the geometrical effects from either η mag or S mag . To study S mag , one needs to ensure η mag ∼ 1 by very low thermal gradients generally associated with slow cooling speed. Our study fulfills this condition because the material is prepared not to efficiently expel the flux during cool-down. We show this by a dedicated experiment in section III.
The geometrical dependence of S mag has been under debate. A group reported [40] that flux trapping happens uniformly and homogeneously over the surface and even preserves the orientation of the applied external field before superconducting transition, if flux expulsion is suppressed by slow cooling down. The flux oscillation under RF fields depends on the orientation of the trapped flux versus RF currents and thus becomes non-uniform over the surface. Although this experimental result based on magnetic field mapping [40] seems convincing and plausible, we recognized a puzzling contradiction against rather general studies on superconducting samples in other experiments, such as Ref. [41]. Our experimental results suggest careful argumentation of this subtle issue. In section V, we come back to this point and critically reconsider existing theories and experiments. We propose a hypothesis that flux trapping may happen preferentially for the normal component to the surface, and the amount of flux to be oscillated by the RF fields becomes non-uniform. This results in S mag being dependent on the geometry. Our hypothesis successfully explains the distribution of RF power dissipation measured in temperature mapping [40].

A. The vertical cryostat
In an effort to fully qualify any new cavity design or a new surface treatment process or procedure, cavities are first tested in a vertical cryostat. The vertical cryostats are designed to provide optimal testing conditions to address cavity performances. The intrinsic quality factor Q 0 is evaluated at different accelerating gradients E acc by measuring the power dissipation P c averaged over the cavity walls. The cryostat, available on platform Supratech at IJCLab in operation since 1998 and upgraded in 2018, is capable of hosting two cavities (equipped with their helium jacket) in a volume constrained in a cylinder of 2 m high and 1.15 m in diameter as shown in Fig. 1.
The cryostat is externally shielded on the side by 1 mm-thick permalloy sheets rolled around the vacuum vessel. The horizontal component of the magnetic field is significantly attenuated. Because of design constraints, the vertical component is not shielded by permalloy sheets but by three compensating coils inserted in between the magnetic shield and the vacuum vessel as depicted in Fig. 1. This configuration allows the possibility to either reduce the magnetic field to a minimum value to optimize the cavity performances or to apply a uniform field to measure η mag and/or evaluate S mag with the field of any cavity. Figure 2 shows two examples of magnetic configurations of a residual field.

B. Magnetic sensors
Regarding magnetic measurement, the very low magnetic field to be measured makes the fluxgate magnetometer the best technology in our test conditions in vacuum at low temperatures. As commercially available fluxgate sensors (at the time of these studies) are only available as single axis sensors, three of them are assembled on a 3D-printed support to measure each of the three axis. A home-made multiplexer has been built to read up to twelve type G sensors with only one controller (MAG01-H) from Bartington [42]. The magnetic field resolution is 0.02 mG over a range of 20 G. Integration time imposes a minimum multiplexing rate of about six seconds. To avoid any crosstalk between sensors, both current and voltage leads are multiplexed. In normal operations, only one sensor is energized at a time. • Evaluation of the flux trapping efficiency η mag [64] • Evaluation of the magnetic sensitivity S mag to a residual magnetic field of different types of superconducting cavities • Monitoring of the magnetic field behaviour during cooling down generated by thermoelectric currents because of the existence of bi-metallic junctions • Detection of the magnetic field penetration in case of a quench

D. Cavities for this study
The three cavities dedicated for this study are shown in Fig. 3 with geometrical factor G [1] and operating frequency f in Table I. The cavities are made of polycrystalline niobium and their surfaces have been prepared following the standard procedure at IJCLab laboratory: • Degreasing in an ultrasonic bath with detergent.
• Surface abrasion by Buffered Chemical Polishing of at least 200 um (BCP) • Optional hydrogen degassing at 650 • C for 10 h.
• High Pressure Rinsing with ultra-pure water • Drying and assembly in ISO4 clean room They are all manufactured out of the same polycrystalline (fine grain) bulk niobium material without any heat treatments above 800 • C. No low temperature baking [4] or nitrogen doping [43] were performed. In addition, all cavities for this experiment are equipped with a titanium helium tank. Vertical and transverse residual magnetic fields were applied on Spiral2 QWR. For MYRRHA SSR and ESS DSR, only the vertical fields were applied in the cryostat. This corresponds to the field transverse to the beam axis in MYRRHA and along the beam axis of ESS DSR. At the time of these studies, the ESS DSR could only be loaded vertically in the cryostat as shown in Fig. 3. The field orientations are also summarized in Table I.

III. FLUX TRAPPING STUDY
We first validate our assumption about almost full flux trapping in our fine grain material without substantial heat treatment above 650 • C. The conventional experiment on η mag by fluxgate sensors around a cavity is not reliable in our experimental setup because of the complicated cavity geometries studied in this paper compared to the conventional elliptical cavities. The maximum field enhancement even by the ideal flux expulsion is only a few percent around the cavity. Instead, a magnetic sensor is installed to monitor the vertical component of the magnetic field in the stem, the inner conductor of the Spiral2 QWR as depicted in Fig. 3. A particular advantage of using QWR for this study is that the magnetic sensor can be installed inside the cavity structure, unlike the conventional elliptical cavities, in which the beam vacuum side is not suitable for sensor installation.
In case of complete flux trapping during superconducting transition, no change of magnetic field would be observed whereas in the case of complete flux expulsion, the  bottom of the stem is also considered (Figure 7 (b)). Indeed, during regular cool-down, the SC/NC interface is moving from the top of the cavity down to the bottom of the stem. This would result in a non-zero field measured in the inner conductor even with complete flux expulsion. Flux trapping experiment has been performed as follow: • The cavity has been cooled down in a non-optimal ambient magnetic field resulting in a residual vertical field measured by the probe of -55mG (See Figure 8, blue region noted Outer SC, Inner SC). • The ambient magnetic field is changed (Helmholtz coils are off) to generate a magnetic field of +52mG at t = 0:00 (black arrow). • The external conductor (body of the cavity) is warmed up with heaters above transition (light green region noted Outer NC, Inner SC). • The outer conductor is cooled below transition • The inner conductor (stem) is warmed up with a heater above transition (orange region noted Outer SC, Inner NC) • The outer conductor is warmed up above transition.
At this stage, the entire cavity is normal conducting (red region noted Outer NC, Inner NC). • The compensating coils are set to optimize ambient magnetic field (-15mG). • The cavity is then cooled down below transition with a cooling rate of 112 mK/s and a temperature The particular case of complete flux expulsion with the concentrated flux trapped at the bottom of the stem is also considered as shown in Fig. 4(c). Indeed, during regular cooling down, the SC/NC interface moves from the bottom of the outer conductor, then to the top of the cavity and finally down to the bottom of the inner conductor. This would result in a non-zero field measured in the inner conductor even with complete flux expulsion. The magnetic sensor installed inside the inner conductor (see red dots in Fig. 4) allows to distinguish between different types of trapping scenario in Fig. 4.
The flux trapping experiment has been performed as follows with the experimental data summarized in Fig. 5 1. The cavity has been cooled down to 4 K in a nonoptimal ambient magnetic field, resulting in a residual field measured by the probe of −55 mG shown as a blue region noted Outer SC and Inner SC.
2. The ambient magnetic field is changed (Helmholtz coils are off) to generate a magnetic field of+52 mG at t = 0:00 indicated by a black arrow still in the blue region. No reaction of the magnetic probe inside the stem proves the perfect diamagnetic behaviour (Meissner effect) at 4 K.
3. The external conductor is warmed up with heaters above transition shown as the light green region noted Outer NC and Inner SC. No reaction of the magnetic probe indicates complete shielding by the inner conductor (stem).
4. The outer conductor is cooled below transition again. Some amount of flux could be trapped during transition of the outer conductor but did not affect the sensor inside the stem because of perfect shielding by the inner conductor.
5. The inner conductor (stem) is warmed up with a heater above transition shown as the orange region noted Outer SC and Inner NC. The magnetic field measured by the probe changes significantly to reach +41 mG, indicating inefficient Meissner shielding of the outer conductor.
6. The outer conductor is warmed up above transition. At this stage, the entire cavity is normal conducting shown as the red region noted Outer NC and Inner NC. The magnetic field finally reaches +52 mG, which is the true ambient field without any field distortion by the Meissner effect.
7. The compensating coils are set to optimize ambient magnetic field (−15 mG).
8. The cavity is then cooled down below transition with a cooling rate of 112 mK/s and a temperature gradient of 4 K between top and bottom of the stem, shown as a blue region noted Outer SC and Inner SC. No reaction of the magnetic probe was observed. This indicates full flux trapping in both inner and outer conductors.
From Fig. 4(b), whatever the flux expulsion efficiency during cool down is, the outer conductor acts as only a weak magnetic shield at 4 K for the inner conductor. This is due to the presence of the three coupler ports at the bottom of the cavity and 2 ports on the top. Therefore, even in case of perfect diamagnetic effect by the material, the outer conductor would shield 62% of the ambient field. However, in reality, because of the poor flux expulsion by the polycrystalline niobium, the shielding is only about 10% (the difference of magnetic field measured between step 5 and 6). The shielding capability of the outer conductor could thus not explain the very low R mag of this cavity to the vertical magnetic field, and this needs other reasons as discussed from the next section. Note that no finite flux jump was observed during the cool-down. This indicates that the flux trapping is uniform and not like Fig. 4(c). A related subject concerning quench induced trapped flux is summarized in the Appendix B.
From this experimental results, the following statements can be concluded. The inner conductor provides a very efficient magnetic shielding at 4 K, whereas, even at 4 K, the simulation shows that the outer conductor has a very weak shielding capability due to the presence of ports at the top and bottom of the cavity. Flux trapping during cooling down is close to 100% in agreement with our assumption of the fine grain material. Even the inner conductor does not act as an efficient shield against permanent ambient fields present during superconducting transition. However, the inner conductor can very efficiently shield fields activated during accelerator operation from solenoids.
This experiment helps us to understand the global flux trapping in our low-β structure. No flux expulsion due to thermal gradient was observed and the fluxes are almost fully trapped during cooling down. However, this global flux trapping is an observation of a bulk property of a cavity material with a magnetic sensor in a certain distance. Any surface processes regarding flux exlulsion might not be resolved by this method.

IV. MAGNETIC SENSITIVITY
From now on, we assume that the flux is almost fully trapped in the surface of the cavity and no global flux expulsion happens in the cavities under test. At this stage, we do not assume any angles of trapped flux at the inner surface of the cavities. For the precise experiment of S mag , one has to remove the components R BCS and R 0 to extract pure R mag . This is accomplished by the following procedure: 1. The cavity is slowly cooled down in an ambient residual magnetic field H 0 as low as possible, the so-called "optimal configuration" depicted previously in Fig. 2. The vertical component stays below 10 mG as well as the horizontal component 2. The total surface resistance R s at low field is estimated from the Q 0 measurement with G the geometrical factor of the cavity as listed in Table I. 3. The cavity is warmed up slowly above transition during a night (> 50 K) and then cooled down in a homogeneous vertical magnetic field H 1 = 110 mG. The horizontal component stays below 15 mG.
4. R s is measured again, considering that the flux is fully trapped. By subtracting two surface resistances, we can estimate S mag by The sensitivities measured on the three types of cavities are summarized in Table II. The simple model calculation based on Eq. (4) overestimates the measured sensitivities of all the cavities. Apparently, recently proposed approaches with flux oscillation [34][35][36][37][38] based on the Bardeen-Stephen model [44] would improve the calculation but lack of precise information on material parameters especially on pinning centers prevents us from applying their models. Besides, the intrinsically complicated shape of the cavities would certainly limit the accuracy of these models, which were originally developed and validated for simpler geometries, such as 1-cell elliptical cavities. In the next section, we develop a novel way to take account of geometrical effects while keeping the local surface resistance the same as Eq. (4). As discussed in Appendix A, Eq. (4) can be considered as a special case of a local surface resistance based on the classical Lorentz force model by ignoring material dependence in detail. The simple convolution of geometry, which we introduce in the next section, leads to dramatically better agreements with all the measurement results as shown in Table II.  Table II, the measured sensitivities are systematically and significantly lower than the calculated sensitivities based on the model which assumes uniform power  dissipation over the inner surface for all the geometries. Moreover, the difference in sensitivity of the QWR by a factor of 10 to a vertical or horizontal field suggests a very strong geometrical dependence. The fact that RF magnetic fields are mainly distributed around the inner conductor, where the surface is almost vertical, could explain these observations. Indeed, as the surface resistance is estimated from the power dissipations, a change in surface resistance could be measured if and only if it occurs in high RF magnetic field regions. Trapping flux on the bottom of the QWR where the RF electric fields dominate, for example, does not induce any Q 0 drop as only RF magnetic fields are dissipating.
The R mag is no longer uniform over the cavity surface but shows position dependence. In this description, the angle between applied field H res and the surface does play a major role on the local surface resistance. However, there exist two hypotheses to explain this angular dependence.
Case 1 At the surface, flux perpendicular to the surface is more preferentially trapped and thus drives the RF losses.

Case 2
The flux components are homogeneously trapped and the flux oscillation by RF depends on the angle between the trapped flux and the surface.
At the first glimpse, they seem not distinguishable by RF measurement. In this paper, we show that we can in fact distinguish them by temperature mapping. The case 2 is suggested by recent measurements using magnetic field mapping around an elliptical cavity [40]. In this scenario, the orientation of the flux is preserved before and after the superconducting phase transition, if global flux expulsion is suppressed by uniform cooling down especially on polycrystalline material without annealing over 800 • C. Whatever the trapped angle is, the trapped flux is vibrated by RF current via the Lorentz force.

B. Previous sample measurement suggests case 1
We point out that the case 1 is strongly favoured by previous theoretical and experimental studies. Experiments [41,45] on the reversible magnetization M eq and irreversible magnetization M irr verified the angular dependence on trapped flux applied on isotropic type-II thin films. The magnetization is a macroscopic measure of trapped vortices' orientation. In equilibrium magnetization with applied field H higher than the lower critical field H c1 , M eq and correspondingly vortex lines are normal to the surface at low fields and become aligned with an externally applied field H when it approaches the upper critical field H c2 . On the other hand, the pinning effect M irr is always normal to the surface regardless of the field strength if the angle between the applied field and the normal vector to the surface is within certain value determined by the geometry (smaller than 70 degree in their samples).
One may argue that the dimension of the sample measurement is so thin that these results are not relevant to be compared with cavity materials. However, near T c , the penetration depth is infinitely long so that the cavity wall can be treated as a thin film. The cavity cooldown virtually mimics the magnetization measurement of a small sample because cooling under a constant small external field is the same as reducing the external field at constant temperature. In addition, another experiment on a sample for cavities showed that the flux trapping is more likely in the normal direction to the surface [46]. This experiment was based on fluxgate sensors.
The fundamental reason of perpendicular flux trapping can be explained by the image force effect. The image force which acts on a parallel component of trapped flux is so strong that any realistic pinning force in relatively clean niobium can not keep the flux within a few penetration depths. This effect is only at the surface, and the macroscopic measurement by magnetic sensors, as described in section III may not be capable to resolve it. The detail discussion is summarized in Appendix C.

C. Lorentz force
The sample measurement and direct measurement of elliptical cavities with fluxgate sensors are clearly in contradiction. In order to distinguish case 1 and 2, we consider Lorentz force caused by RF current at the surface. Here, we clarify different spatial distribution of RF losses in case 1 and case 2. The contributions of S mag based on flux oscillation can be estimated by considering the Lorentz force interaction between the quantized flux line and the local RF current.

Case 2: no angle dependence in flux trapping
We start to consider case 2 first. As shown in Fig. 6, with a local spherical coordinate with an RF current density vector J RF aligned to the x-axis, θ the polar angle between the RF surface and the trapped flux vector B fl , and ϕ the angle between the trapped flux projected to the RF surface and the RF current, the Lorentz force density vector f L can be written as where φ 0 is the flux quantum (2.07 × 10 15 Wb) and J 0 is the amplitude of the RF current density. In this model, (θ, ϕ) is determined by the relative orientations of the magnetic residual field, the cavity surface and the direction of the RF currents in the particular position. To calculate flux oscillation in a thick bulk niobium in y-direction, Checchin et al. [35] introduced a 1dimensional differential equation with M and η the effective mass and viscosity of a flux, respectively, in the Bardeen-Stephen model and f p the pinning force [65]. This equation originates from Gittleman and Rosenblum [29], who calculated flux oscillation in a thin film 12.7 um thick, and thus θ ∼ 0 was fairly applied in their case. However, in case 2 for general shaped cavities, θ ∼ π/2 can happen and this corresponds to a flux trapped in the parallel direction to the surface.
Therefore, there may be another degree of freedom (zdirection) in the flux oscillation Providing that the material is uniform and isotropic, M , η and f p are similar in both y-and z-axis, and these two degrees of freedom contribute to two independent modes of the flux oscillation. Correspondingly, the sum of these two modes results in power dissipation. In both flux flow and pinning regimes, magnetic sensitivity is locally S mag ∝ cos 2 θ + sin 2 θ sin 2 ϕ. (10)

Case 1: perpendicular trapping to the surface
In the first order approximation of case 1, only the perpendicular component of the flux is trapped and contributes to the Lorentz force The flux oscillation becomes virtually 1-dimensional and mathematically reproduces the formulation by Ref. [35]. The magnetic sensitivity is locally The predicted angular dependence is different from the former model Eq. (10), in which all the flux components are trapped whichever the orientation to the RF surface is. This difference can be experimentally addressed in the method that we propose in the next section.

D. Convolution of geometrical effect and local sensitivity
We developed a numerical method to distinguish case 1 from case 2 by convoluting Eq. (10) or Eq. (12) and cavity geometry with Eq. (4). The local spherical coordinate (θ, ϕ) in the previous discussion is defined at each point over the cavity surface in the global Cartesian coordinate (X, Y, Z), and namely, the Lorentz force and S mag depend on θ(X, Y, Z) and ϕ(X, Y, Z). When we apply H res to a cavity, θ(X, Y, Z) and ϕ(X, Y, Z) are determined by the three dimensional structure of the cavity. We take account of this effect as follows: 1. Numerically evaluate the residual field to be trapped from three dimensional models of cavities. In case 1, H ⊥ (X, Y, Z) becomes H res cos θ(X, Y, Z).

Evaluate the local surface resistance caused by the trapped flux oscillation
from Eq. (3) and Eq. (4) with η mag ∼ 1 as discussed before. It is important to emphasize that this formulation is the same as the consequence of Lorentz force calculation in Gittleman and Rosenblum [29] as described in Appendix A. The material dependence is included in R n (f, T ) and H c2 , and fixed in this analysis which focuses on geometrical effects.
3. Similar to the previous work by one of the authors [47], integrate Eq. (14) all over the cavity surface S and obtain a new sensitivity S mag with geometrical correction  Figure 7 shows RF power dissipations (∝ R mag (X, Y, Z)) from our model applied to an elliptical cavity when the external magnetic field is perpendicular to the beam axis. The configuration of the magnetic fields corresponds a typical horizontal cavity test. The case 1 shows two dissipating areas aligned on the equator and placed at 180 • from each other. On the other hand, case 2 shows rather uniform dissipation along on the equator. This is because the angle ϕ is approximately 90 • between the flux perpendicularly applied to the cavity and the RF current around the equator so that S mag ∝ cos 2 θ + sin 2 θ ∼ 1 (16) is independent of the polar angle θ.
Temperature mapping data showed in Figure 12 in Ref. [40] clearly highlights that dissipating regions draw two domains centred on the equator where the applied field is normal to the surface and separated of 180 • . No increase of surface resistance is measured where trapped flux is parallel to the surface. This observation is in favour of the case 1, in which flux in the surface is trapped in the perpendicular direction. The parallel components, which should exist in case 2, may not contribute to the RF dissipation or may be simply expelled from the surface due to the image force.
It is very important to note that vertical tests, in which ϕ ∼ 0 is applied around the equator, are not suitable to distinguish case 1 from case 2 because the Lorentz force depends only on cos θ in both case 1 and case 2. The different dependence on θ and ϕ in case 1 and 2 is hidden in vertical tests. However, the horizontal tests can reveal the difference between case 1 and 2.
In order to investigate our model further, the same calculations of case 1 are applied to different angles between the external magnetic field and the beam axis of the elliptical cavity. We compare our geometrically corrected S mag and the experimental data taken by the same group of temperature mapping [40]. Their experiment was conducted in a similar configuration as ours. They deliberately applied 100 mG to a cavity with different angles, and several thermal cycles ensured η mag higher than 0.5 and even close to 0.9. Note that this group concluded homogeneous trapping without any angular preference, contrary to our above argument. Their conclusion was based on the magnetic field mapping outside the cavity.
We remove a common residual resistance R 0 = 5 nΩ [50] from published R res [40] and divide it by 100 mG to obtain S mag . The absolute value of S mag depends on material parameters and is not predictable. For the correction of the material effect, we linearly scale the model prediction S mag to fit the data. As depicted in Fig. 8, quantitative agreement is obtained between our model and their experimental data. The RF power dissipation is more sensitive to higher angle closer to the magnetic field parallel to the beam axis. Although the RF field between the iris and the equator is lower than that at the equator, the total area of trapped flux normal to the cavity surface is large so that Eq. (15) leads to higher sensitivity. It has to be pointed out that experimental data published in Ref. [6] showed on the contrary that the transverse sensitivity (= 0 • ) is higher than the axial sensitivity (= 90 • ). This difference can be explained, on one hand, by the capability of the material to expel the magnetic flux instead of fully trapping it, and on the other hand, by the cooling configuration. Indeed, the expelled vortices are pushed by the SC/NC interface and can be concentrated on the last remaining normal conducting region. In Ref. [6], the cavity is set horizontally and cooled from the bottom to the top. The last remaining normal region where all vortices are concentrated is at the top of the equator, the most sensitive region. They achieved an excellent flux expulsion by heat treatment above 800 • C with nitrogen doping and also by a fast cool-down. On contrary, the study by Ref. [40] was dedicated for almost full flux trapping and global flux expulsion was suppressed. Trapped flux is thus more uniformly spread over cavity surface and not only concentrated in very sensitive regions as the equator. Therefore, the conclusions can be different in each case. The material for our coaxial cavities is not prepared for efficient flux expulsion and our experimental condition is closed to Ref. [40].
F. Application to our cavities Figure 9 depicts the three kinds of graphical output generated by the code. The results of this model S mag are shown in Table II. The relative errors between the experimental and calculated values with the proposed model are dramatically improved by the proposed geometrical correction. This good agreement is consistent with the analysis on elliptical cavities and consolidates case 1. The flux in the coaxial-type cavities is almost fully trapped but the amount of the flux normal to the surface, which contributes to the RF power dissipation, depends on the relative angle between the applied field and the cavity surface.

G. Puzzle from the magnetic field measurement
Our model, motivated by sample measurements, agrees on RF measurement results and temperature mapping data. This apparently contradicts with magnetic field mapping [40] and even our measurement by a fluxgate sensor in section III. We do not have direct evidence to fully explain this puzzling contradiction. We just propose one hypothesis which could resolve the issue. It is well known that global flux expulsion is influenced by bulk property of the material. The surface property has been considered to just affect the flux sensitivity in the first approximation. However, we argue that the surface property could be particularly important to the expulsion of parallel flux within RF penetration depth. Such a phenomenon is so local at the inner surface of the cavity that magnetic field sensors in certain distance from the surface may not resolve very small distortion in the parallel field.
As described in Appendix C, three forces are important to understand the expulsion of a parallel flux. The first is an image force f 1 which expells the flux, the second is a counter-acting force f 2 , and the third is pinning force f p . Figure 10 compares the above three forces f 1 , f 2 , and f p , estimated from plausible parameters of our cavities, with a region of RF field penetration by 3 × λ. Since the external field is as small as 100 mG, f 2 is also small so that the surface barrier of Bean and Livingston exists around 800 nm deep inside the bulk. Therefore, this effect does not keep parallel flux inside the RF penetrating region. Although the f p estimate shows huge uncertainty, the image force is still stronger than the pinning force by several orders of magnitude. This indicates that parallel fluxes, which can contribute to the RF power dissipation, are totally expelled from the surface. From this consideration, we can argue that the observation in Ref. [40] may not contradict our statement. The outer surface of a cavity is usually not as clean as the inner surface and thus the pinning force must be stronger than the above estimation. The flux at the equator may be trapped in parallel at the outer surface and does not contribute to the RF power dissipation. The magnetic sensor placed outside the cavity with some distance may not resolve the parallel flux at the inner surface. If the parallel fluxes were trapped in the inner surface within a few penetration depths, the other oscillation mode in Eq. 9 would change the spatial distribution of power dissipation.
Finally, we stress that this discussion may be special for our cavities, which is made of relatively clean niobium at the inner surface. For cavities after low temperature baking or nitrogen doping, the impurity content just underneath the inner surface within penetration depth is known to be substantial [4,51]. This would enhance the surface barrier to protect the RF field penetrating into the bulk but the same barrier would prevent the parallel ambient flux escaping from the bulk. From this consideration, such cavities might keep some amount of parallel trapped flux, which may show additional heat dissipation in Eq. (10).

VI. CONCLUSION
Magnetic sensitivity measurements were performed at IJCLab on several type of resonators (QWR, single and double spoke). Unlike during cooling down, once the cavity becomes superconducting, magnetic shielding is complete. A magnetic shield made of superconducting material is very efficient to shield any magnetic field absent during cool-down, such as fields generated by coils or solenoids for accelerator operation. However, a superconducting shield made of poorly expelling material, such as reactor grade niobium, is totally inefficient to shield any ambient magnetic field during cooling down. The complete understanding of the magnetic flux trapping mechanism and the ensuing magnetic sensitivity is of first importance to optimize cooling procedures and magnetic shielding for future projects.
Our measurements reveal a strong geometrical dependence of surface resistance to magnetic field. The real sensitivity, evaluated indirectly and globally by RF power measurements, is consistently lower than the theoretical sensitivity under an assumption of uniformly dissipating trapped flux. This demanded a new method to convolute the geometrical effect to calculate proper magnetic sensitivity. We pointed out that recent experiments based on magnetic field sensors around the cavities may contradict with well-known sample experiments. The former suggest homogenous flux trapping without any angle dependence between the external magnetic field and cavity surface. The latter suggests more efficient trapping to the perpendicular direction to the surface. We critically reconsidered the flux oscillation under the Lorentz force effect driven by RF current. The assumption, that the normal component of the residual magnetic field is preferentially trapped at the inner surface during the superconducting transition, appears to be a reasonable hypothesis by comparing elliptical cavity results. More particularly, the model can explain the hot zone distribution of the temperature mapping and the angular dependence of magnetic sensitivity. Using this new method, a very good agreement between calculated and measured sensitivities has been obtained for several types of geometries in this study. The magnetic sensitivity would be thus not only determined by the material history and its capacity to trap magnetic vortices but also by the material surface orientation versus the ambient magnetic field during superconducting transition. The ambient flux parallel to the surface would be locally expelled during superconducting transition by the image force effect over a depth around the London penetration depth at the inner surface of the cavities.

Acknowledgement
The authors would like to thank all the experimental works and efforts of Supratech team and the accelerator department at IJCLab to allow such specific studies to happen on prototypes cavities dedicated to projects. Our special thanks goes to R. E. Laxdal for the useful discussions. Part of this study (MYRRHA SSR) happened during MYRTE project, which has received funding from the EUR-ATOM research and training programme 2014-2018 under grant agreement N • 662186. In Ref. [1], the formulate Eq. (4) is derived from a static model regarding normal conducting cores of trapped flux. This can be understood as a special case of dynamics flux oscillation driven by the Lorentx force. We derive this by combining the notation of Ref. [35] and Ref. [36]. The model is based on Ref. [44] for originally a thin film sample [29]. Although the model disregards some fundamental aspects of trapped fluxes, such as effective flux tension, it is known to sufficiently explain some important experimental results.
We take the local coordinate system as shown in Fig. 6 but we swap the polarity of z-axis for simplicity. For a perpendicularly trapped flux, the equation of motion of a unit length of the flux at depth z can be where we consider that the pinning potential is harmonic ky 2 /2 and the RF current is reduced by the penetration depth λ. A particular solution of this driven damped harmonic oscillator can be obtained by substituting a trial solution to Eq. (A1), comparing real and imaginary part so that The RF power dissipation by work to a flux can be where T = 2π/ω is one period of oscillation. For n fluxes per unit area, (A7) Using normal conducting resistivity ratio ρ n , the Bardeen-Stephen model defined and we obtain where we defined ω 0 = k/η Finally, we substitute following relations of normal conducting surface resistance R n , surface RF magnetic field H RF and magnetic field density of trapped flux B res and obtain The effective inertia of a flux M is usually negligible. In a flux flow regime ω ω 0 , Eq. (A14) reproduces Eq. (4). In a flux pinning regime ω < ω 0 and an intermediate condition ω ∼ ω 0 , the flux oscillation contains an additional factor that depends on material parameters and RF frequency. In our study, frequency is relatively low (< 352 MHz) and the cavities are made of a clean polycrystalline niobium. It is not possible to precisely know the relation between ω and ω 0 . The good agreement of Eq. (15) with a geometrical convolution Eq. (15) may indicate that our cavities are in the flux flow regime.

Appendix B: Quench and flux trapping
Quenching a cavity during operation could potentially lead to the degradation of its quality factor due to fast flux entry into a normal conducting quench spot [52]. This degradation is fully extrinsic and it only depends on the external residual magnetic field around the cavity during quench [7]. Also, it is of importance to study the evolution of a quench spot by using the dynamics of flux penetration followed by flux rearrangement. The sensitivity of the fluxgate sensor enables us to address these phenomena.
So as to study this on Spiral2 QWR, we installed a magnetic sensor probing the vertical magnetic component at the quench location as shown in Fig. 11 and also indicated in Fig. 3 as a probe named quench. Before this experiment, previous works [28,53] had localized the quench location. In this particular experiment, only one of the fluxgate sensors is read out without multiplexing in order to catch the fast quench events. For signal amplitudes less than 10 mG, the response time of the fluxgate sensor is faster than 30 ms [54] while the data acquisition rate limits the time resolution to 50 ms.  Figure 12 depicts how the magnetic field at the quench location is changing after several quenches. Before quenching the cavity, the compensating coils are switched off at time 5 s to change the magnetic background as indicated by the dashed black line. As presented in the main text, the inner conductor completely shields this magnetic field and results in no change of the measured field by the probe. After the first quench around time 38 s, the field promptly drops significantly, indicating the flux penetration into the quench spot. Such a flux entry is possible because of the weak shielding provided by the outer conductor. The measured magnetic field reaches saturation around 3 mG after several quenches around time 70 s. After the saturation, the coils are switched back on and the field is compensated again at time 95 s. Then, after a couple of quenches, the measured magnetic field saturated back to the initial level around time 130 s. The cavity has to undergo at least three quenches to reach saturation The transient response of the magnetic field to the quench event is characterized by a narrow peak of width 50 ms (standard deviation), followed by an exponential  The observed peak is due to the demagnetization effect at the opening of a normal conducting quenched area, in which the magnetic field contained between the outer and inner conductor can tunnel. According to our simulation, the demagnetization factor becomes the maximum when the radius of the quench spot is around 10 mm. Our previous study [55] showed that the time scale of hot spot expansion is less than 1 ms; therefore, this phenomenon is smeared by the time resolution of the detector response.
On the other hand, the quench zone cools down with a characteristic time of the order of 50 ms [55] and eventually collapses to be superconducting again. The flux lines penetrating the wall during the quench are pushed inwards by the phase front. As we discussed in the main text, almost all the flux would be trapped by pinning centers of the polycrystalline material to relax the demagnetization at the phase front. Therefore, opening and closing the quenched spot is an irreversible process and results in exponential relaxation in the measurement.
Finally, the trapped flux is frozen and results in the constant floor. This determines the total number of trapped flux during a single quench event. Multiple quenches let magnetic flux quanta occupy all the potential pinning centers, similar to an observation in an elliptical cavity [7].
In conclusion of this section, flux trapping happens during quench and could be reversible. Several cycles of quench are necessary to reach saturation. It is thus possible to recover a degradation triggered by a quench event by re-quenching the cavity in a re-optimized magnetic environment instead of warming up a full cryomodule above transition as reported in [7]. The degradation by quench (if caused by flux trapping) is caused by a non-optimal magnetic shielding. which trapped vortex starts to escape from the pinning centers by Lorentz force; thus, On low-purity niobium, Das Gupta et al. obtained [63] J c ∼ 5 × 10 1 0 A/m 2 near the surface and J c ∼ 2 × 10 9 A/m 2 at 3 µm deep inside the bulk. Recently, a more relevant experiment on clean fine grain niobium for the cavity application showed [61] J c = 10 8 -10 9 A/m 2 and therefore we can estimate f p = (2 × 10 −7 − 2 × 10 −6 ) N/m. (C10) The large uncertainty of a factor 10 comes from different models to estimate J c from DC magnetization. These results are consistent with the estimation Eq. (C8). Figure 10 compares the estimated pinning force and the surface forces.