3

I have been trying to implement Bayesian ODE. In Oil industry, we use the following equation to fit production data then forecasting :

The ODE equation is described as :

where 0<n<1, n and K are parameters defined by fitting the raw production data, in my case K is 0.17, n = 0.87.

My initial code :

using DiffEqFlux, OrdinaryDiffEq, Flux, Optim, Plots, AdvancedHMC
    
function Arps!(du,u,p,t)
    y = u
    K,n = p
    du  = (y * K * y^n)
end

tspan=(1.0,200.0)
tsteps = range(1, 200, length = 200)
u0 = [5505.99]
p=[0.17,0.87]
prob1 = ODEProblem(Arps!,u0,tspan)
sol_ode = solve(prob1,Vern7(),saveat = tsteps)

Not sure how to solve this issue :

MethodError: no method matching iterate(::DiffEqBase.NullParameters) 
logankilpatrick
  • 13,148
  • 7
  • 44
  • 125
Minou92
  • 137
  • 7

1 Answers1

3

You didn't pass any parameters into your ODE. prob1 = ODEProblem(Arps!,u0,tspan,p).

For the Bayesian part, look at the tutorial:

https://turing.ml/dev/tutorials/10-bayesiandiffeq/

Chris Rackauckas
  • 18,645
  • 3
  • 50
  • 81
  • Oh I forgot to include the p parameter, but once i did it : prob1 = ODEProblem(Arps!,u0,tspan,p) sol_ode = solve(prob1,Tsit5(),saveat = tsteps) I recieve this error : MethodError: no method matching ^(::Array{Float64,1}, ::Float64) – Minou92 Jan 05 '21 at 15:57
  • 1
    `y` is an array. `y = u[1]` and `du[1] = (y * K * y^n)`. – Chris Rackauckas Jan 05 '21 at 16:09