Polynomial Chaos Expansion method as a tool to evaluate and quantify field homogeneities of a novel waveguide RF Wien Filter

For the measurement of the electric dipole moment of protons and deuterons, a novel waveguide RF Wien filter has been designed and will soon be integrated at the COoler SYnchrotron at J\"ulich. The device operates at the harmonic frequencies of the spin motion. It is based on a waveguide structure that is capable of fulfilling the Wien filter condition ($\vec{E} \perp \vec{B}$) \textit{by design}. The full-wave calculations demonstrated that the waveguide RF Wien filter is able to generate high-quality RF electric and magnetic fields. In reality, mechanical tolerances and misalignments decrease the simulated field quality, and it is therefore important to consider them in the simulations. In particular, for the electric dipole moment measurement, it is important to quantify the field errors systematically. Since Monte-Carlo simulations are computationally very expensive, we discuss here an efficient surrogate modeling scheme based on the Polynomial Chaos Expansion method to compute the field quality in the presence of tolerances and misalignments and subsequently to perform the sensitivity analysis at zero additional computational cost.


Introduction and motivation
The results of simulated electromagnetic models and the real fabricated systems may differ.Not every single detail can be included in the electromagnetic model due to the finite computational capacity.Assumptions are made and some aspects of the real-world model are ignored.The electromagnetic models themselves are errorprone, depending for instance on the number of mesh cells and discretization uncertainties.
Fabrication processes, with their inherent mechanical uncertainties, have an impact on the actual electromagnetic response.Waveguides are one example of such systems; the electromagnetic modes are influenced as a result of the mechanical uncertainties.The RF Wien filter recently designed is based on a parallel-plates waveguide [1].This waveguide is subject to stochastic mechanical variations.Unfortunately, analytic solutions for the fields resulting from a complex structure such as the RF Wien filter do not exist.Approximation methods such as perturbation theory for instance [2] cannot be applied to tackle tolerance problems, therefore numerical solutions are applied to quantify the uncertainties.
The classical Monte-Carlo (MC) approach requires the calculation of a large number of responses corresponding to a set of uncertain parameters.Basically, Monte-Carlo methods converge slowly in the sense that they require a substantial number of simulations (typically of the order of 10 4 to 10 5 ) to provide a reliable estimate of the system performance.We rely on a commercially available software to simulate the RF Wien filter 1 .In the case where the model evaluation requires full-wave simulations of a complex electromagnetic structure such as the RF Wien filter, the Monte-Carlo approach cannot be used because of the long time required for each simulation.
The proposed method in this study is primarily based on the so-called Polynomial Chaos Expansion (PCE).The aim is to build a surrogate mathematical model that requires only a small number of model evaluations to reconstruct the response of the RF Wien filter in terms of the field homogeneity.Surrogate modeling is one possible solution that is feasible and which provides a reliable method to quantify uncertainties and provides a sensitivity analysis at zero additional cost.The PCE method has been used in many engineering applications, such as modeling uncertainties in electric motors [3], and also in accelerator science [4].
This paper is organized as follows: Section 2 describes the motivation and the requirements for the proposed mod-eling scheme.Section 3 describes the considered electromagnetic field uncertainties.Section 4 briefly introduces the PCE theory and describes the mathematical formulation necessary for the purpose of this paper.Section 5 shows the application of the PCE theory and how it can be used to quantify the quality of the electric and magnetic fields.To conclude the analysis, Section 6 reports about the global PCE-based sensitivity analysis, and in Section 7 results are summarized.Four appendices can be found at the end of the paper.Appendix A explains the construction of the univariate and multivariate Hermite orthogonal polynomials (basis), and Appendix B clarifies and validates the theory with a simple example.Appendix C discusses the employed PCE truncation scheme.Finally, Appendix D explains the least-angle regression method used in this paper.

Modeling mechanical uncertainties of the RF Wien filter
The RF Wien filter is based on a novel concept of a parallel-plates waveguide as shown in Fig. 1.The system consists of a transmission line composed of two conductors that supports the transverse electromagnetic (TEM) mode in the frequency range required by the electric dipole moment experiment (see [1]).The RF Wien filter requires an orthogonal electromagnetic field without components in the beam direction which is fulfilled by the TEM mode.The field quotient Z q = −E x /H y controls the Wien filter condition (see [1]), e.g., for deuterons at 970 MeV /c, Z q must be ≈ 173 Ω to provide zero Lorentz force.To set Z q to any particular value, the wave mismatch theory [5] has been used.This mismatch forces part of the electromagnetic field to be reflected back into the structure, thereby  forcing a forward and backward propagation of fields.The fields sum up vectorially to produce the necessary field quotient.Together with the optimally shaped electrodes, a minimal integral Lorentz force can be ensured.A ferrite structure surrounds the electrodes to homogenize the magnetic field and to increase the magnetic field by 25% compared to a ferriteless solution.
As shown in Fig. 2, x 1 and x 2 represent the lengths of the upper and lower electrode, respectively.x 1 and x 2 are considered independent random variables.According to the information provided by the manufacturer [6], the electrodes can be produced with a fabrication tolerance of ±0.1 mm, such that x 1,2 = 808.8± 0.1 mm.Statistically, x 1 and x 2 are modeled as Gaussian-distributed, independent random variables with a mean µ = 808.8mm and a standard deviation σ = 0.1 mm, abbreviated as G (µ, σ).
In reality, deviations from the ideal parallelism of the electrodes may occur which needs to be included in the field simulations.This is taken into account by allowing the two plates to rotate in the xy and xz plane (see Fig.  rotation of the ferrite structure in the(xz-plane) G (0, 1) mrad and 3 for coordinates).A rotation in the yz plane is less probable and is therefore not considered here2 .x 7 and x 8 represent the tilt angles of the possible rotations of the electrodes in the xz plane (see Fig. 2).The electrodes can also move independently with a rotational interval up to ±1 mrad [6].
As shown in Fig. 3, the variation of the width of the electrodes (x 3 and x 4 ) and their rotation in the xy-plane (x 5 and x 6 ) are considered as well in the calculations.x 9 and x 10 correspond to undesired rotations of the ferrite structure in the xy and the xz plane, respectively.All random variables may vary simultaneously.The statistical characteristics of the random variables considered here are listed in Table 1.

Electromagnetic field uncertainties
The desired electric field should point into the x-direction, thus ideally produce (E x , 0, 0), while the magnetic field should point into the y-direction, (0, H y , 0).The unwanted field components are denoted by E ⊥ and H ⊥ and were defined in [1] as The results for 1000 full-wave simulations are collected in Fig. 4, in terms of the magnitude of E ⊥ and H ⊥ .These simulations used the Gaussian distribution of the x i (i = 1, . . ., 10), as given in Table 1, and the stochastic variations of the unwanted fields E ⊥ and H ⊥ are evaluated along the beam axis.Mechanical tolerances lead to deviations of the wave vector k from its ideal direction along the beam axis.Such deviations generate unwanted fields.For instance E ⊥ , shown in Fig. 4(a), can reach 30 V/m inside the RF Wien filter, while at the edges, a value 150 V/m is possible.The fields at the edges are approximately 5 times larger than the inner ones.
The magnetic fields H ⊥ , shown in Fig. 4(b), exhibit a different behavior.The unwanted fields at the edges have roughly twice the magnitude compared to the inner ones.Inner deviations reach up 0.7 A/m in contrast to 1 A/m at the entrance and exit of the RF Wien filter.Uncertainties deform the cross-section of the waveguide at the entry and exit points of the Wien filter in an asymmetric manner, resulting in non-equidistant and non-parallel electrodes.This explains the non-uniformity and asymmetries of the field variations.
The field homogeneities, specified via f int E ⊥ and f int H ⊥ are calculated by taking into account the total fields (see [1]), which results in The effective length of the RF Wien filter amounts to 1550 mm.In order to speed up the calculations, the integrals in Eq. (3) were evaluated for = 1152 mm along the longitudinal axis of the RF Wien filter.The field contributions outside the considered length are very small (of the order of 10 4 ) and are not taken into account.In the following, the electric and magnetic fields homogeneities are denoted by Y E and Y H .These are the quantities that this paper tries to estimate within a reasonable number of full-wave simulations.

