Section Navigation

Perave

1-D FEL code



Perave is a matlab based code package which solves the 1-D FEL equations for a helical undulator system. The motivation for writing this code was to have a fast, simple tool which allowed us to study high efficiency FELs and the physics of undulator tapering.

- Download source code -

Please access the source code at the Perave GitHub repository.


- How to run the code -

First you will need to place each function and script in the same folder. Next, the script you need to run to start the code from the Matlab Command line is "perave_MainCode_7h.m". You will first need to have specified the input parameters in a separate Matlab script called "Perave_User_Input_7h.m". The input parameters which you can specify are commented in the sample user input file which is provided.


- Breakdown of the code work-flow -

Opening perave_MainCode_7h.m shows a basic breakdown of the code which is the following:


- Example output -

The plots below show typical results for a soft X-ray FEL run (1 nm). The (helical) undulator period is 3 cm, the RMS undulator parameter is 2.475. The e-beam energy is 5.3 GeV, the relative energy spread is 5.7*10-4 and the peak current is 4 kA. The radiation field starts from zero and the amplification is from noise. The power grows exponentially until the saturation power (Psat ~ρPbeam) is reached after roughly 20 gain lengths. The gain length from simulation is 51.75 cm, in good agreement with theoretical value of 51.51 cm. The average electron energy loss and energy spread at saturation are approximated given by the Pierce parameter ρ.

Time dependent output for 20 runs (black) and average (red) is shown in pictures below: