Пример #1
0
def test_laser_constructors(cet_plasma, cet_param):
    _ = Laser(ɛL=cet_param.ɛL, τL=cet_param.τL, beam=GaussianBeam())

    with pytest.raises(TypeError):
        _ = Laser.from_a0(a0=cet_param.a0, ɛL=cet_param.ɛL)

    cetbeam = GaussianBeam(w0=cet_param.w0)

    with pytest.raises(TypeError):
        _ = Laser.from_power(power=cet_param.power, beam=cetbeam)

    l1 = Laser.from_a0(a0=cet_param.a0, ɛL=cet_param.ɛL, τL=cet_param.τL)
    l2 = cet_plasma.laser
    l3 = Laser.from_intensity(intensity=cet_param.intensity,
                              ɛL=cet_param.ɛL,
                              τL=cet_param.τL)
    l4 = Laser.from_intensity(intensity=cet_param.intensity,
                              ɛL=cet_param.ɛL,
                              beam=cetbeam)
    l5 = Laser.from_intensity(intensity=cet_param.intensity,
                              τL=cet_param.τL,
                              beam=cetbeam)
    l6 = Laser.from_power(power=cet_param.power, τL=cet_param.τL, beam=cetbeam)
    l7 = Laser.from_power(power=cet_param.power, ɛL=cet_param.ɛL, beam=cetbeam)
    assert l1 == l2
    assert l2 == l3
    assert l3 == l4
    assert l4 == l5
    assert l5 == l6
    assert l6 == l7
Пример #2
0
def test_beam_constructors(cet_plasma, cet_param):
    g3 = cet_plasma.laser.beam
    g1 = GaussianBeam.from_f_number(f_number=cet_param.f_number)
    g2 = GaussianBeam.from_focal_distance(
        focal_distance=cet_param.focal_distance,
        beam_diameter=cet_param.beam_diameter)
    with pytest.raises(ValueError):
        _ = GaussianBeam(w0=cet_param.w0, fwhm=cet_param.fwhm)
    assert g1 == g2
    assert g2 == g3
Пример #3
0
def cet_plasma(cet_param):
    bubble_r = 2 * np.sqrt(cet_param.a0) / cet_param.kp

    return Plasma(
        n_pe=cet_param.npe,
        laser=Laser.from_a0(a0=cet_param.a0,
                            ɛL=cet_param.ɛL,
                            beam=GaussianBeam(w0=cet_param.w0)),
        bubble_radius=bubble_r,
    )
Пример #4
0
from labellines import labelLines
from prepic import GaussianBeam, Laser, Plasma, matched_laser_plasma

line_styles = ["-", "--", ":", "-."]
line_colors = ["C0", "C1", "C3", "C4"]

cyl = cycler(linestyle=line_styles) * cycler(color=line_colors)
loop_cy_iter = cyl()
STYLE = defaultdict(lambda: next(loop_cy_iter))

fig = Figure(figsize=(6.4, 6.4))
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)

beam = GaussianBeam(w0=15.0 * u.micrometer, λL=0.8 * u.micrometer)
electron_densities = np.logspace(-2, 2, 20) * 1e18 / (u.cm**3)

for a0 in np.linspace(2.0, 8.0, 7) * u.dimensionless:
    laser = Laser.from_a0(a0=a0, τL=30.0 * u.femtosecond, beam=beam)

    x_data = []
    y_data = []
    for npe in electron_densities:
        plasma = Plasma(n_pe=npe, laser=laser)
        x_data.append(plasma.npe)
        y_data.append(plasma.ΔE)

    h_axis = u.unyt_array(x_data)
    v_axis = u.unyt_array(y_data)
Пример #5
0
    ax.set_ylim(ymin=0, ymax=ne * 1.618)
    ax.set_xlim(xmin=-500)
    fig = plt.gcf()
    fig.set_size_inches(fig_width, fig_width * 0.40)
    plt.tight_layout()
    fig.savefig("density.eps", dpi=100, bbox_inches="tight")

    # Estimate laser-plasma parameters

    param = E4Params(
        npe=ne / u.cm**3,
        w0=18.7 * u.micrometer,
        ɛL=1.8 * u.joule,
        τL=25 * u.femtosecond,
        prop_dist=flat_top_dist * u.micrometer,
    )

    e4_beam = GaussianBeam(w0=param.w0)
    e4_laser = Laser(ɛL=param.ɛL, τL=param.τL, beam=e4_beam)
    e4_plasma = Plasma(n_pe=param.npe,
                       laser=e4_laser,
                       propagation_distance=param.prop_dist)
    sim_e4 = Simulation(e4_plasma, box_length=97 * u.micrometer, ppc=2)

    print(e4_beam)
    print(e4_laser)
    print(f"critical density for this laser is {e4_laser.ncrit:.1e}")
    print(e4_plasma)
    print(sim_e4)
Пример #6
0
Flame = namedtuple("Flame",
                   ["npe", "w0", "ɛL", "τL", "prop_dist", "f_dist", "diam"])

# we take the pulse energy to be the energy in focus, i.e. 40% of 3J.
param = Flame(
    npe=1.0e18 / u.cm**3,
    w0=15.0 * u.micrometer,
    ɛL=1.2 * u.joule,
    τL=28.0 * u.femtosecond,
    prop_dist=5.0 * u.mm,
    f_dist=1.0 * u.meter,
    diam=100 * u.mm,
)

beam = GaussianBeam.from_focal_distance(focal_distance=param.f_dist,
                                        beam_diameter=param.diam)
print((
    f"The diffraction-limited beam waist for an OAP with focal lenght of {param.f_dist:.1f} "
    f"and a laser beam diameter of {param.diam:.1f} is w0={beam.w0:.1f} at 1/e^2 intensity.\n"
))

laser = Laser(ɛL=param.ɛL, τL=param.τL, beam=GaussianBeam(w0=param.w0))

plasma = Plasma(
    n_pe=param.npe,
    laser=laser,
    bubble_radius=param.w0,
    propagation_distance=param.prop_dist,
)

print(
Пример #7
0
from matplotlib import pyplot

from prepic import Plasma, Laser, GaussianBeam, Radiator
from prepic.radiation import DifferentialSpectrum

Param = namedtuple("Param", ["npe", "w0", "ɛL", "τL", "prop_dist"])

p = Param(  # external guiding / injection example from from http://doi.org/f4j98s
    npe=5.1e17 / u.cm**3,
    w0=21.0 * u.micrometer,
    ɛL=3.0 * u.joule,
    τL=47.0 * u.femtosecond,
    prop_dist=52.0 * u.mm,
)

laser = Laser(ɛL=p.ɛL, τL=p.τL, beam=GaussianBeam(w0=p.w0))

plasma = Plasma(n_pe=p.npe,
                laser=laser,
                bubble_radius=p.w0,
                propagation_distance=p.prop_dist)

print(
    (f"For a plasma with a density of {plasma.npe:.1e} we get an "
     f"electron energy gain of {plasma.ΔE:.1f} and a total accelerated charge "
     f"of {plasma.Q:.1f} over an acceleration distance of {plasma.Lacc:.1f}."))

print("\nFurther details: ")
print(f"{plasma}")

radiator = Radiator(plasma=plasma)