Is it possible to use a struct to hold the dependent variables when using the solvers in DifferentialEquations.jl, or is it needed to create a single vector u of all dependent variables?
For example, I have a system with 3 ODEs
- dXt/dt = …
- dSt/dt = …
- dLf/dt = …
and 2 PDES that depend on one spatial dimension
- dPb(z)/dt = …
- dSb(z)/dt = …
I’m solving these by discretizing the spatial derivatives in the PDEs by creating a grid with N grid cells and using finite differences to create N ODEs representing each PDE. This gives a total of 3 + 2*N ODEs that are organized into a single vector solved with DifferentialEquations.jl. Everything works, but the solution is difficult to work with since it requires splitting the variables into Xt, St, Lf, Pb, and Sb. I should note that it’s actually a little more complicated, but this is the general idea.
It would be much easier to have a struct that organizes the solution, e.g.,
struct sol
Xt :: Float
St :: Float
Lf :: Float
Pb :: Vector{Float}
Sb :: Vector{Float}
end