## 4 30 cm Model Cavity Simulation
### Cavity Tuning  
Due to inherent discrepancies such as displacement, rotation errors during the assembly process of the cavity, and external environmental disturbances during the operation of the cavity, the frequency may deviate from the designed frequency.  
For resonant cavities, a widely employed tuning method is to squeeze the cavity to cause its deformation, hence changing the operating frequency. This method is also known as the perturbation method. The mathematical expression for this method is defined as  
\[\frac{\omega-\omega_{0}}{\omega_{0}}\approx\frac{\Delta W_{m}-\Delta W_{e}}{W}, \tag{13}\]  
Figure 21: The simulation result of the frequency and deformation distribution of the niobium cavity after evacuation process.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**Post-Processing**} & **Frequency** & **Frequency** & **Frequency Change** \\  & **(CST)/MHz** & **(COMSOL)/MHz** & **(Average)/kHz** \\ \hline Initial state & 162.580 & 162.580 & – \\ BCP of 150 \(\upmu\)m & 163.936 & 164.030 & +1403 \\ BCP of 30 \(\upmu\)m & 164.204 & 164.210 & +224 \\ Cool down to 4 K & - & 164.780 & +570 \\ Vacuum out & - & 164.350 & \(-\)430 \\ \hline \hline \end{tabular}
\end{table}
Table 5: The simulation results of frequency change after post-treatment processes.  
where \(\omega_{0}\) signifies the initial frequency, \(\omega\) represents the frequency after perturbation, and \(W\) is the energy stored within the cavity. To maximize the tuning effect, it is crucial to select locations for deformation where the magnetic energy \(W_{m}\) and electric energy \(W_{e}\) exhibit significant discrepancies.  
Since the traditional tuning method of adding tuning blocks has the risk of contaminating the cavity, which is not conducive to the cleaning of the SC cavity, we use the approach of squeezing two end plates to change the distance between the interior of the end plates and the end of the vane tips to tune the cavity [24]. However, it is crucial to note that this distance is determined by the beam dynamics design. Modifying it requires adjustments to the dynamics design. To preserve the change in the beam dynamics design while achieving the purpose of tuning, a small disk with a radius of 60 mm is reserved centered on the beam axis. Only the distance between the outer end plates and the end of vane tips is modified, creating a groove in the center of the end plate [43], as shown in Figure 22. This innovative tuning method allows for effective cavity tuning without compromising the previously determined beam dynamics design.  
Subsequently, we employed CST MWS to simulate the impact of the end plates' moving distance on the cavity frequency. In the outer end-plate region, where magnetic energy surpasses electric energy, increasing the aforementioned distance increases inductance. This, in turn, leads to a decrease in the cavity frequency as indicated by Equation (1), and there is a linear relationship between moving distance and cavity frequency [44]. The result is displayed in Figure 23, illustrating a linear correlation between cavity frequency and the movement at each end, with a frequency change of approximately 331 kHz/mm. This degree of tuning is sufficient for correcting frequency deviations caused by machining errors. Additionally, Figure 24 shows the influence of various squeezing amounts on the off-axis electric field distribution within the cavity. Notably, the electric field distribution remains consistently flat under different squeezing amounts, with deviations not exceeding 2%, which further proves the robustness and reliability of our innovative tuning method.  
Figure 22: Schematic diagram of squeezing cavity end plates for tuning.