# NeuralPDE.NNODE ODE system solve

Hi,

I wanted to use NeuralPDE.NNODE function to solve a coupled ODE system (4 ODE equations)
The code is given below : (not given completely)

``````
@parameters t
@variables k(t) r(t) p(t) c(t)
D = Differential(t)
eqs = [D(k(t)) ~ beta*k(t)*(1-(k(t)+r(t))) -.....,
D(r(t)) ~  q1*c(t)*k(t) +  data*p(t)*k(t) - .....,
D(p(t)) ~ r(t) - mu*p(t),
D(c(t)) ~ mu_2 - mu_1*c(t)]

@named sys = ODESystem(eqs)

u0 = [s(0) ~ 0.4, r(0) ~ 0.8, p(0) ~ 0.4, c(0) ~ 0.4]
tspan = (0.0,160.0);
println("Solving...")
prob = ODEProblem(sys,u0,tspan);
chain = Flux.Chain(Dense(1, 50, σ), Dense(50, 4));
sol = solve(prob, NeuralPDE.NNODE(chain, opt), dt=1 / 200f0, verbose=true, abstol=1e-10, maxiters=200)
``````

But when I execute it, it gives the error below:

``````ERROR: LoadError: Only out-of-place methods are allowed!
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] solve(::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ODEFunction{true, ModelingToolkit.var"#f#203"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2571340d, 0x0f300fc0, 0xda6e7893, 0x11594cd6, 0xcbed6770)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9ff91ba0, 0xc3b21241, 0xe35501c9, 0x3c75845f, 0xbf64861b)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ::NNODE{Chain{Tuple{Dense{typeof(σ), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, ADAM, Vector{Float32}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}; dt::Float32, timeseries_errors::Bool, save_everystep::Bool, adaptive::Bool, abstol::Float64, verbose::Bool, maxiters::Int64)
@ NeuralPDE ~/.julia/packages/NeuralPDE/HVA0c/src/ode_solve.jl:13
[3] top-level scope
@ JuliaRuns/Model-ODE/test_diff.jl:57
in expression starting at JuliaRuns/Model-ODE/test_diff.jl:57
``````

I can not understand the error clearly. I am very new for julia sci-ml environment.

1. Can we solve lorentz attractor type ODE system with NeuralPDE.NNODE?
2. How can I resolve this error?
Thank you.

Half of the variables aren’t defined. Can you please give something that can be copy-pasted to reproduce the error?

I have sent a PM to you with the code.
Thank you.