Skip to content

Commit

Permalink
Merge pull request #332 from chrisbrahms/helium
Browse files Browse the repository at this point in the history
make "HeJ" the default helium
  • Loading branch information
chrisbrahms authored Aug 4, 2023
2 parents 3988898 + 54ff0d4 commit e756eab
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 70 deletions.
2 changes: 1 addition & 1 deletion docs/src/scans.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import PyPlot: plt

a = 125e-6
flength = 3
gas = :HeJ
gas = :He
λ0 = 800e-9
τfwhm = 10e-15
λlims = (100e-9, 4e-6)
Expand Down
2 changes: 1 addition & 1 deletion examples/simple_interface/scan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PyPlot: plt
# Fixed parameters:
a = 125e-6
flength = 3
gas = :HeJ
gas = :He

λ0 = 800e-9
τfwhm = 10e-15
Expand Down
2 changes: 0 additions & 2 deletions src/Interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,6 @@ function prop_capillary_args(radius, flength, gas, pressure;
plasma = isnothing(plasma) ? !envelope : plasma
thg = isnothing(thg) ? !envelope : thg

gas = (gas == :He) ? :HeJ : gas

grid = makegrid(flength, λ0, λlims, trange, envelope, thg, δt)
mode_s = makemode_s(modes, flength, radius, gas, pressure, model, loss, pol)
check_orth(mode_s)
Expand Down
15 changes: 8 additions & 7 deletions src/PhysData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ const amg = atm/(k_B*273.15)
"Atomic mass unit"
const m_u = ustrip(CODATA2014.m_u)

const gas = (:Air, :He, :HeJ, :Ne, :Ar, :Kr, :Xe, :N2, :H2, :O2, :CH4, :SF6, :N2O, :D2)
const gas = (:Air, :He, :HeJ, :HeB, :Ne, :Ar, :Kr, :Xe, :N2, :H2, :O2, :CH4, :SF6, :N2O, :D2)
const gas_str = Dict(
:He => "He",
:HeB => "He",
:HeJ => "He",
:Ar => "Ar",
:Ne => "Neon",
Expand Down Expand Up @@ -142,13 +143,13 @@ calculated from Sellmeier expansions.
"""
function sellmeier_gas(material::Symbol)
dens = dens_1bar_0degC[material]
if material == :He
if material == :HeB
B1 = 4977.77e-8
C1 = 28.54e-6
B2 = 1856.94e-8
C2 = 7.76e-3
return γ_Börzsönyi(B1/dens, C1, B2/dens, C2)
elseif material == :HeJ
elseif material == :He || material == :HeJ
B1 = 2.16463842e-05
C1 = -6.80769781e-04
B2 = 2.10561127e-07
Expand Down Expand Up @@ -570,7 +571,7 @@ References:
function γ3_gas(material::Symbol; source=nothing)
# TODO: More Bishop/Shelton; Wahlstrand updated values.
if source === nothing
if material in (:He, :HeJ, :Ne, :Ar, :Kr, :Xe, :N2)
if material in (:He, :HeB, :HeJ, :Ne, :Ar, :Kr, :Xe, :N2)
source = :Lehmeier
elseif material in (:H2, :CH4, :SF6, :D2)
source = :Shelton
Expand All @@ -585,7 +586,7 @@ function γ3_gas(material::Symbol; source=nothing)
if source == :Lehmeier
dens = dens_1atm_0degC[material]
# Table 1 in [3]
if material in (:He, :HeJ)
if material in (:He, :HeB, :HeJ)
fac = 1
elseif material == :Ne
fac = 1.8
Expand Down Expand Up @@ -708,7 +709,7 @@ Return the first ionisation potential of the `material` in a specific unit (defa
Possible units are `:SI`, `:atomic` and `:eV`.
"""
function ionisation_potential(material; unit=:SI)
if material in (:He, :HeJ)
if material in (:He, :HeB, :HeJ)
Ip = 0.9036
elseif material == :Ne
Ip = 0.7925
Expand Down Expand Up @@ -764,7 +765,7 @@ function quantum_numbers(material)
return 4, 1, 1
elseif material == :Xe
return 5, 1, 1
elseif material in (:He, :HeJ)
elseif material in (:He, :HeB, :HeJ)
return 1, 0, 1
elseif material == :O2
return 2, 0, 0.53 # https://doi.org/10.1016/S0030-4018(99)00113-3
Expand Down
4 changes: 2 additions & 2 deletions src/Scans.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Make an appropriate file name for an `HDF5Output` or `prop_capillary` output for
```
scan = Scan("scan_example"; energy=collect(range(5e-6, 200e-6; length=64)))
runscan(scan) do scanidx, energyi
prop_capillary(125e-6, 3, :HeJ, 0.8; λ0=800e-9, τfwhm=10e-15, energy=energyi
prop_capillary(125e-6, 3, :He, 0.8; λ0=800e-9, τfwhm=10e-15, energy=energyi
filepath=makefilename(scan, scanidx))
end
```
Expand Down Expand Up @@ -251,7 +251,7 @@ The exact subset and order of scan points which is run depends on `scan.exec`, s
```
scan = Scan("scan_example"; energy=collect(range(5e-6, 200e-6; length=64)))
runscan(scan) do scanidx, energyi
prop_capillary(125e-6, 3, :HeJ, 0.8; λ0=800e-9, τfwhm=10e-15, energy=energyi)
prop_capillary(125e-6, 3, :He, 0.8; λ0=800e-9, τfwhm=10e-15, energy=energyi)
end
```
"""
Expand Down
32 changes: 16 additions & 16 deletions test/test_capillary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import Luna.PhysData: wlfreq
λ = 800e-9
ω = wlfreq(λ)
a = 125e-6
m = Capillary.MarcatiliMode(a, :He, 1.0, model=:reduced)
m = Capillary.MarcatiliMode(a, :HeB, 1.0, model=:reduced)
@test isapprox(Capillary.losslength(m, ω), 7.0593180702769, rtol=1e-5)
@test isapprox(Capillary.dB_per_m(m, ω), 0.6152074146252722, rtol=1e-5)
@test Capillary.dB_per_m(m, ω) 8*Capillary.dB_per_m(Capillary.MarcatiliMode(2a, :He, 1.0, model=:reduced), ω)
@test Capillary.dB_per_m(m, ω) 8*Capillary.dB_per_m(Capillary.MarcatiliMode(2a, :HeB, 1.0, model=:reduced), ω)
end

@testset "normalisation" begin
Expand Down Expand Up @@ -55,17 +55,17 @@ end
@testset "n = $n" for n = 1:6
@testset "m = $m" for m = 1:6
# With the exception of HE65 specifically, all of these also pass with rtol=1e-20
mode = Capillary.MarcatiliMode(a, :He, 1.0, n=n, m=m)
mode = Capillary.MarcatiliMode(a, :HeB, 1.0, n=n, m=m)
Ni, Nerr = N(mode)
@test isapprox(Modes.N(mode), Ni, atol=Nerr, rtol=1e-7)
aeff, aefferr = Aeff(mode)
@test isapprox(Modes.Aeff(mode), aeff, rtol=1e-7, atol=aefferr)
end
end
m = Capillary.MarcatiliMode(a, :He, 1.0, n=0, kind=:TE)
m = Capillary.MarcatiliMode(a, :HeB, 1.0, n=0, kind=:TE)
@test Modes.N(m) N(m)[1]
@test Modes.Aeff(m) Aeff(m)[1]
m = Capillary.MarcatiliMode(a, :He, 1.0, n=0, kind=:TM)
m = Capillary.MarcatiliMode(a, :HeB, 1.0, n=0, kind=:TM)
@test Modes.N(m) N(m)[1]
@test Modes.Aeff(m) Aeff(m)[1]

Expand All @@ -75,7 +75,7 @@ end
afun = let a0=a0, aL=aL, L=L
afun(z) = a0 + (aL-a0)*z/L
end
m = Capillary.MarcatiliMode(afun, :He, 1, loss=false, model=:full)
m = Capillary.MarcatiliMode(afun, :HeB, 1, loss=false, model=:full)
@test Modes.N(m) N(m)[1]
@test Modes.N(m, z=L/2) N(m, z=L/2)[1]
@test Modes.N(m, z=L) N(m, z=L)[1]
Expand All @@ -87,22 +87,22 @@ end

@testset "β, α" begin
a = 125e-6
m = Capillary.MarcatiliMode(a, :He, 1.0, model=:reduced)
m = Capillary.MarcatiliMode(a, :HeB, 1.0, model=:reduced)
λ = 1e-9 .* collect(range(70, stop=7300, length=128))
ω = wlfreq.(λ)
@test all(isfinite.(Capillary.β.(m, ω)))
@test all(isreal.(Capillary.β.(m, ω)))
@test all(isreal.(Capillary.β.(Capillary.MarcatiliMode(a, :He, 1.0, model=:reduced), ω)))
@test all(isreal.(Capillary.β.(Capillary.MarcatiliMode(a, :He, 10.0, model=:reduced), ω)))
@test all(isreal.(Capillary.β.(Capillary.MarcatiliMode(a, :He, 50.0, model=:reduced), ω)))
@test all(isreal.(Capillary.β.(Capillary.MarcatiliMode(a, :HeB, 1.0, model=:reduced), ω)))
@test all(isreal.(Capillary.β.(Capillary.MarcatiliMode(a, :HeB, 10.0, model=:reduced), ω)))
@test all(isreal.(Capillary.β.(Capillary.MarcatiliMode(a, :HeB, 50.0, model=:reduced), ω)))
@test all(isfinite.(Capillary.α.(m, ω)))
@test all(isreal.(Capillary.α.(m, ω)))
end

@testset "ZDW/Aeff" begin
@test abs(1e9*Capillary.zdw(Capillary.MarcatiliMode(125e-6, :He, 0.4, model=:reduced)) - 379) < 1
@test abs(1e9*Capillary.zdw(Capillary.MarcatiliMode(75e-6, :He, 5.9, model=:reduced)) - 562) < 1
@test Capillary.Aeff(Capillary.MarcatiliMode(75e-6, :He, 1.0, model=:reduced)) 8.42157534886545e-09
@test abs(1e9*Capillary.zdw(Capillary.MarcatiliMode(125e-6, :HeB, 0.4, model=:reduced)) - 379) < 1
@test abs(1e9*Capillary.zdw(Capillary.MarcatiliMode(75e-6, :HeB, 5.9, model=:reduced)) - 562) < 1
@test Capillary.Aeff(Capillary.MarcatiliMode(75e-6, :HeB, 1.0, model=:reduced)) 8.42157534886545e-09
end


Expand Down Expand Up @@ -143,12 +143,12 @@ end
@test isapprox(Capillary.dispersion(m, 5, ω), 2.64991510536236e-73, rtol=5e-5)
@test isapprox(Capillary.zdw(m), 7.225347947615157e-07, rtol=2e-8)
@test isapprox(Capillary.α(m, ω), 0.0290115706883820, rtol=1e-14)
@test Capillary.Aeff(Capillary.MarcatiliMode(75e-6, :He, 1.0)) 8.42157534886545e-09
@test Capillary.Aeff(Capillary.MarcatiliMode(75e-6, :HeB, 1.0)) 8.42157534886545e-09
end

@testset "to_space" begin
ms = (Capillary.MarcatiliMode(125e-6, :He, 1.0),
Capillary.MarcatiliMode(125e-6, :He, 1.0, m=2, ϕ=π/2))
ms = (Capillary.MarcatiliMode(125e-6, :HeB, 1.0),
Capillary.MarcatiliMode(125e-6, :HeB, 1.0, m=2, ϕ=π/2))
components = :xy
xs = (10e-6, π/7)
ts = Modes.ToSpace(ms, components=components)
Expand Down
2 changes: 1 addition & 1 deletion test/test_ionisation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import NumericalIntegration: integrate, SimpsonEven

@test Ionisation.ionrate_ADK(:He, 1e10) 1.2416371415312408e-18
@test Ionisation.ionrate_ADK(:He, 2e10) 1.0772390893742478
@test Ionisation.ionrate_ADK(:HeJ, 2e10) 1.0772390893742478
@test Ionisation.ionrate_ADK(:HeB, 2e10) 1.0772390893742478
@test Ionisation.ionrate_ADK(:Ar , 7e9) 2.4422306306649472e-08
@test Ionisation.ionrate_ADK(:Ar , 8e9) 4.494711488416766e-05

Expand Down
22 changes: 11 additions & 11 deletions test/test_modes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import Luna.PhysData: wlfreq


@testset "delegation" begin
m = Modes.delegated(Capillary.MarcatiliMode(75e-6, :He, 5.9))
m = Modes.delegated(Capillary.MarcatiliMode(75e-6, :HeB, 5.9))
@test Modes.Aeff(m) 8.42157534886545e-09
@test abs(1e9*Modes.zdw(m) - 562) < 1
n(m, ω; z=0) = real(Modes.neff(m, ω; z=z))
m2 = Modes.delegated(Capillary.MarcatiliMode(75e-6, :He, 1.0), neff=n)
m2 = Modes.delegated(Capillary.MarcatiliMode(75e-6, :HeB, 1.0), neff=n)
@test Modes.α(m2, 2e15) == 0
@test Modes.α(m2, wlfreq(800e-9)) == 0

cm = Capillary.MarcatiliMode(75e-6, :He, 5.9)
cm = Capillary.MarcatiliMode(75e-6, :HeB, 5.9)
dm = Modes.delegated(cm)
@test Modes.Aeff(dm) 8.42157534886545e-09

Expand Down Expand Up @@ -49,7 +49,7 @@ end

@testset "overlap" begin
a = 100e-6
m = Capillary.MarcatiliMode(a, :He, 1.0, model=:reduced)
m = Capillary.MarcatiliMode(a, :HeB, 1.0, model=:reduced)
r = collect(range(0, a, length=2^16))
unm = sf_bessel_zero_Jnu(0, 1)
Er = besselj.(0, unm*r/a) # spatial profile of the HE11 mode - overlap should be perfect
Expand All @@ -63,7 +63,7 @@ Er = besselj.(0, unm*r/a) # spatial profile of HE12 - overlap should be 0
fac = collect(range(0.3, stop=0.9, length=128))
ηn = zero(fac)
r = collect(range(0, 4a, length=2^16))
m = Capillary.MarcatiliMode(a, :He, 1.0, model=:reduced, m=1)
m = Capillary.MarcatiliMode(a, :HeB, 1.0, model=:reduced, m=1)
for i in eachindex(fac)
w0 = fac[i]*a
Er = Maths.gauss.(r, w0/sqrt(2))
Expand All @@ -78,7 +78,7 @@ w0 = fac*a
Er = Maths.gauss.(r, w0/sqrt(2))
s = 0
for mi = 1:10
m = Capillary.MarcatiliMode(a, :He, 1.0, model=:reduced, m=mi)
m = Capillary.MarcatiliMode(a, :HeB, 1.0, model=:reduced, m=mi)
η = Modes.overlap(m, r, Er, dim=1)[1]
s += abs2(η[1])
end
Expand Down Expand Up @@ -122,8 +122,8 @@ energy1 = ert(Etr1)
energy2 = ert(Etr2)
@test ert(Etr) energy1 + energy2

m1 = Capillary.MarcatiliMode(a, :He, 1.0, model=:reduced, m=1)
m2 = Capillary.MarcatiliMode(a, :He, 1.0, model=:reduced, m=2)
m1 = Capillary.MarcatiliMode(a, :HeB, 1.0, model=:reduced, m=1)
m2 = Capillary.MarcatiliMode(a, :HeB, 1.0, model=:reduced, m=2)
Eωm1 = Modes.overlap(m1, q.r, Eωr; dim=2, norm=false)
Eωm2 = Modes.overlap(m2, q.r, Eωr; dim=2, norm=false)

Expand Down Expand Up @@ -189,8 +189,8 @@ energy1 = ert(Etr1)
energy2 = ert(Etr2)
@test ert(Etr) energy1 + energy2

modes = (Capillary.MarcatiliMode(a, :He, 1.0, model=:reduced, m=1),
Capillary.MarcatiliMode(a, :He, 1.0, model=:reduced, m=2))
modes = (Capillary.MarcatiliMode(a, :HeB, 1.0, model=:reduced, m=1),
Capillary.MarcatiliMode(a, :HeB, 1.0, model=:reduced, m=2))
newgrid = Grid.RealGrid(1, 800e-9, (160e-9, 3000e-9), 1e-12)

Eωm = Modes.overlap(modes, newgrid, grid, q.r, Eωr)
Expand Down Expand Up @@ -375,7 +375,7 @@ end # testset "makemodes"
@testset "spatial field and fluence" begin
a = 100e-6
flength = 0.1
gas = :He
gas = :HeB
pressure = 1
λ0 = 800e-9
τfwhm = 30e-15
Expand Down
38 changes: 19 additions & 19 deletions test/test_physdata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import Luna: PhysData

@testset "All" begin
@testset "Exceptions" begin
@test_throws DomainError PhysData.ref_index(:Hello, 800e-9)
@test_throws DomainError PhysData.ref_index(:HeBllo, 800e-9)
end

@testset "refractive indices" begin
@test PhysData.ref_index(:He, 800e-9) 1.000031950041203
@test PhysData.ref_index(:He, 800e-9, 10) 1.0003180633169397
@test PhysData.ref_index(:HeB, 800e-9) 1.000031950041203
@test PhysData.ref_index(:HeB, 800e-9, 10) 1.0003180633169397
@test PhysData.ref_index(:SiO2, 800e-9, lookup=false) 1.4533172548587419
@test PhysData.ref_index(:SiO2, 400e-9, lookup=false) 1.4701161185594052
@test PhysData.ref_index(:SiO2, PhysData.eV_to_m(6)) 1.543
Expand All @@ -20,13 +20,13 @@ end

@testset "Function equivalence" begin
@test PhysData.ref_index_fun(:SiO2)(800e-9) == PhysData.ref_index(:SiO2, 800e-9)
@test PhysData.ref_index_fun(:He)(800e-9) == PhysData.ref_index(:He, 800e-9)
@test PhysData.ref_index_fun(:HeB)(800e-9) == PhysData.ref_index(:HeB, 800e-9)
end

@testset "Dispersion" begin
@test PhysData.dispersion(2, :SiO2, 800e-9, lookup=false) 3.61619983e-26
@test isapprox(PhysData.dispersion(2, :He, 800e-9), 9.373942337550116e-31, rtol=1e-5)
@test isapprox(PhysData.dispersion(2, :He, 800e-9, 10), 9.33043805928079e-30, rtol=1e-5)
@test isapprox(PhysData.dispersion(2, :HeB, 800e-9), 9.373942337550116e-31, rtol=1e-5)
@test isapprox(PhysData.dispersion(2, :HeB, 800e-9, 10), 9.33043805928079e-30, rtol=1e-5)
end

@testset "glasses" begin
Expand All @@ -48,12 +48,12 @@ end
end

@testset "Nonlinear coefficients" begin
@test_broken PhysData.χ3(:He, 1) 1.2617371645226101e-27
@test_broken PhysData.χ3(:HeB, 1) 1.2617371645226101e-27
@test PhysData.χ3(:Ar, 1) 2.964158749949189e-26
@test_broken PhysData.n2(:He, 1) 3.5647819877255427e-25
@test PhysData.n2(:He, 2) 7.125642138007481e-25
@test_broken PhysData.n2.(:He, [1, 2]) [3.5647819877255427e-25, 7.125642138007481e-25]
@test_broken PhysData.n2.([:He, :Ne], 1) [3.5647819877255427e-25, 6.416061508801999e-25]
@test_broken PhysData.n2(:HeB, 1) 3.5647819877255427e-25
@test PhysData.n2(:HeB, 2) 7.125642138007481e-25
@test_broken PhysData.n2.(:HeB, [1, 2]) [3.5647819877255427e-25, 7.125642138007481e-25]
@test_broken PhysData.n2.([:HeB, :Ne], 1) [3.5647819877255427e-25, 6.416061508801999e-25]
for gas in PhysData.gas[2:end] # Don't have γ3 for Air
@test isreal(PhysData.n2(gas, 1))
end
Expand All @@ -67,11 +67,11 @@ end
@test isapprox(PhysData.density(:Ar, 2.0, 294.0), 4.933761614600933e25, rtol=4e-13)
@test isapprox(PhysData.density(:Ar, 40.0, 294.0), 1.0101579129300146e27, rtol=2e-11)
@test isapprox(PhysData.density(:Ar, 400.0, 294.0), 9.270757850984163e27, rtol=3e-10)
@test_broken isapprox(PhysData.density(:He, 0.002, 294.0), 4.927180563885407e22, rtol=7e-16)
@test_broken isapprox(PhysData.density(:He, 0.02, 294.0), 4.927137517453137e23, rtol=2e-16)
@test_broken isapprox(PhysData.density(:He, 2.0, 294.0), 4.9224080868066745e25, rtol=2e-13)
@test_broken isapprox(PhysData.density(:He, 40.0, 294.0), 9.66755645602771e26, rtol=6e-16)
@test_broken isapprox(PhysData.density(:He, 400.0, 294.0), 8.309132317978155e27, rtol=1e-13)
@test_broken isapprox(PhysData.density(:HeB, 0.002, 294.0), 4.927180563885407e22, rtol=7e-16)
@test_broken isapprox(PhysData.density(:HeB, 0.02, 294.0), 4.927137517453137e23, rtol=2e-16)
@test_broken isapprox(PhysData.density(:HeB, 2.0, 294.0), 4.9224080868066745e25, rtol=2e-13)
@test_broken isapprox(PhysData.density(:HeB, 40.0, 294.0), 9.66755645602771e26, rtol=6e-16)
@test_broken isapprox(PhysData.density(:HeB, 400.0, 294.0), 8.309132317978155e27, rtol=1e-13)
@test isapprox(PhysData.density(:Xe, 0.002, 294.0), 4.927238737907382e22, rtol=7e-16)
@test isapprox(PhysData.density(:Xe, 0.02, 294.0), 4.92771934762324e23, rtol=2e-16)
@test isapprox(PhysData.density(:Xe, 2.0, 294.0), 4.981603290885485e25, rtol=9e-16)
Expand All @@ -89,9 +89,9 @@ end
@test isapprox(PhysData.density(:H2, 40.0, 294.0), 9.624525613497868e26, rtol=6e-16)
@test isapprox(PhysData.density(:H2, 400.0, 294.0), 7.840662987579036e27, rtol=6e-16)
# temperature range
@test_broken isapprox(PhysData.density(:He, 10.0, 10.0), 9.218927214187151e27, rtol=6e-16)
@test_broken isapprox(PhysData.density(:He, 10.0, 100.0), 7.142310177179197e26, rtol=6e-16)
@test_broken isapprox(PhysData.density(:He, 10.0, 1000.0), 7.234660811823096e25, rtol=6e-13)
@test_broken isapprox(PhysData.density(:HeB, 10.0, 10.0), 9.218927214187151e27, rtol=6e-16)
@test_broken isapprox(PhysData.density(:HeB, 10.0, 100.0), 7.142310177179197e26, rtol=6e-16)
@test_broken isapprox(PhysData.density(:HeB, 10.0, 1000.0), 7.234660811823096e25, rtol=6e-13)
@test isapprox(PhysData.density(:Xe, 10.0, 170.0), 1.336261228046876e28, rtol=6e-16)
@test isapprox(PhysData.density(:Xe, 10.0, 700.0), 1.0361035050644844e26, rtol=6e-13)
@test isapprox(PhysData.density(:N2, 10.0, 100.0), 1.4849593021049305e28, rtol=6e-7)
Expand Down
2 changes: 1 addition & 1 deletion test/test_processing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ end
@testset "scanproc" begin
a = 125e-6
flength = 0.1
gas = :HeJ
gas = :He

λ0 = 800e-9
τfwhm = 10e-15
Expand Down
Loading

0 comments on commit e756eab

Please sign in to comment.