Efficient blowout regime

This is an example of highly efficient plasma wakefield acceleration in the bubble regime. The run reproduces results shown in Fig.3 of the paper. The results do not exactly coincide with those in the paper because of the reduced resolution.

  • Code launcher: high-R.py.

  • Post-processing (Jupyter notebook): high-R.ipynb and images that it produces:

ne Ez

Code launcher:

import numba as nb
nb.set_num_threads(1)
from lcode.simulation import Simulation
from lcode.diagnostics import FXiDiag, FXiType, OutputType, ParticlesDiag
from lcode.diagnostics import SliceDiag, SliceType, SliceValue

# Set parameters of the solver:
config = {
    'geometry': 'circ',
    'processing-unit-type': 'cpu',

    'window-width': 10,
    'transverse-step': 0.01,
    'window-length': 16.5,
    'xi-step': 0.01,
    'time-limit': 900,
    'time-step': 5,
    
    'plasma-particles-per-cell': 10,
    'ion-model': 'background'
}

# Set up a complex current shape
defaults = {'xishape': 'l', 'length': 0.05, 'radius': 0.2, 
            'angspread': 1e-3, 'energy': 1000}

segments = {
    'xi-0.025000': {'ampl': 0.002085},
    'xi-0.075000': {'ampl': 0.014406},
    'xi-0.125000': {'ampl': 0.038685},
    'xi-0.175000': {'ampl': 0.074323},
    'xi-0.225000': {'ampl': 0.120441},
    'xi-0.275000': {'ampl': 0.175906},
    'xi-0.325000': {'ampl': 0.239351},
    'xi-0.375000': {'ampl': 0.309213},
    'xi-0.425000': {'ampl': 0.383773},
    'xi-0.475000': {'ampl': 0.328689},
    'xi-0.525000': {'ampl': 0.1756},
    'xi-0.575000': {'ampl': 0.17255},
    'xi-0.625000': {'ampl': 0.172468},
    'xi-0.675000': {'ampl': 0.174758},
    'xi-0.725000': {'ampl': 0.173239},
    'xi-0.775000': {'ampl': 0.176465},
    'xi-0.825000': {'ampl': 0.185417},
    'xi-0.875000': {'ampl': 0.176386},
    'xi-0.925000': {'ampl': 0.180896},
    'xi-0.975000': {'ampl': 0.183523},
    'xi-1.025000': {'ampl': 0.191328},
    'xi-1.075000': {'ampl': 0.191719},
    'xi-1.125000': {'ampl': 0.195469},
    'xi-1.175000': {'ampl': 0.192969},
    'xi-1.225000': {'ampl': 0.2},
    'xi-1.275000': {'ampl': 0.202031},
    'xi-1.325000': {'ampl': 0.21},
    'xi-1.375000': {'ampl': 0.214297},
    'xi-1.425000': {'ampl': 0.215938},
    'xi-1.475000': {'ampl': 0.22},
    'xi-1.525000': {'ampl': 0.22},
    'xi-1.575000': {'ampl': 0.22},
    'xi-1.625000': {'ampl': 0.23},
    'xi-1.675000': {'ampl': 0.24},
    'xi-1.725000': {'ampl': 0.23},
    'xi-1.775000': {'ampl': 0.25},
    'xi-1.825000': {'ampl': 0.24},
    'xi-1.875000': {'ampl': 0.25},
    'xi-1.925000': {'ampl': 0.250312},
    'xi-1.975000': {'ampl': 0.258438},
    'xi-2.025000': {'ampl': 0.26375},
    'xi-2.075000': {'ampl': 0.266094},
    'xi-2.125000': {'ampl': 0.271563},
    'xi-2.175000': {'ampl': 0.272422},
    'xi-2.225000': {'ampl': 0.280313},
    'xi-2.275000': {'ampl': 0.290625},
    'xi-2.325000': {'ampl': 0.286016},
    'xi-2.375000': {'ampl': 0.290781},
    'xi-2.425000': {'ampl': 0.298594},
    'xi-2.475000': {'ampl': 0.300078},
    'xi-2.525000': {'ampl': 0.3},
    'xi-2.575000': {'ampl': 0.310234},
    'xi-2.625000': {'ampl': 0.315391},
    'xi-2.675000': {'ampl': 0.319297},
    'xi-2.725000': {'ampl': 0.324922},
    'xi-2.775000': {'ampl': 0.329531},
    'xi-2.825000': {'ampl': 0.33},
    'xi-2.875000': {'ampl': 0.34},
    'xi-2.925000': {'ampl': 0.346016},
    'xi-2.975000': {'ampl': 0.342656},
    'xi-3.025000': {'ampl': 0.353438},
    'xi-3.075000': {'ampl': 0.350781},
    'xi-3.125000': {'ampl': 0.363281},
    'xi-3.175000': {'ampl': 0.37},
    'xi-3.225000': {'ampl': 0.365859},
    'xi-3.275000': {'ampl': 0.380938},
    'xi-3.325000': {'ampl': 0.374219},
    'xi-3.375000': {'ampl': 0.387188},
    'xi-3.425000': {'ampl': 0.385},
    'xi-3.475000': {'ampl': 0.406562},
    'xi-3.525000': {'ampl': 0.394922},
    'xi-3.575000': {'ampl': 0.4},
    'xi-3.625000': {'ampl': 0.409375},
    'xi-3.675000': {'ampl': 0.41375},
    'xi-3.725000': {'ampl': 0.42},
    'xi-3.775000': {'ampl': 0.42},
    'xi-3.825000': {'ampl': 0.43},
    'xi-3.875000': {'ampl': 0.43},
    'xi-3.925000': {'ampl': 0.44},
    'xi-3.975000': {'ampl': 0.44},
    'xi-4.025000': {'ampl': 0.44},
    'xi-4.075000': {'ampl': 0.46},
    'xi-4.125000': {'ampl': 0.4625},
    'xi-4.175000': {'ampl': 0.4625},
    'xi-4.225000': {'ampl': 0.4575},
    'xi-4.275000': {'ampl': 0.480625},
    'xi-4.325000': {'ampl': 0.462187},
    'xi-4.375000': {'ampl': 0.491484},
    'xi-4.425000': {'ampl': 0.475859},
    'xi-4.475000': {'ampl': 0.500859},
    'xi-4.525000': {'ampl': 0.501406},
    'xi-4.575000': {'ampl': 0.489766},
    'xi-4.625000': {'ampl': 0.515625},
    'xi-4.675000': {'ampl': 0.501563},
    'xi-4.725000': {'ampl': 0.513281},
    'xi-4.775000': {'ampl': 0.532031},
    'xi-4.825000': {'ampl': 0.517109},
    'xi-4.875000': {'ampl': 0.536719},
    'xi-4.925000': {'ampl': 0.533281},
    'xi-4.975000': {'ampl': 0.537422},
    'xi-5.025000': {'ampl': 0.538594},
    'xi-5.075000': {'ampl': 0.565703},
    'xi-5.125000': {'ampl': 0.554609},
    'xi-5.175000': {'ampl': 0.551875},
    'xi-5.225000': {'ampl': 0.557187},
    'xi-5.275000': {'ampl': 0.578516},
    'xi-5.325000': {'ampl': 0.574844},
    'xi-5.375000': {'ampl': 0.581328},
    'xi-5.425000': {'ampl': 0.58375},
    'xi-5.475000': {'ampl': 0.591094},
    'xi-5.525000': {'ampl': 0.593203},
    'xi-5.575000': {'ampl': 0.598359},
    'xi-5.625000': {'ampl': 0.6025},
    'xi-5.675000': {'ampl': 0.60875},
    'xi-5.725000': {'ampl': 0.619687},
    'xi-5.775000': {'ampl': 0.614922},
    'xi-5.825000': {'ampl': 0.629375},
    'xi-5.875000': {'ampl': 0.617656},
    'xi-5.925000': {'ampl': 0.639141},
    'xi-5.975000': {'ampl': 0.640781},
    'xi-6.025000': {'ampl': 0.643359},
    'xi-6.075000': {'ampl': 0.6475},
    'xi-6.125000': {'ampl': 0.644375},
    'xi-6.175000': {'ampl': 0.658359},
    'xi-6.225000': {'ampl': 0.664922},
    'xi-6.275000': {'ampl': 0.670547},
    'xi-6.325000': {'ampl': 0.681328},
    'xi-6.375000': {'ampl': 0.672813},
    'xi-6.425000': {'ampl': 0.676875},
    'xi-6.475000': {'ampl': 0.692344},
    'xi-6.525000': {'ampl': 0.693281},
    'xi-6.575000': {'ampl': 0.691562},
    'xi-6.625000': {'ampl': 0.705078},
    'xi-6.675000': {'ampl': 0.706875},
    'xi-6.725000': {'ampl': 0.72375},
    'xi-6.775000': {'ampl': 0.707422},
    'xi-6.825000': {'ampl': 0.72375},
    'xi-6.875000': {'ampl': 0.727656},
    'xi-6.925000': {'ampl': 0.726875},
    'xi-6.975000': {'ampl': 0.74125},
    'xi-7.025000': {'ampl': 0.744219},
    'xi-7.075000': {'ampl': 0.744062},
    'xi-7.125000': {'ampl': 0.75},
    'xi-7.175000': {'ampl': 0.757422},
    'xi-7.225000': {'ampl': 0.760625},
    'xi-7.275000': {'ampl': 0.7675},
    'xi-7.325000': {'ampl': 0.775234},
    'xi-7.375000': {'ampl': 0.766406},
    'xi-7.425000': {'ampl': 0.786719},
    'xi-7.475000': {'ampl': 0.641797},
    'xi-7.525000': {'ampl': 0.0},
    'xi-7.575000': {'ampl': 0.02},
    'xi-7.625000': {'ampl': 0.0},
    'xi-7.675000': {'ampl': 0.01},
    'xi-7.725000': {'ampl': 0.0},
    'xi-7.775000': {'ampl': 0.01},
    'xi-7.825000': {'ampl': 0.02},
    'xi-7.875000': {'ampl': 0.0},
    'xi-7.925000': {'ampl': 0.02},
    'xi-7.975000': {'ampl': 0.0},
    'gap': {'ampl': 0.0, 'length': 5.4},
    'xi-13.425001': {'ampl': 0.0},
    'xi-13.475001': {'ampl': 0.05},
    'xi-13.525001': {'ampl': 0.849707},
    'xi-13.575001': {'ampl': 0.793555},
    'xi-13.625001': {'ampl': 0.808691},
    'xi-13.675001': {'ampl': 0.766699},
    'xi-13.725001': {'ampl': 0.821777},
    'xi-13.775001': {'ampl': 0.741211},
    'xi-13.825001': {'ampl': 0.761035},
    'xi-13.875001': {'ampl': 0.719727},
    'xi-13.925001': {'ampl': 0.758496},
    'xi-13.975001': {'ampl': 0.725},
    'xi-14.025001': {'ampl': 0.699707},
    'xi-14.075001': {'ampl': 0.685645},
    'xi-14.125001': {'ampl': 0.706055},
    'xi-14.175001': {'ampl': 0.669727},
    'xi-14.225001': {'ampl': 0.655469},
    'xi-14.275001': {'ampl': 0.637012},
    'xi-14.325001': {'ampl': 0.627441},
    'xi-14.375001': {'ampl': 0.650586},
    'xi-14.425001': {'ampl': 0.624707},
    'xi-14.475001': {'ampl': 0.604297},
    'xi-14.525001': {'ampl': 0.548047},
    'xi-14.575001': {'ampl': 0.581543},
    'xi-14.625001': {'ampl': 0.576563},
    'xi-14.675001': {'ampl': 0.536816},
    'xi-14.725001': {'ampl': 0.558203},
    'xi-14.775001': {'ampl': 0.517969},
    'xi-14.825001': {'ampl': 0.504102},
    'xi-14.875001': {'ampl': 0.488281},
    'xi-14.925001': {'ampl': 0.514648},
    'xi-14.975001': {'ampl': 0.467578},
    'xi-15.025001': {'ampl': 0.456055},
    'xi-15.075001': {'ampl': 0.478125},
    'xi-15.125001': {'ampl': 0.434473},
    'xi-15.175001': {'ampl': 0.421875},
    'xi-15.225001': {'ampl': 0.417383},
    'xi-15.275001': {'ampl': 0.442676},
    'xi-15.325001': {'ampl': 0.401562},
    'xi-15.375001': {'ampl': 0.39375},
    'xi-15.425001': {'ampl': 0.41875},
    'xi-15.475001': {'ampl': 0.3875},
    'xi-15.525001': {'ampl': 0.3875},
    'xi-15.575001': {'ampl': 0.390625},
    'xi-15.625001': {'ampl': 0.374219},
    'xi-15.675001': {'ampl': 0.389844},
    'xi-15.725001': {'ampl': 0.373047},
    'xi-15.775001': {'ampl': 0.374414},
    'xi-15.825001': {'ampl': 0.353809},
    'xi-15.875001': {'ampl': 0.36875},
    'xi-15.925001': {'ampl': 0.321875},
    'xi-15.975001': {'ampl': 0.321973},
    'xi-16.025001': {'ampl': 0.316211},
    'xi-16.075001': {'ampl': 0.266504},
    'xi-16.125001': {'ampl': 0.222461},
    'xi-16.175001': {'ampl': 0.195898},
    'xi-16.225001': {'ampl': 0.141699},
    'xi-16.275001': {'ampl': 0.269121},
    'xi-16.325001': {'ampl': 0.0}
}

beams = {'current': -5, 
         'particles_in_layer': 800,
         'default': defaults, 
         **segments} 

# Set diagnostics
diag = [FXiDiag(
            output_period=100, 
            output_type=OutputType.NUMBERS,
            f_xi=FXiType.Ez),
        SliceDiag(
            SliceType.XI_X,
            output_period=100, 
            output_type=OutputType.NUMBERS,
            slice_value = SliceValue.rho_beam | SliceValue.ne),
        ParticlesDiag(
            save_beam=True,
            output_period=100)
       ]

sim = Simulation(config=config, diagnostics=diag,
                 beam_parameters=beams)

sim.step()