Coder Social home page Coder Social logo

pymultipact's Introduction

PyMultipact

Multipacting is a phenomenon arising from the emission and subsequent multiplication of charged particles in accelerating radiofrequency (RF) cavities, which can limit the achievable RF power. Predicting field levels at which multipacting occurs is crucial for optimising cavity geometries. This paper presents an open-source Python code (PyMultipact) for analysing multipacting in 2D axisymmetric cavity structures. The code leverages the NGSolve framework to solve the Maxwell eigenvalue problem (MEVP) for the electromagnetic (EM) fields in axisymmetric RF structures. The relativistic Lorentz force equation governing the motion of charged particles is then integrated using the calculated fields within the domain to describe the motion of charged particles. Benchmarking against existing multipacting analysis tools is performed to validate the code's accuracy.

Workflow

ALT TEXT

The workflow begins by defining the domain using geometry_writer.py. Next, the Maxwell eigenvalue problem (MEVP) is solved with the NGSolve finite element method (FEM) framework via domain.compute_field. Collision detection and handling are performed in Python. The multipacting metrics currently defined are the counter and enhanced counter functions. To analyse the domain for multipacting, domain.analyse_multipacting is used.

Example - TESLA Cavity Geometry (Jupyter)

To get started, import the Project and Domain classes from domain. A Project object is used to define the project folder and required to initialise a Domain object. A Domain object contains every object that can be found in the domain. For example, a Particles object can be added to the Domain object. Certain physics can also be defined in a Domain object. For example, the eigenmodes of the domain can be computed by calling the <domain_object>.compute_field(). A Domain object also contains the necessary methods for making plots and post-processing.

from pymultipact.domain import Project, Domain

# create project
proj = Project()
proj.create_project('<project_folder>/TESLA')

# define domain
domain = Domain(proj)

The defined domain contains, by default, the TESLA cavity geometry (mid-cell) [1]. One possible parameterisation of the mid-cell of an elliptical cavity geometry is given in the figure below.

ALT TEXT

The default elliptical cavity geometry installed with PyMultipact is the TESLA cavity mid-cell geometry. The following line of code can be used to define a new elliptical geometry boundary,

import numpy as np
# format: cell = [A, B, a, b, Ri, L, Req] in meters.
mid_cell = np.array([42, 42, 12, 19, 35, 57.7, 103.3])*1e-3
domain.define_elliptical_cavity(mid_cell=mid_cell)

The geometry can be visualised using

domain.draw()

A Domain object is meshed automatically with a default size if no specification for the mesh is given after definition. The mesh can be regenerated for a specific mesh resolution and visualised using

domain.mesh_domain(<maxh>)
domain.draw_mesh()

Next, compute and visualise the fields using

domain.compute_fields()
domain.draw_fields(mode=1, which='E')

where the which keyword is used to specify if the electric (E) or magnetic (H) field should be plotted. The mode keyword specifies for which mode the field should be plotted. Mode indexing starts from 1. Multipacting analysis is then carried out using

domain.analyse_multipacting()

The currently implemented multipacting metrics are the counter and enhanced counter functions. Results from multipacting can be plotted with the following lines of code.

domain.plot_cf()  # to plot counter function
domain.plot_Ef()  # to plot final impact energy
domain.plot_ef()  # to plot enhanced counter function

The results can be compared with the result obtained in [2].

References

[1] Aune, Bernard, et al. "Superconducting TESLA cavities." Physical Review special topics-accelerators and beams 3.9 (2000): 092001.

[2] Zhu, Feng, et al. "High field multipacting of 1.3 GHZ Tesla cavity." This Workshop, TuP51. 2003.

pymultipact's People

Contributors

dark-elektron avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.