I perform GSA with the Sobol method for a system of ODEs for steady-state but I get the following error:
ERROR: TaskFailedException
nested task error: MethodError: Cannot `convert` an object of type Vector{Float64} to an object of type Float64 Closest candidates are: convert(::Type{T}, ::VectorizationBase.AbstractSIMD) where T<:Union{Bool, Float16, Float32, Float64, Int16, Int32, Int64, Int8, UInt16, UInt32, UInt64, UInt8, SIMDTypes.Bit}
Here is the function I use for the Sobol method:
# GSA using chunks
ensemble_chunked = function (p)
global parameterset = p
Np::Int64 = size(p,2)
println("Running ", Np, " cases.")
chunksize::Int64 = Np/chunks
println("Using ", chunks, " chunk(s) of size ", chunksize, ".")
out = zeros(10,Np)
for k in 1:chunks
offset = Int((k - 1) * Np/chunks)
startindx = Int(offset + 1)
endindx = Int(k * Np/chunks)
println("Starting chunk ", k, ", from ", startindx, " to ", endindx, " with offset ", offset, ".")
pchunk = p[:,startindx:endindx]
function prob_func(prob,i,repeat)
# p[:,i] is the ith set of parameters
p_pop = deepcopy(param);
p_pop[param_names] = pchunk[:,i];
remake(prob_ss;p=collect(p_pop))
end
ensemble_prob = EnsembleProblem(prob_ss,prob_func=prob_func)
@time " ODE Ensemble solved in " sol_ss = solve(ensemble_prob, alg=DynamicSS(AutoTsit5(Rosenbrock23(autodiff=false))), EnsembleThreads();trajectories=chunksize)
@time " Results processed in " Threads.@threads for i in 1:chunksize
out[1,i+offset] = sol_ss[63] + sol_ss[68] + sol_ss[69];
out[2,i+offset] = sol_ss[65] + sol_ss[66] + sol_ss[69];
out[3,i+offset] = sol_ss[67] + sol_ss[68];
out[4,i+offset] = sol_ss[42];
out[5,i+offset] = sol_ss[14] + sol_ss[18];
out[6,i+offset] = sol_ss[30] + sol_ss[60];
out[7,i+offset] = sol_ss[25];
out[8,i+offset] = sol_ss[72];
out[9,i+offset] = sol_ss[3];
out[10,i+offset] = sol_ss[31];
end
end
out
end