AssertionError: IndexStyle(value) === IndexLinear() in loss function

please anyone help me out
not able to debug
here is the code
trying to create data on second order ode and then passing random parameter in equation and applying DiffEqFlux.sciml_train to predict parameter
using DifferentialEquations
using DiffEqFlux

using Optim
po=1.0132510^5
s=.0728
ro=2.0e-6
D=200.0e-6
rho=1000.0
pv=2.33
10^3
gama=4/3
h=ro/8.86
c=1500.0
vis=.001002
omega=(2222010^3)/7
pa=(-1.4)po
yo=ro
c1=(po+(2
s/ro))ro^(3gama)/rho
c2=po/rho
c3=pa/rho
c4=4
vis/rho
c5=2s/rho
c6=1.5
u0 = [0.0,rho]
tsp=(0.0, 40.0e-6)
p=[c1,c2,c3,c4,c5,c6,omega]
function radi(ddr,dr,r,p,t)
α, Γ, β, δ, ε, k,omega = p
ddr[1]=α/r[1]^(3
gama+1) - Γ/r[1] - βsin(omegat)/r[1] - δdr[1]/r[1]^2 - ε/r[1]^2 -kdr[1]^2/r[1]
end

prob2 = SecondOrderODEProblem(radi, [0.], [ro], (0, 26.4e-6), p)
sol2 = solve(prob2, Tsit5(),saveat=1.0e-7)
data=Array(sol2)
using Plots
a=sol2[2,:]
plot(a)

pinit=[2.7e-10,10,1,4,1,1,omega]
function loss(p)

    tmp_prob=SecondOrderODEProblem(radi, [0.], [ro], (0, 26.4e-6), p)
    tmp_sol=solve(tmp_prob,Tsit5(),saveat=1.0e-7)
    sum(abs2,Array(tmp_sol)-data),tmp_sol

end

res=DiffEqFlux.sciml_train(loss,p,BFGS())

1 Like