# Klystron (klystronT.pre)

Keywords:

klystronT

## Problem description

This VSimMD example simulates a two cavity klystron in three dimensions. First, one cavity is pinged, and the resulting spectrum yields the resonant frequency used for later simulations. The two cavities are then loaded to simulate couplers to the cavities and the signal gain is demonstrated in a power run with an electron beam.

This simulation can be performed with a VSimMD, VSimEM or VSimPD license.

## Opening the Simulation

The Klystron example is accessed from within VSimComposer by the following actions:

• In the resulting Examples window expand the VSim for Microwave Devices option.
• Expand the Radiation Generation (text-based setup) option.
• Select “Klystron (text-based setup)” and press the Choose button.
• In the resulting dialog, create a New Folder if desired, and press the Save button to create a copy of this example.

The basic variables of this problem should now be alterable via the text boxes in the left pane of the Setup Window, as shown in Fig. 392 .

Fig. 392 Setup Window for the Klystron example.

## Input File Features

Fig. 393 Some exposed variables of the Klystron example.

As seen in Fig. 393, a cylindrical tube of length TUBE_LENGTH and radius REND_TUBE is connected by a gap to two cavities. The cavities have length CAVITY_LENGTH and beginning and ending radii RBGN_CAVITY and REND_CAVITY, respectively. The centers of the cavities are a distance CAVITY_CENTER from the ends of the tube, and the gaps connecting the tube and cavities have length GAP_LENGTH. When electrons are included using INCLUDE_PARTICLES = 1, they are emitted from the end of the tube near cavity 1 in a beam with radius BEAM_RADIUS.

The following are three run types accommodated in the klystronT.pre file:

Resonant Frequency Run

The purpose of the resonant frequency run type is to identify the frequency at which to drive the klystron in later simulations. Cavity 1 is pinged and an analysis of the fourier transform of the generated gap voltage yields the resonant frequency.

Attenuation Calibration Run

Both klystron cavities are loaded in order to simulate couplers to the cavities. The user can integrate this run type in order to calibrate the observed attenuation to the desired loss.

Power Run

Finally, an electron beam is emitted inside the klystron from the end of the tube near cavity 1. The previous runs can be iterated to ensure that the output power gain is as desired.

Designate the run type as follows:

Resonant Frequency Run

Set TURN_DRIVE_OFF = 1, DRIVE_CAVITY1 = 1, DRIVE_CAVITY2 = 0, CAVITY1_LOAD = 0.0, CAVITY2_LOAD = 0.0, and INCLUDE_PARTICLES = 0.

Attenuation Calibration Run

Set TURN_DRIVE_OFF = 1, CAVITY1_LOAD and CAVITY2_LOAD to the desired values, and INCLUDE_PARTICLES = 0. To calibrate cavity 1, set DRIVE_CAVITY1 = 1 and DRIVE_CAVITY2 = 0. To calibrate cavity 2, set DRIVE_CAVITY1 = 0 and DRIVE_CAVITY2 = 1.

Power Run

Set TURN_DRIVE_OFF = 0, DRIVE_CAVITY1 = 1, DRIVE_CAVITY2 = 0, CAVITY1_LOAD and CAVITY2_LOAD to the desired values, and INCLUDE_PARTICLES = 1.

## Running the simulation

After setting the desired run type, continue as follows:

• Proceed to the Run Window by pressing the Run button in the left column of buttons.
• To run the file, click on the Run button in the upper left corner of the right pane. You will see the output of the run in the right pane. The run has completed when you see the output, “Engine completed successfully.” This is shown in Fig. 394 below.

Fig. 394 The Run Window at the end of execution.

## Visualizing the results

After running the desired run type, continue as follows:

• Proceed to the Visualize Window by pressing the Visualize button in the left column of buttons.

Resonant Frequency Run

To visualize a run to determine the resonant frequency, select History from the Data View pull-down menu at the top of the CONTROLS pane. Select Cavity1_Voltage in the CONTROLS pane, and click FFT to the left of the Cavity1_Voltage plot in the VISUALIZATION pane. The resulting plot will resemble Fig. 395. Zoom in on the maximum of this plot to determine the resonant frequency.

Fig. 395 Fourier transform of Cavity1_Voltage versus time (in GHz).

Attenuation Calibration Run

For the Attenuation Calibration Run, the quality factors $$Q_1$$ and $$Q_2$$ for cavities 1 and 2 can be calculated using the computeInverseQ - Compute Inverse Q Analysis as follows:

• Press the Analyze button in the left column of buttons.
• Select computeInverseQ.py from the pull down menu in the Control section of the window.
• Enter Cavity1_Voltage or Cavity2_Voltage in the history field to designate the history to analyze.
• Enter the value of the input parameter DRIVE_FREQ in the frequency field to designate the frequency at which the history will be analyzed.
• Click the Analyze button in the top right corner of the window. As shown in Fig. 396, two columns of data with the titles “Time (s)” and “Inverse Q” will be output in the right pane. The analysis has completed when you see the output “Analysis completed successfully.”

Fig. 396 The Analysis window at the end of execution of the computeInverseQ.py script.

Scrolling through or plotting the output data enables the user to calculate the values of $$1/Q_1$$ and $$1/Q_2$$, and thus $$Q_1$$ and $$Q_2$$. The user may iterate this run type to calibrate the quality factors $$Q_1$$ and $$Q_2$$ by varying the values of the input parameters CAVITY1_LOAD and CAVITY2_LOAD. Note that $$Q_1$$ and $$Q_2$$ are inversely proportional to CAVITY1_LOAD and CAVITY2_LOAD, respectively.

Power Run

In the power run, we introduce an electron beam to the simulation as seen in Fig. 397. You can reproduce this image by doing the following:

• Press the Visualize button in the left column of buttons.
• Expand Particle Data
• Expand electrons0
• Select electrons0_ux
• Expand Geometries
• Select poly_surface (klystronPecShapes)
• Select Display Contours
• Select Clip All Plots

You can change the color table to something that better shows the physics, and in this image the color table is set to “hot_desaturated”.

Fig. 397 A power run with an electron beam.

## Further Experiments

Try varying the parameter TUBE_LENGTH in order to maximize the gain.