MIT-LAE / TASOPT.jl

Medium fidelity aircraft-propulsion system design and optimization.
https://mit-lae.github.io/TASOPT.jl/
MIT License
26 stars 14 forks source link

wsize gives an error if `HTsize = "maxforwardCG"` #4

Closed aditeyashukla closed 10 months ago

aditeyashukla commented 10 months ago

If Sh is set via CLhCGfwd at max-forward CG during landing, wsize returns this error:

iterw            errW           errW1           WMTO           Wpay          Wfuel           Weng          Wfuse          Wwing           span           area         HTarea          xwbox 
    1 +1.00000000e+00 +1.00000000e+00 4.03739496e+05 1.16676863e+05 5.42665948e+04 3.22991597e+04 1.10368447e+05 5.64256961e+04 0.00000000e+00 0.00000000e+00 9.17685103e+00 1.67640000e+01
ERROR: BoundsError: attempt to access 7-element Vector{Float64} at index [8]

Error stacktrace leads to the function findsegment(x::T, xarr::Vector{T}) in airfun2.jl


Stacktrace:
  [1] getindex
    @ ./essentials.jl:13 [inlined]
  [2] findsegment(x::Float64, xarr::Vector{Float64})
    @ TASOPT.aerodynamics ~/Dropbox/Mac (2)/Documents/LAE/forks/TAESOPT.jl/src/aero/airfun2.jl:142
  [3] airfun(cl::Float64, τ::Float64, Mach::Float64, Acl::Vector{Float64}, Aτ::Vector{Float64}, AMa::Vector{Float64}, A::Array{Float64, 4}, A_M::Array{Float64, 4}, A_τ::Array{Float64, 4}, A_cl::Array{Float64, 4}, A_M_τ::Array{Float64, 4}, A_M_cl::Array{Float64, 4}, A_cl_τ::Array{Float64, 4}, A_M_cl_τ::Array{Float64, 4})
    @ TASOPT.aerodynamics ~/Dropbox/Mac (2)/Documents/LAE/forks/TAESOPT.jl/src/aero/airfun2.jl:60
  [4] airfun(cl::Float64, τ::Float64, Mach::Float64, air::TASOPT.aerodynamics.airfoil)
    @ TASOPT.aerodynamics ~/Dropbox/Mac (2)/Documents/LAE/forks/TAESOPT.jl/src/aero/airfun2.jl:23
  [5] surfcd2(S::Float64, b::Float64, bs::Float64, bo::Float64, λt::Float64, λs::Float64, γt::Float64, γs::Float64, toco::Float64, tocs::Float64, toct::Float64, Mach::Float64, sweep::Float64, co::Float64, CL::Float64, CLhtail::Float64, fLo::Float64, fLt::Float64, Reco::Float64, aRexp::Float64, kSuns::Float64, fexcd::Float64, fduo::Float64, fdus::Float64, fdut::Float64)
    @ TASOPT.aerodynamics ~/Dropbox/Mac (2)/Documents/LAE/forks/TAESOPT.jl/src/aero/surfcd.jl:122
  [6] cdsum!(pari::Vector{Int64}, parg::Vector{Float64}, para::SubArray{Float64, 1, Array{Float64, 3}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64, Int64}, true}, pare::SubArray{Float64, 1, Array{Float64, 3}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64, Int64}, true}, icdfun::Int64)
    @ TASOPT.aerodynamics ~/Dropbox/Mac (2)/Documents/LAE/forks/TAESOPT.jl/src/aero/cdsum.jl:134
  [7] wsize(pari::Vector{Int64}, parg::Vector{Float64}, parm::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, para::SubArray{Float64, 2, Array{Float64, 3}, Tuple{Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Int64}, true}, pare::SubArray{Float64, 2, Array{Float64, 3}, Tuple{Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Int64}, true}, itermax::Int64, wrlx1::Float64, wrlx2::Float64, wrlx3::Float64, initwgt::Bool, initeng::Int64, iairf::Int64, Ldebug::Bool, printiter::Bool, saveODperf::Bool)
    @ TASOPT ~/Dropbox/Mac (2)/Documents/LAE/forks/TAESOPT.jl/src/sizing/wsize.jl:1344
  [8] size_aircraft!(ac::aircraft; iter::Int64, initwgt::Bool, Ldebug::Bool, printiter::Bool, saveOD::Bool)
    @ TASOPT ~/Dropbox/Mac (2)/Documents/LAE/forks/TAESOPT.jl/src/TASOPT.jl:111
  [9] size_aircraft!
    @ ~/Dropbox/Mac (2)/Documents/LAE/forks/TAESOPT.jl/src/TASOPT.jl:107 [inlined]
 [10] top-level scope
    @ ./timing.jl:393```
aditeyashukla commented 10 months ago

Error occurs in all models (default as well as regional)