# Constructor for SplitFunction SplitODEProblem

Hello,

I am looking for a constructor for SplitFunction for SplitODEProblem in DifferentialEquations.jl https://docs.sciml.ai/latest/types/split_ode_types/

Given f1 and f2, how do you define the corresponding SplitFunction. Here is an example of what I would like to do:

using ApproxFun
using DifferentialEquations
S = Fourier(0..16*π)
n = 128
x = points(S, n)
D2 = Derivative(S,2)[1:n,1:n]
D  = (Derivative(S) → S)[1:n,1:n]
T = ApproxFun.plan_transform(S, n)
Ti = ApproxFun.plan_itransform(S, n)
D4 = Derivative(S,4)[1:n,1:n]

û₀ = T*(cos.(x/16).*(1 .+ sin.(x/16)))
tmp=similar(û₀)
q = (D,T,Ti,tmp,similar(tmp),similar(tmp))

function kuramoto_sivashinsky(dû,û,q,t)
D,T,Ti,tmp,u,uc = q
mul!(u, D, û)
mul!(tmp, Ti, u)
mul!(u, Ti, û)
@. tmp=tmp*u
mul!(u,T, tmp)
#mul!(uc, D2, û)
@. dû = - u
end

prob = SplitODEProblem(DiffEqArrayOperator(-Diagonal(D4+D2)), kuramoto_sivashinsky, û₀, (0.0,300.0), q)

# What I would like to do
f = SplitFunction(DiffEqArrayOperator(-Diagonal(D4+D2)), kuramoto_sivashinsky)
prob = SplitODEProblem(f, û₀, (0.0,300.0), q)

sol  = solve(prob,ETDRK4(), dt = 0.01)
1 Like

What is the problem with using the code below the “What I would like to do” comment?
Defining prob like that works and gives the same results as the first attempt.

Sorry, there was a bug somewhere.