UM-PEPL / HallThruster.jl

An open-source fluid Hall thruster code
Other
18 stars 10 forks source link

run.jl updated #53

Closed dere4 closed 2 years ago

dere4 commented 2 years ago

getting this error currently, I think its not just run.jl

ERROR: MethodError: no method matching length(::HallThruster.ExcitationReaction{HallThruster.LinearInterpolation{Int64, Float64}}) Closest candidates are: length(::Union{Base.KeySet, Base.ValueIterator}) at C:\Users\Paul\.julia\juliaup\julia-1.7.2+0~x64\share\julia\base\abstractdict.jl:58 length(::Union{Tables.AbstractColumns, Tables.AbstractRow}) at C:\Users\Paul\.julia\packages\Tables\PxO1m\src\Tables.jl:175 length(::Union{Adjoint{T, <:Union{StaticVector{<:Any, T}, StaticMatrix{<:Any, <:Any, T}}}, Diagonal{T, <:StaticVector{<:Any, T}}, Hermitian{T, <:StaticMatrix{<:Any, <:Any, T}}, LowerTriangular{T, <:StaticMatrix{<:Any, <:Any, T}}, Symmetric{T, <:StaticMatrix{<:Any, <:Any, T}}, Transpose{T, <:Union{StaticVector{<:Any, T}, StaticMatrix{<:Any, <:Any, T}}}, UnitLowerTriangular{T, <:StaticMatrix{<:Any, <:Any, T}}, UnitUpperTriangular{T, <:StaticMatrix{<:Any, <:Any, T}}, UpperTriangular{T, <:StaticMatrix{<:Any, <:Any, T}}, StaticArray{<:Tuple, T}, StaticVector{<:Any, T}, StaticMatrix{<:Any, <:Any, T}} where T) at C:\Users\Paul\.julia\packages\StaticArrays\tBRNS\src\abstractarray.jl:1 ... Stacktrace: [1] reactant_indices(reactions::HallThruster.ExcitationReaction{HallThruster.LinearInterpolation{Int64, Float64}}, species_range_dict::Dict{Symbol, UnitRange{Int64}}) @ HallThruster c:\Users\Paul\pepl\HallThruster.jl\src\collisions\ionization.jl:88 [2] run_simulation(config::HallThruster.Config{HallThruster.TwoZoneBohm, HallThruster.ConstantSheathPotential, HallThruster.LandmarkIonizationLookup, HallThruster.LandmarkExcitationLookup, HallThruster.LandmarkElectronNeutral, HallThruster.Thruster{PartialFunctions.PartialFunction{typeof(HallThruster.B_field_SPT_100), Tuple{Float64, Float64}, NamedTuple{(), Tuple{}}}}, Returns{Float64}, Vector{Returns{Float64}}, Vector{Returns{Float64}}, Returns{Float64}, Returns{Float64}, HallThruster.LinearTransition, typeof(IC!), Nothing, HallThruster.HyperbolicScheme{typeof(HallThruster.rusanov), HallThruster.FluxLimiter{HallThruster.var"#14#15"}}}, timestep::Float64, end_time::Float64, ncells::Int64, nsave::Int64; alg::SSPRK22{typeof(HallThruster.stage_limiter!), typeof(HallThruster.stage_limiter!), Static.False}, restart_file::Nothing) @ HallThruster c:\Users\Paul\pepl\HallThruster.jl\src\simulation\simulation.jl:60 [3] macro expansion @ .\timing.jl:220 [inlined] [4] run_sim(end_time::Float64; ncells::Int64, nsave::Int64, dt::Float64, implicit_energy::Float64, reconstruct::Bool, limiter::HallThruster.FluxLimiter{HallThruster.var"#14#15"}, restart_file::Nothing, case::Int64, alg::SSPRK22{typeof(HallThruster.stage_limiter!), typeof(HallThruster.stage_limiter!), Static.False}, flux::typeof(HallThruster.rusanov), ionization_model::HallThruster.LandmarkIonizationLookup, transition::HallThruster.LinearTransition, electron_neutral_model::HallThruster.LandmarkElectronNeutral, coupled::Bool, energy_equation::Symbol, progress_interval::Int64, WENO::Bool) @ Main c:\Users\Paul\pepl\HallThruster.jl\test\run.jl:126 [5] top-level scope @ c:\Users\Paul\pepl\HallThruster.jl\test\run.jl:136

electron energy test is giving InterruptException

codecov-commenter commented 2 years ago

Codecov Report

Merging #53 (af5ccf5) into main (6c69b74) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #53   +/-   ##
=======================================
  Coverage   77.55%   77.55%           
=======================================
  Files          27       27           
  Lines        1127     1127           
=======================================
  Hits          874      874           
  Misses        253      253           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6c69b74...af5ccf5. Read the comment docs.

archermarx commented 2 years ago

ok, will investigate this. thanks

archermarx commented 2 years ago

In excitation.jl, we have

function load_reactions(model::LandmarkExcitationLookup, species)
    rates = readdlm(LANDMARK_RATES_FILE, ',', skipstart = 1)
    ϵ = rates[:, 1]
    k_iz = rates[:, 2]
    k_loss = rates[:, 3]

    ionization_energy = 12.12
    excitation_energy = 8.32
    # We infer the excitation loss coefficient by subtracting the contribution of the ionization
    # loss coefficient from the inelastic loss term
    k_excitation = @. (k_loss - ionization_energy * k_iz) / excitation_energy
    rate_coeff = LinearInterpolation(ϵ, k_excitation)
    return ExcitationReaction(excitation_energy, Xenon(0), rate_coeff)
end

The last line needs to be wrapped in an array:

return [ExcitationReaction(excitation_energy, Xenon(0), rate_coeff)]