Example #1
0
def plot_Ez_on_axis(n_pe, beam_tot_z, beam_num_ptcl):
    """
    Plot the longitudinal electric field in a plasma bubble.

    Valid in "strong bubble regime", where rb_max*k_pe >> 1.
    Args:
        n_pe:    number density of the electron plasma
        beam_tot_z:     total length of the drive beam
        beam_num_ptcl:  number of e- in the drive beam
    Returns:
        ax: matplotlib 'Axis' object for Ez inside bubble
    """

    # calculate the maximum bubble radius
    rb_max = lbn_wake.calc_rb_max(n_pe, beam_tot_z, beam_num_ptcl)

    # calculate the bubble half width
    xi_b = lbn_wake.calc_bubble_halfwidth(rb_max)

    # calculate the approximate (constant?) decelerating field
    #     along the drive beam
    E_decel = lbn_wake.calc_E_decel_along_beam(n_pe, beam_tot_z, beam_num_ptcl)

    # Specify the plot range, xi_min <= xi <= xi_max
    # xi=ct-z is the distance from the front of the bubble (positive)
    xi_min = 0.
    xi_max = 1.99 * xi_b
    num_points = 100
    xi_array = np.linspace(xi_min, xi_max, num=num_points)
    ez_array = np.zeros(num_points)
    for iloop in range(0, num_points):
        xi = xi_array[iloop]
        if xi < 0. or xi > 2. * xi_b: ez_array[iloop] = 0.
        elif xi < beam_tot_z: ez_array[iloop] = E_decel
        else:
            rb = lbn_wake.calc_local_bubble_radius(xi, rb_max)
            ez_array[iloop] = lbn_wake.calc_Ez_on_axis_no_beam(
                n_pe, rb, rb_max)

    # normalize units to GV/m and microns
    ez_array *= 1.e-9
    xi_array *= 1.e6

    # generate the plot
    ax = plt.subplot(111)
    ax.plot(xi_array, ez_array)
    ax.set_xlabel('xi = ct - z [microns]')
    ax.set_ylabel('(axial) Ez [GV/m]')
    ax.set_title('PWFA axial Ez in "strong" regime')
    return ax
Example #2
0
def plot_bubble_radius(n_pe, beam_tot_z, beam_num_ptcl):
    """
    Plot the plasma bubble radius.

    Valid in "strong bubble regime", where rb_max*k_pe >> 1.
    Args:
        n_pe:    number density of the electron plasma
        beam_tot_z:     total length of the drive beam
        beam_num_ptcl:  number of e- in the drive beam
    Returns:
        ax: matplotlib 'Axis' object for bubble radius plot
    """

    # calculate the maximum bubble radius
    rb_max = lbn_wake.calc_rb_max(n_pe, beam_tot_z, beam_num_ptcl)

    # calculate the bubble half width
    xi_b = lbn_wake.calc_bubble_halfwidth(rb_max)

    # Specify the plot range, xi_min <= xi <= xi_max
    # xi=ct-z is the distance from the front of the bubble (positive)
    xi_min = 0.
    xi_max = 2. * xi_b
    num_points = 200
    xi_array = np.linspace(xi_min, xi_max, num=num_points)
    rb_array = np.zeros(num_points)
    for iloop in range(0, num_points):
        rb_array[iloop] = lbn_wake.calc_local_bubble_radius(
            xi_array[iloop], rb_max)

    # normalize units to microns
    rb_array *= 1.e6
    xi_array *= 1.e6

    # generate the plot
    ax = plt.subplot(111)
    ax.plot(xi_array, rb_array)
    ax.set_xlabel('xi = ct - z [microns]')
    ax.set_ylabel('rb [microns]')
    ax.set_title('PWFA bubble radius in "strong" regime')
    return ax
Example #3
0
# The accelerated "witness" beam, also assumed Gaussian
# -------------------
wb_rms_r = 0.012 * lambda_pe  # [m] RMS radius
wb_rms_z = 0.036 * lambda_pe  # [m] RMS length
wb_tot_q = 0.100e-9           # [C] total charge of 100 pC
wb_gamma = 100                # relativistic gamma factor
wb_trail = 0.900 * lambda_pe  # [m] trailing distance behind center of drive beam

