Class Particle

java.lang.Object
xal.tools.beam.ens.Particle
All Implemented Interfaces:
Serializable

public class Particle extends Object implements Serializable
Represents a particle in six-dimensional phase space.
Author:
CKAllen
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    Coefficient for electrical properties
    static final double
    Coefficient for magnetic properties
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance of Particle
    Particle(double q, double m, PhaseVector z)
    Creates a new instance of Particle
    Creates a new instance, a deep copy, of this object
  • Method Summary

    Modifier and Type
    Method
    Description
    Perform a deep copy of this particle object
    Computes the Coulomb electric field of the particle at the given field point.
    electricField(R3 ptFld, double radius)
    Computes electric field assuming the particle is an uniform sphere of charge with radius R.
    double
    Computes the Coulomb potential of the particle at the given field point.
    double
    electricPotential(R3 ptFld, double radius)
    Computes electric potential assuming the particle was an uniform sphere of charge with radius R.
    double
    Get charge of particle
    double
    Get mass of particle
    Get the velocity vector of the particle
    Get the entire (homogeneous) phase space coordinates of particle
    Get the position vector of the particle
    Computes magnetic field assuming the particle is an uniform sphere of charge with radius R.
    magneticField(R3 ptFld, double radius)
    Computes magnetic field assuming the particle is an uniform sphere of charge with radius R.
    void
    Print out the properties of this particle.
    void
    setCharge(double q)
    Set charge of particle
    void
    setMass(double m)
    Set mass of particle
    void
    Set (homogeneous) phase space coordinates of particle

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • FAC_ELEC

      public static final double FAC_ELEC
      Coefficient for electrical properties
      See Also:
    • FAC_MAG

      public static final double FAC_MAG
      Coefficient for magnetic properties
      See Also:
  • Constructor Details

    • Particle

      public Particle()
      Creates a new instance of Particle
    • Particle

      public Particle(double q, double m, PhaseVector z)
      Creates a new instance of Particle
      Parameters:
      q - particle charge
      m - particle mass
      z - phase space coordinates (homogeneous coordinates)
    • Particle

      public Particle(Particle p)
      Creates a new instance, a deep copy, of this object
      Parameters:
      p - particle object to be deep copied
  • Method Details

    • copy

      public Particle copy()
      Perform a deep copy of this particle object
    • setMass

      public void setMass(double m)
      Set mass of particle
    • setCharge

      public void setCharge(double q)
      Set charge of particle
    • setPhase

      public void setPhase(PhaseVector z)
      Set (homogeneous) phase space coordinates of particle
    • getCharge

      public double getCharge()
      Get charge of particle
    • getMass

      public double getMass()
      Get mass of particle
    • getPosition

      public R3 getPosition()
      Get the position vector of the particle
    • getMomentum

      public R3 getMomentum()
      Get the velocity vector of the particle
    • getPhase

      public PhaseVector getPhase()
      Get the entire (homogeneous) phase space coordinates of particle
    • electricPotential

      public double electricPotential(R3 ptFld)
      Computes the Coulomb potential of the particle at the given field point. Note that very large potential exist sufficiently close to the particle. To avoid numerical singularities the particle is assumed to have a finite radius equal to the "classical proton radius", which is ~1e-18. Thus, the potential of a uniform sphere is substituted for field points closer than this radius.
      Parameters:
      ptFld - field point to evaluate the potential
      Returns:
      the coulomb potential in volts
    • electricPotential

      public double electricPotential(R3 ptFld, double radius)
      Computes electric potential assuming the particle was an uniform sphere of charge with radius R. Giving the particle a finite size removes the singularity in the potential at the particle position. This function is also useful in averaging the potential over grids. By giving the radius the same order as the grid dimensions, the particle appears to smear over the grid. That is, the radius is a numerical tuning parameter for averaging.
      Parameters:
      ptFld - field point to evaluate the potential
      radius - radius of finite particle
      Returns:
      electric potential of "smeared" particle at field point in volts
    • electricField

      public R3 electricField(R3 ptFld)
      Computes the Coulomb electric field of the particle at the given field point. Note that very large fields exist sufficiently close to the particle. To avoid numerical singularities the particle is assumed to have a finite radius equal to the "classical proton radius", which is ~1e-18. Thus, the field of a uniform sphere is substituted for field points closer than this radius.
      Parameters:
      ptFld - field point to evaluate the potential
      Returns:
      electric field vector in volts/meter
    • electricField

      public R3 electricField(R3 ptFld, double radius)
      Computes electric field assuming the particle is an uniform sphere of charge with radius R. Giving the particle a finite size removes the singularity in the field at the particle position. This function is also useful in averaging the field over grids. By giving the radius the same order as the grid dimensions, the particle appears to smear over the grid. That is, the radius is a numerical tuning parameter for averaging.
      Parameters:
      ptFld - field point to evaluate the electric field
      radius - radius of finite particle
      Returns:
      electric field vector of "smeared" particle in volts/meter
    • magneticField

      public R3 magneticField(R3 ptFld)
      Computes magnetic field assuming the particle is an uniform sphere of charge with radius R. Note that we compute magnetic field H, and not the magnetic flux vector B. Giving the particle a finite size removes the singularity in the field at the particle position. Note that very large fields exist sufficiently close to the particle. To avoid numerical singularities the particle is assumed to have a finite radius equal to the "classical proton radius", which is ~1e-18. Thus, the field of a uniform sphere is substituted for field points closer than this radius. Note that if the momentum coordinates of the particle's phase space vector are (x',y',z') then the returned field must be multiplied by beta-c, since the mechanical momentum coordinates are assumed in the field calculations.
      Parameters:
      ptFld - field point to evaluate the electric field
      Returns:
      magnetic field vector of "smeared" particle in Amperes/Meter
    • magneticField

      public R3 magneticField(R3 ptFld, double radius)
      Computes magnetic field assuming the particle is an uniform sphere of charge with radius R. Note that we compute magnetic field H, and not the magnetic flux vector B. Giving the particle a finite size removes the singularity in the field at the particle position. Note that if the momentum coordinates of the particle's phase space vector are (x',y',z') then the returned field must be multiplied by beta-c, since the mechanical momentum coordinates are assumed in the field calculations. This function is also useful in averaging the field over grids. By giving the radius the same order as the grid dimensions, the particle appears to smear over the grid. That is, the radius is a numerical tuning parameter for averaging.
      Parameters:
      ptFld - field point to evaluate the electric field
      radius - radius of finite particle
      Returns:
      magnetic field vector of "smeared" particle in Amperes/Meter
    • print

      public void print(PrintWriter os)
      Print out the properties of this particle.
      Parameters:
      os - output stream receiving text description
      Since:
      Apr 15, 2011