Note on the full-wave simulations
During the design phase of the RF Wien filter, around 63 × 10 6 mesh cells have been used in the simulation software.Each simulation required roughly 12 hours on a GPU-based computing system.For a reliable MC simulation, 10 5 simulations would be required, corresponding to years of computation time.Clearly this is not a feasible solution.
For the uncertainty analysis, the complexity of the electromagnetic model of the waveguide RF Wien filter has been reduced, ignoring therefore many details of the mechanical model, e.g., support screws and their holding rings.The number of mesh cells has been reduced to 38 × 10 6 mesh cells.Moreover, the material properties of some components have been simplified; the vacuum vessel and the inner support tube do not affect the field quality and they can be safely changed from non-magnetic stainless steel to PEC (perfect electric conductors).Thereby, the number of mesh cells is further decreased to 13 × 10 6 and the simulation time for one configuration is reduced to nearly 2.5 h.
f int E ⊥ and f int H ⊥ have been computed.Compared to the complex model, the reduced-order model exhibits small differences, but it should be noted that without such simplification, an uncertainty analysis would not be possible at all.Computation times of 2.5 h are also not very affordable (2.5 h is the pure solving time, which does not include the preparation phase for the simulations, e.g., the meshing and the preparation of the material matrices).In total, it took more than 115 days to perform 1000 simulations, which were carried out discontinuously, depending on the availability of the GPU-cluster.

Introduction
Polynomial chaos expansion (PCE) is a spectral method that can describe randomness (e.g., uncertainties) in stochastic dynamical systems in a Fourier-like series expansion.It was originally proposed by Norbert Wiener [7] and integrated into the finite-element method (FEM) by Ghanem and Spanos [8].
Formally, for the polynomial chaos expansion to be defined, a complete probability space is required.Let (Ω, F, P) be the complete probability space, where Ω is the sample space, F is the σ-field and P is the probability measure on F [9]. Wiener found that the Hermite polynomials are orthogonal with respect to Gaussian probability measures P in L 2 -normed (Ω, F, P) spaces and can therefore be used as basis functions to span Gaussian spaces.This allows any random process with finite second-order moment (regardless of what it represents) to be fully described by a set of deterministic coefficients (see the Cameron-Martin theorem for more details in [10]).In principle, the theory is not restricted to Gaussian spaces, in fact, other polynomials can span non-Gaussian spaces as described in [11].

System representation and calculation of coefficients
Fundamental for the PCE calculations is the so-called multi-index set.This is simply a multi-dimensional indexing scheme related to the tensor product of the Hermite polynomials.The tensor product is one of the methods that can be utilized to produce the multi-dimensional Hermite polynomials.The multi-index set is represented as i and is defined as p is the order of the polynomial (also called the expansion order), 1 is the L 1 norm, explained in Appendix B. x is the vector of all random parameters that represent the possible uncertainties in the RF Wien filter, i.e., x = {x 1 , x 2 , ..., x 10 }, as collected in Table 1.Y denotes the output of the system (also called the model response).Y describes in fact the electric and magnetic field inhomogeneities.
For the PCE series to converge, it is necessary that x be standardized.Standardization is a form of iso-probabilistic transformation that transforms an arbitrary random variable into a normally distributed one with zero mean and unity standard deviation.Thus, the input parameters x i are transformed into the corresponding standardized random variables ξ i .The stochastic spectral representation, expanding the model response Y with an m-dimensional truncated PCE to the order p reads Here M is called the meta-model and it denotes the solver used.In the analysis conducted by Ghanem and Spanos [8], M was the finite-element method (FEM).But it can be in principle any solver such as the finite integration technique (FIT), as in the case of this work 3 .The α i denote the (deterministic) expansion coefficients to be determined, Ψ i are the basis functions (the multivariate chaos polynomials).The detailed computation of the homogeneous chaos basis functions is explained in Appendix A.
To compute the expansion coefficients, intrusive and non-intrusive approaches can be used.Intrusive methods alter the underlying code by introducing another form of discretization.This stochastic discretization converts the governing stochastic equation into a large system of linear equations.This technique is computationally fast, but altering code is often error-prone.In addition, the deterministic code may not be available, or may require many difficult analytical calculations.The other approach, the non-intrusive one, considers the (existing) deterministic code as a black-box.No changes of the code are required.It runs independently from the solver used in the deterministic code, which makes it an attractive option.The expansion coefficients are calculated having multiple calls to the deterministic code via regression or projection.
Projection requires the evaluation of expected values (integrals) and relies on the orthogonality of polynomials to compute the coefficients in the form of Regression on the other hand computes the coefficients with the least-square minimization method.According to [12], regression leads to more accurate results and it is used in this work.Regression methods require the solution of a large system of linear equations (LLSE) and matrix inversion, as will be shown later.
Matrix inversion may fail.To avoid this case, a wellposed restriction is imposed on the LLSE, in the leastsquare sense.In terms of the PCE analysis, this restricts the lower bound on the costly lower number of full-wave deterministic simulations N .N as a rule of thumb must be at least 1.5 times the number of polynomials basis P calculated as the following permutations Rewriting Eq. ( 5) in matrix form, yields Equation ( 8) must be solved for the electric and magnetic field inhomogeneities individually.By using the regression method, and assuming N is large enough, the coefficients are calculated using the leastsquare estimation method (LSE), given by The output of the full-wave simulations is expressed in terms of the electric and magnetic field homogeneities via Y E and Y H , respectively.Y without any index refers to either of the two cases.

Sparse PCE
With high-dimensional problems (the number of uncertain variables m ≥ 10), such as the RF Wien filter, classical-full rank PCE is not feasible in the sense that the number of full wave simulations is intolerably large.In this case, PCE theory does not provide any advantages compared to MC methods.This was the motivation to look for a sparse version of PCE.Blatmann et al. [13] proposed a systematic methodology to build an adaptive sparse PCE.Blatmann proposed to select only a subset of the basis functions that have the highest effects on the system response and to reject the other functions using a two-step procedure, in particular, a hyperbolic truncation scheme followed by a least angle regression (LAR) algorithm [14].In his dissertation, Blatman showed that sparse PCE can still produce accurate meta-models but with much less complexity.
The PCE series shown in Eq. ( 5) is truncated 4 up to a finite order p.The hyperbolic truncation scheme [15], implements an additional truncation scheme on the already p-truncated series by eliminating the basis functions with the highest order of interaction, as clarified in Appendix C. In [16], an interaction is formally defined as the "Existence of joint factor effects in which the effect of each factor depends on the levels of the other factors", while a factor is defined as "A controllable experimental variable that is thought to influence the response".According to the so-called sparsity-of-effects principle, the low-order interactions monumentally dominate the highorder ones.This concept is implemented in the PCE equations by manipulating the multi-index set in Eq.( 4).Altering the multi-index set clearly changes Eq. ( 5) and the subsequent ones.The new hyperbolically-truncated multiindex set is referred to as I m,p,q .The new term in I defines the so-called 'q-norm', a quantity explained in Appendix C. It defines a quasi-norm in the 'probability space', as the probability space is also a metric space.The 'q-norm' is selected between 0 and 1, with 1 being not truncated.
Next, a method used in machine learning, the leastangle regression method (LAR), is employed in the context of PCE.LAR employs a routine of iterating over the remaining chaos basis functions to select the set that has the highest influence on the model response.The basis will be filtered according to their contribution to the system response regardless of their order of interaction.The LAR algorithm was originally proposed by Efron [14], while [17] is a descent of the least-square regression method used to solve LLSE.The LAR algorithm is not used to compute the chaos expansion coefficients but to select the basis functions.Then, the LSE is used to compute the coefficients.The resulting LAR truncated multi-index set is referred as I * m,p,q .Executing the LAR algorithm results in a number of solutions (many possible basis functions sets).The selected LAR model chosen that yields the minimum leave-one-out error L oo is explained later.The coefficients are then calculated using the ordinary LSE regression.If the L oo does not reach the required threshold accuracy, new samples are added and the algorithm is repeated.The algorithm chart is detailed in [18].

