コード例 #1
0
ファイル: picmi.py プロジェクト: jianghongping/WARP
    def init(self, kw):

        # --- When using the PICMI standard, always make the particles
        # --- have variable weights. This will greatly simplify the
        # --- handling of particle initialization. The species weight
        # --- will be set to 1, and the variable weight will hold
        # --- the actual weight.

        wtype = species_type_dict.get(self.particle_type, None)
        self.wspecies = warp.Species(type = wtype,
                                     name = self.name,
                                     charge = self.charge,
                                     charge_state = self.charge_state,
                                     mass = self.mass,
                                     lvariableweights = True,
                                     weight = 1.)
コード例 #2
0
ファイル: FODO3d.py プロジェクト: jianghongping/WARP
# --- Setup the description text which will be included at the bottom
# --- of every plot frame. This is for user convenience, documenting
# --- what the simulation is on the graphical output.
wp.top.pline2 = "Example 3D beam in a FODO lattice"
wp.top.pline1 = "Semi-Gaussian cigar beam. 32x32x128"
wp.top.runmaker = "David P. Grote"

# --- Invoke plotting setup routine - it is needed to create a cgm output file for plots.
# --- The plot file will have a name with the format FODO3D.###.cgm. The prefix is the
# --- same as the input file name, and the ### is a number, increasing each time the
# --- simulation is carried out.
wp.setup()

# --- Create the beam species. This instance of the Species class
# --- is used to configure aspects related to the beam and particles.
beam = wp.Species(type=wp.Potassium, charge_state=+1, name="Beam species")

# --- Set input parameters describing the beam, with a tune depression of 72 to 20 degrees.
# --- These numbers were generated by hand, by using the env package and adjusting the
# --- parameters to get the desired results.
# --- Note the units multipliers, e.g. mm. Almost all variables are MKS units
# --- (except ekin). The multipliers provide a nice way of converting to MKS
# --- while providing documentation about the units that are being used.
beam.a0 = 8.760439903086566 * wp.mm
beam.b0 = 15.599886448447793 * wp.mm
beam.emit = 6.247186343204832e-05
beam.ap0 = 0.
beam.bp0 = 0.
beam.ibeam = 2. * wp.mA
beam.vbeam = 0.
beam.ekin = 80. * wp.kV
コード例 #3
0
ファイル: WarpInterface.py プロジェクト: Alpine-DAV/WarpX
def warp_species(warp_type, picmi_species, level=0):
    """Returns a Warp species that has a reference to the WarpX particles.
    """
    pgroups = PGroup.PGroups(ispecie=picmi_species.species_number, level=level)
    return warp.Species(type=warp_type, pgroups=pgroups)
コード例 #4
0
ファイル: Pierce_diode.py プロジェクト: jianghongping/WARP
diode_voltage = 93. * wp.kV

# --- Setup source plate
source_radius = 5.5 * wp.cm
source_temperature = 0.1  # in eV
source_curvature_radius = 30. * wp.cm  # --- radius of curvature of emitting surface
pierce_angle = 67.

# --- Setup diode aperture plate
zplate = 8. * wp.cm  # --- plate location
rplate = 5.5 * wp.cm  # --- aperture radius
plate_width = 2.5 * wp.cm  # --- thickness of aperture plate

# --- Setup simulation species
beam = wp.Species(type=wp.Potassium, charge_state=+1, name='beam')

# --- Child-Langmuir current between parallel plates
j = 4. / 9. * wp.eps0 * wp.sqrt(2. * wp.echarge * beam.charge_state /
                                beam.mass) * diode_voltage**1.5 / zplate**2
diode_current = wp.pi * source_radius**2 * j

print("Child-Langmuir current density = ", j)
print("Child-Langmuir current = ", diode_current)

# --- Set basic beam parameters
beam.a0 = source_radius
beam.b0 = source_radius
beam.ap0 = .0e0
beam.bp0 = .0e0
beam.ibeam = diode_current
コード例 #5
0
####################################
# Create Beam and Set its Parameters
####################################
# parameters for electron beam:
#   total energy: 3.2676813658 MeV
#   beta_e: 0.990813945176

wp.top.lrelativ = True
wp.top.relativity = True

ptcl_per_step = 400  # number of particles to inject on each step
wp.top.npinject = ptcl_per_step

beam = wp.Species(type=wp.Electron,
                  name='Electron',
                  lvariableweights=variable_weight)
if space_charge:
    beam.ibeam = beam_current
else:
    beam.ibeam = 0.0

wp.w3d.l_inj_exact = True  # if true, position and angle of injected particle are
#  computed analytically rather than interpolated
"""
A custom injector routine is used here to allow for a very relativistic beam to be injected directly into the simulation
because Warp's built in routine is not based on relativistic kinematics. Setting user_injection = False should work
well for lower energy beams.
"""

if user_injection:
コード例 #6
0
ファイル: WarpInterface.py プロジェクト: kngott/WarpX
def warp_species(warp_type, picmie_species):
    """Returns a Warp species that has a reference to the WarpX particles.
    """
    elec_pgroups = PGroup.PGroups(ispecie=picmie_species.species_number)
    return warp.Species(type=warp_type, pgroups=elec_pgroups)
コード例 #7
0
ファイル: magnetized_cooler.py プロジェクト: ucla-pbpl/rswarp
####################################
# Create Beam and Set its Parameters
####################################
# parameters for electron beam:
#   total energy: 3.2676813658 MeV
#   beta_e: 0.990813945176

wp.top.lrelativ = True
wp.top.relativity = True

ptcl_per_step = 400  # number of particles to inject on each step
wp.top.npinject = ptcl_per_step

beam = wp.Species(type=wp.Electron,
                  name='Electron',
                  lvariableweights=variable_weight)
if space_charge:
    beam.ibeam = beam_current
else:
    beam.ibeam = 0.0

wp.w3d.l_inj_exact = True  # if true, position and angle of injected particle are
#  computed analytically rather than interpolated
"""
A custom injector routine is used here to allow for a very relativistic beam to be injected directly into the simulation
because Warp's built in routine is not based on relativistic kinematics. Setting user_injection = False should work
well for lower energy beams.
"""

if user_injection: