# NeuralPDE.NNODE ODE system solve

**URL:** https://discourse.julialang.org/t/neuralpde-nnode-ode-system-solve/70538
**Category:** General Usage
**Tags:** package, diffeq, scientific-computing, neural-network
**Created:** [October 28, 2021, 9:19am UTC](https://discourse.julialang.org/t/neuralpde-nnode-ode-system-solve/70538 "2021-10-28T09:19:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Dr\_M\_Umut\_DEMiREZEN](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@Dr\_M\_Umut\_DEMiREZEN](https://discourse.julialang.org/u/Dr_M_Umut_DEMiREZEN)
#### Post date: [October 28, 2021, 9:19am UTC](https://discourse.julialang.org/t/neuralpde-nnode-ode-system-solve/70538/1 "2021-10-28T09:19:38Z")

</div>

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)

```julia

@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));
opt = Flux.ADAM(0.01);
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:

```julia
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.

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [October 30, 2021, 2:03pm UTC](https://discourse.julialang.org/t/neuralpde-nnode-ode-system-solve/70538/2 "2021-10-30T14:03:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Dr\_M\_Umut\_DEMiREZEN](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@Dr\_M\_Umut\_DEMiREZEN](https://discourse.julialang.org/u/Dr_M_Umut_DEMiREZEN)
#### Post date: [October 31, 2021, 12:15pm UTC](https://discourse.julialang.org/t/neuralpde-nnode-ode-system-solve/70538/3 "2021-10-31T12:15:41Z")

</div>

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