Cross-Validation
Cross-validation is a technique employed to assess the quality of the PCE meta-model.The basic idea is to decompose the (input/output) data into K sets.K − 1 sets are used to build the fit model and the error is calculated by predicting the remaining set not included in the fitting calculations.This method is called the K-fold crossvalidation technique [17].When K equals the cardinality of the design of experiment N , the validation method is called the leave-one-out cross-validation (LOOCV).The implemented algorithm selects a single instance ξ k from 4 Any expansion implemented on a computer is actually truncated.
the input set and computes the meta-model of the remaining set, i.e., M ξ − {ξ k } = Y k .The algorithm iterates over each of the sets and the leave-one-out error is calculated according to A reliable PCE meta-model requires a leave-one-out error e rrLOO in the order of 10 −2 [19].

Results
The 10-dimensional input data were generated using a quasi-random scheme, called the nested latin hypercube sampling (NLHS).Firstly, latin hypercube sampling (LHS) is an efficient sampling scheme proposed by McKay [20] that offers better representation of the input data compared to MC-based sampling methods [21].It offers similar performance compared to MC-based schemes in the sense that the latter requires a larger number of samples and consequently a larger number of simulations to provide the same quality as the LHS.The nested LHS (NLHS) allows the initial size of the design of experiment to be increased in order to fulfill the e rrLOO .One does not know in advance how many simulations must be performed in order to build a reliable statistics.It is probable (as in this paper) that the number of simulations must be increased to meet the cross-validation conditions.The NLHS is one validated method [18] to do this.
At first, 100 full wave simulations have been carried out, then the number of simulations was increased to 300, until the leave-one-out error threshold has been reached.A q-norm q of 0.4 has been selected, as suggested in [21].The PCE expansion was truncated at the p = 11 th -order.Applying the LAR algorithm results in 300 meta-models with the coefficients for the electric and magnetic fields, respectively, shown in Fig. 5. On each set of LAR coefficient the leave-one-out cross-validation is performed and the meta-model with the lowest value is select to be the optimum solution as shown by the dashed red vertical lines in Fig. 5.For the electric field, only 55 basis functions are used to produce a final e rrLOO = 0.0264, while for the magnetic field 84 basis functions were computed to provide a e rrLOO = 0.0452.This means that in total 168 full-wave simulations would be sufficient to produce a Monte-Carlo equivalent result.With the optimum meta-model in hand, the new, LAR-based, multi-index set I * m,p,q is calculated and consequently the basis functions Ψ are constructed.The expansion coefficients can be easily computed by applying Eq. ( 9).
The probabilistic performance of the RF Wien filter is shown in Fig. 6.These are not the probability distributions; the results were fitted with a Gaussian distribution with arbitrary mean values and standard deviations, and the parameters are summarized in Table 2.The magnetic field undergoes much faster and stronger variations than Figure 5: The sparsity of the PCE depends on the least-angle regression algorithm which produces multiple meta-models for the electric and magnetic field homogeneities.The selected meta-model will be used to rebuild the multi-index set and then select the basis functions.the electric field.This is clearly obvious from Fig. 4. As a result, the values of the homogeneity integrals for the magnetic field will me more difficult to detect and to estimate.The number of basis functions to span the variation of the magnetic field was higher.Even in Fig. 6, the electric field fits better to the 1000 simulations than the magnetic field.
According to the results of the PCE simulations (see Table 2), the electric field maintains a high field homogeneity compared to the ideal (no-uncertainty) model.However, the magnetic field seems to be more sensitive to mechanical variations by about a factor of 10 than the electric field.

PC-based sensitivity analysis
To conclude this analysis, a sensitivity analysis is indispensable, which will allow us to identify the most influential parameters on the performance of the device.The results may be used by the mechanical engineers during the assembling of the RF Wien filter.
The basic idea is to decompose the variance of the output (Y E and Y H ) as a function of the contribution of each variable and possibly their combination.This is called the ANalysis Of VAriance, or ANOVA.The independence of the random input variables and the orthonormality of the PCE, permits the direct computation of one known sensitivity scheme, called the Sobol sensitivity via the Sobol decomposition at zero-cost [22].Zero-cost means that no additional computation is required.The PC coefficients can be used directly.
If Y is the total output, then Y ξi denotes the output produced by the random variable ξ i .Rewriting Eq. ( 5) as a function of terms of the variable ξ i gives Here I ξi is the multi-index set of the variable ξ i , i.e., the i th term in the multi-index row is non-zero.Therefore, to characterize the output related to the ξ i or any of its combinations, all that is required is the PC coefficients.If D denotes the variance of the estimated output Ŷ, the partial variances corresponding to the random input variables are denoted as Dξ1,...,ξ10 .In this case, the total and partial variances are calculated, respectively, as ŶE , Y E calculated using the sparse generalized PCE method with an expansion order 12 fitted to a Gaussian 10 4 samples of the PC basis have been used for the construction of the distribution.The result of fitting the low-order MC distribution Y H with a Gaussian distribution is also shown.
Figure 6: Comparison of the statistical distribution of the estimated homogeneities of the electric and magnetic field computed using the sparce PCE and the low-order MC method.The quantitative results are summarized in Table 2.
Finally, the Sobol indices corresponding to the parameters ξ i are calculated according to Ŝξi = Only the first order Sobol indices are shown; they constitute 97 % of the total contribution over the higher order indices, as can be seen in Fig. 7.The results of evaluating Eq. ( 12) for the electric and magnetic fields are shown, respectively, by the blue and yellow bars in Fig. 7. On the x-axis, the uncertain parameters, i.e., ξ 1 , . . ., ξ 10 are shown.Within the ±0.1 mm manufacturing uncertainty and according to the PCE simulations, the most influential variables on the electric field homogeneity are ξ 1 , ξ 2 , ξ 5 , ξ 7 , and ξ 8 .The tolerances in the electrodes lengths, ξ 1 and ξ 2 , are responsible for 5 to 10% deviation of the field homogeneity from the mean value.Because Ŝξ1 and Ŝξ2 have different levels, this implies that the electrode displacement contributes to the performance.The widths of the plates does not have a noticeable influence on the homogeneity of the electric field.The rotation of the upper electrode with respect to the xy-plane has the highest sensitivity value (62%).ξ 6 also represents the rotation of the second electrode with respect to the xy-plane but with minimum effect.Electrode misalignments and the rotation of the ferrite structure in the xz-plane contribute by up to 20%.
The ferrites, due to their high magnetic permeability µ value, flatten the magnetic field lines inside the RF Wien  filter.At the corresponding frequencies, the ferrites have a larger impact on the magnetic field than on the electric field.The Sobol index is expected to be high for the values related to the ferrites.The sensitivity analysis for the magnetic field shows that ξ 9 is the most important one, reaching a value of 85%.The parameter ξ 9 represents the rotational misalignment of the ferrite structure in the xy-plane.If the angular alignment of the ferrite structure could be improved by about a factor of 3 from 1 mrad to 0.3 mrad, a substantial improvement of the stan-dard deviation of H ⊥ is to be expected.The rotation of the electrodes in the xy-plane, as well as in the xz-plane affect slightly the standard deviation of H ⊥ by about 10%.H x is the main source of parasitic magnetic field, though it is very small compared to the main field, it does not cancel out when integrating along the longitudinal axis, but rather accumulates.
Similar variables, e.g., ξ 5 and ξ 6 , that represent the same physical quantity, should not necessarily possess the same Sobol sensitivities (see Fig. 7).The electromagnetic effect of a rotation of the upper or the lower electrode is exactly the same because a parallel-plate waveguide is symmetrically invariant with respect to the xy-plane.When modeling the uncertainties, e.g., ξ 5 and ξ 6 are allowed to vary independently within their error margins [and the same is true for the other pairs (ξ 1 , ξ 2 ), (ξ 3 , ξ 4 ), and (ξ 7 , ξ 8 )].In this way, a misalignment (breaking of parallelism) of the electrodes in the xy-plane can be modeled using only two variables.The stochastic independence of ξ 5 and ξ 6 makes sure that the electromagnetic response from the two electrodes is different, unless the electrodes are identical.However, if ξ 5 and ξ 6 take the same values, this means that the parallelism is conserved and the variables must have the same Sobol sensitivities. Figure 7 emphasizes that parallelism is the major factor in preserving the electric field.