# -----------------
# Excercise some of the methods
#------------------

print()
print("*******")
print("Calculate the maximum radius of the plasma bubble:")
rb_max = lbn_wake.calc_rb_max(n_pe, beam_tot_z, beam_num_ptcl)
print("    rb_max = ", rs_sigfig(rb_max*1.e6,3), " [microns]")

print()
print("*******")
print("Calculate the 1st 'strong bubble' validity condition...")
print("(bubble radius) / (plasma skin depth); it must be large:")
strong_check_1 = rb_max*k_pe
print("    1st validity ratio = ", rs_sigfig(strong_check_1,3))

print()
print("*******")
print("Calculate the 2nd 'strong bubble' validity condition...")
print("(scaled beam dens) / (plasma dens); it must be large:")
strong_check_2 = beam_num_ptcl/n_pe/beam_tot_z**3
print("    2nd validity ratio = ", rs_sigfig(strong_check_2,3))
Example #4
0
def test_lbn_07():
    rb = 0.4 * lambda_pe
    rb_max = lbn_wake.calc_rb_max(n_pe, beam_tot_z, beam_num_ptcl)
    Ez_nb = lbn_wake.calc_Ez_on_axis_no_beam(n_pe, rb, rb_max)
    assert rs_sigfig(Ez_nb * 1.e-9, 3) == rs_sigfig(-31.9, 3)
Example #5
0
def test_lbn_06():
    rb = 0.4 * lambda_pe
    rb_max = lbn_wake.calc_rb_max(n_pe, beam_tot_z, beam_num_ptcl)
    drb_dxi_nb = lbn_wake.calc_drb_dxi_no_beam(rb, rb_max)
    assert rs_sigfig(drb_dxi_nb, 3) == rs_sigfig(1.32, 3)
Example #6
0
def test_lbn_04():
    rb_max = lbn_wake.calc_rb_max(n_pe, beam_tot_z, beam_num_ptcl)
    p_beam_plasma = lbn_wake.calc_power_beam_plasma(n_pe, rb_max)
    assert rs_sigfig(p_beam_plasma, 3) == rs_sigfig(2.19e+20, 3)
Example #7
0
def test_lbn_02():
    rb_max = lbn_wake.calc_rb_max(n_pe, beam_tot_z, beam_num_ptcl)
    strong_check_1 = rb_max * k_pe
    assert rs_sigfig(strong_check_1, 3) == rs_sigfig(3.66, 3)
Example #8
0
def test_lbn_01():
    rb_max = lbn_wake.calc_rb_max(n_pe, beam_tot_z, beam_num_ptcl)
    assert rs_sigfig(rb_max * 1.e6, 3) == rs_sigfig(97.2, 3)
Example #9
0
def test_lbn_10():
    rb_max = lbn_wake.calc_rb_max(n_pe, beam_tot_z, beam_num_ptcl)
    xi_b = lbn_wake.calc_bubble_halfwidth(rb_max)
    rb = lbn_wake.calc_local_bubble_radius(xi_b, rb_max)
    assert rs_sigfig(rb * 1.e6, 3) == rs_sigfig(97.2, 3)
Example #10
0
def test_lbn_09():
    rb_max = lbn_wake.calc_rb_max(n_pe, beam_tot_z, beam_num_ptcl)
    xi_b = lbn_wake.calc_bubble_halfwidth(rb_max)
    xi = 0.3 * xi_b
    rb = lbn_wake.calc_local_bubble_radius(xi, rb_max)
    assert rs_sigfig(rb * 1.e6, 3) == rs_sigfig(77.7, 3)
Example #11
0
def test_lbn_08():
    rb_max = lbn_wake.calc_rb_max(n_pe, beam_tot_z, beam_num_ptcl)
    xi_b = lbn_wake.calc_bubble_halfwidth(rb_max)
    assert rs_sigfig(xi_b * 1.e6, 3) == rs_sigfig(82.3, 3)