Conclusion and outlook
This paper presents an application on sparse and nonintrusive Polynomial Chaos Expansion (PCE) as a lowcost calculation method of the electromagnetic field quality of the novel RF Wien filter.The fabrication and assembly limitations of the electrodes and the ferrite structure have been modeled and were evaluated as a function of the homogeneities of the electric and magnetic field.Because of the high-dimensionality of the problem, a sparse version of PCE has been used based on the least-angle regression method.The results were compared to low-order MC simulations, and a very good agreement between the two techniques was found.The influence of the individual parameters on the performance has been quantified based on the Sobol-sensitivity analysis.
It has been found that the parallelism of the electrodes in the xy-plane is the most crucial parameter that influences the performance of the electric field.The alignment of the ferrite structure in the xy-plane was the dominant factor for the magnetic field.We do not have measurement nor simulation results in order to decide in favor of a better field homogeneity of the electric or the magnetic field.After the first EDM experiments with the RF Wien filter in 2017, we will see whether the present design criteria should be altered.For example, flat electrodes provide a more homogeneous magnetic field compared to the electric field by about a factor of 11.
The PCE theory can be applied to many problems in high-precision experiments, for which an accurate specification of uncertainties is required.Examples include, but are not limited to the performance analysis of the design of highly-accurate BPMs, and the influence of position errors of magnetic and electric dipoles and quadrupoles on the spin-precession in storage rings.

Appendix B. Example
To further facilitate the understanding of the basic theory, in this section a simple example is provided.
Consider the function y, defined as This function may represent the unknown dynamical behavior of an unknown system.Now, the dependent variable x is not deterministic, but varies stochastically according to some distribution, say a Gaussian one.The output will then also be a stochastic variable.To build the statistics of the output, classically a Monte-Carlo simulation is conducted.Because the analytic form of the dynamics of the system is given, the performance of the PCE can be evaluated against the input analytic solution.
The blue line in the performance of the PCE with respect to the expansion order with a constant sampling of 10 points.A 2 nd order expansion was clearly not sufficient to reconstruct the model response, while with the 4 th order expansion, the PCE could reproduce the model within the range of the sample points, but not outside this range.On the other hand, increasing the expansion order to the 5 th allowed the PCE to replicate the exact model even outside the sample range but not at the edges of the function.The metamodel does have enough polynomials to predict the full response.Finally, the 8 th order PCE is capable to fully reconstruct the response.
On a probabilistic basis, the statistical distributions of the output is the main criterion to consider.With a sample of 36 random points and an expansion fraction of 8, the probability density function and the cumulative density functions samples are shown in Fig. B.9 [labels (a) and (b)], respectively.A very good congruence can be noticed proving that the PCE theory can be used to accurately surrogate models with a good accuracy.

Appendix C. PCE truncation
Practically, PCE cannot extend to infinity and normally, the expansions are truncated to a degree p (PC expansion order).In terms of the multi-index set I, it is expressed in terms of dimensionality of the problem m and the expansion order p as I m,p , defined as follows, where • 1 is the 1-norm, which is simply the distance.Now, to eliminate the higher order interactions, a new form of distance is defined and applied on the multi-index set I m,p , called the q-norm • q , which modifies the • 1 by The new hyperbolic multi-index set is denoted by I q m,p and becomes A graphical representation of the hyperbolic truncation scheme set can be found in Fig. C.10 with a q-norm varying from 0.8 to 0.4.The higher order interactions are taken out gradually.The polynomial terms selected for the first random variable are located on the horizontal axis, while on the vertical axis the corresponding terms of the second variables are shown.If blue dots on the outer layer are connected, the shape resembles a hyperbola, hence the name hyperbolic truncation.ing steps: 1. Set the coefficient to zero and set the residual R = Y − Ŷ.
2. Find the vector (basis polynomial) Ψ ij that is most correlated with the residual R.
3. Move the corresponding coefficient a ij from 0 to Ψ T ij R until another polynomial Ψ i k has stronger correlation with the residual.4. Move a ij and a i k in the direction defined by their joint least square coefficient on the current residual of (Ψ ij , Ψ i k ) until some other basis has more correlation with the current residual.

Figure 1 :
Figure 1: CAD design model of the RF Wien filter, showing the parallel-plates waveguide and the support structure (Figure taken from [1]).The coordinate system used for the design calculations is indicated.The stored beam moves along the z-axis of the RF Wien filter.1: beam position monitor (BPM); 2: copper electrodes; 3: vacuum vessel; 4: clamps to hold the ferrite structure; 5: belt drive for 90 • rotation; 6: ferrite structure; 7: CF160 rotatable flange; 8: support structure of the electrodes; 9: inner support tube.

Figure 2 :
Figure 2: Stochastic variation of the parameters of the waveguide RF Wien filter in the xz-plane.The solid grey lines represent the electrodes and the solid blue lines the ferrites.The shaded counterparts indicate the possible rotational displacements and misalignments.x 1 and x 2 model the random lengths while x 7 and x 8 model the random angular rotations of the electrodes in the xz-plane.x 10 models the possible rotation of the ferrites.

Figure 3 :
Figure 3: Stochastic variation of the parameters of the waveguide RF Wien filter in the xy-plane.The solid grey lines represent the electrodes and the solid blue lines the ferrite structure.The shaded counterparts indicate the possible rotational displacements and misalignments.x 3 and x 4 model the random widths of the electrodes while x 5 and x 6 model the random angles rotations of the electrodes in the xz-plane.x 9 models the possible rotation of the ferrites.
(a) 1000 full-wave simulations showing the magnitude of the unwanted electric field | E ⊥ | along the beam axis.(b) 1000 full-wave simulations showing the magnitude of the unwanted magnetic field | H ⊥ | along the beam axis.

Figure 4 :
Figure 4: Low-order Monte-Carlo simulations showing the evaluation of | E ⊥ | and | H ⊥ | along the beam axis for a 10 kW input power.In the worst case, | E ⊥ | does not exceed 150 V/m, while | H ⊥ | does not exceed 1 A/m.The solid black line represents the ideal case, i.e., with perfect alignment of all elements of the RF Wien filter and zero tolerances.
(a) Estimated coefficients (vertical cuts) for each meta-model of the electric field homogeneity Y E , created by the least-angle regression algorithm.On the horizontal axis, the iteration number is shown.The optimum coefficients set is shown by the vertical cut of the red-dashed vertical line with respect to the leave-one-out cross validation.(b) Estimated coefficients (vertical cuts) for each meta-model of the magnetic field homogeneity Y H , created by the least-angle regression algorithm.On the x-axis, the iteration number is shown.The optimum coefficients set is shown by the vertical cut of the red-dashed vertical line with respect to the leave-oneout cross validation.

Figure 7 :
Figure 7: Sobol sensitivity of the electric and magnetic field homogeneity to the design parameters of the waveguide RF Wien filter.

(a) 10
samples with PCE of order 2. (b) 10 samples with PCE of order 4. (c) 10 samples with PCE of order 5.(d) 10 samples with PCE of order 8.

Figure B. 8 :
Figure B.8: The sine function is sampled with 10 points.Increasing the PCE order, increases the fit quality.
Fig. B.8 shows the analytical solution.10 random sample points are created and the corresponding output is drawn (the red crosses in Fig. B.8).With the input and output data being present, the PCE metamodel can be constructed.As the input is a Gaussian distributed random variable, the Hermite polynomials are used to surrogate the analytical model.Figure B.8 shows (a) The estimated probability density function (PDF) fy of both Monte-Carlo simulation and PCE.(b) The estimated cumulative probability density function (CDF) Fy of both Monte-Carlo simulation and PCE.

4 Figure C. 10 :
Figure C.10: Hyperbolic basis truncation with different q-norms.As the q-norm decreases, The basis cardinality decreases.The red dots represent the full basis elements and the blue crosses indicates the selected (remaining) basis elements.

Figure D. 11 :
Figure D.11: Applying the least-angle regression LAR to the hyperbolically truncated basis set.The order of the model is further decreased with the LAR algorithm.The red dots represent the full basis elements and the blue crosses indicate the selected (remaining) basis elements.

5 .
Continue until the P basis (also known as predictors) have been entered.When applying the LAR algorithm on the magnetic field homogeneity, the selected basis functions Y H are shown in Fig. D.11.It is clear that very few polynomials have been considered in the field calculations which require much smaller number of full-wave simulations.

Table 1 :
Statistical distributions of the random variables representing the stochastic mechanical variations of the waveguide RF Wien filter.G (µ, σ) indicates a Gaussian distribution with a mean value of µ and a standard deviation of σ, in units of mm or mrad.

Table 2 :
Mean and standard deviations of the PCE and MC-based system response for f int