# Splited ODE system in ModelingToolkit

**URL:** <https://discourse.julialang.org/t/splited-ode-system-in-modelingtoolkit/101258>\
**Category:** Modelling & Simulations\
**Tags:** modelingtoolkit\
**Created:** [July 6, 2023, 1:22pm UTC](https://discourse.julialang.org/t/splited-ode-system-in-modelingtoolkit/101258 "2023-07-06T13:22:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sabbraxcaddabra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sabbraxcaddabra/32/51312_2.png) [@sabbraxcaddabra](https://discourse.julialang.org/u/sabbraxcaddabra)\
**Post date:** [July 6, 2023, 1:22pm UTC](https://discourse.julialang.org/t/splited-ode-system-in-modelingtoolkit/101258/1 "2023-07-06T13:22:50Z")

</div>

I have a simple system of equations:

```julia
dx_dt = k * x + l * y
dy_dt = n * x + m * y

```

and I want to compute right side functions separately:

```julia
dx_dt = f1(t, x, y) + f2(t, x, y)
dy_dt = f3(t, x, y) + f4(t, x, y)

```

Example is simple but very similar to my needs (i modeling the system of vessels, where gas flow from one to another. the total mass income in vessel is sum of gass outcome from connected vessels)  
To realize this idea i try to use the code below

```julia
using ModelingToolkit

@variables t
D = Differential(t)

function first(; name)
    pr = @parameters k m
    sts = @variables x(t) y(t)

    eqs1 = [
        D(x) ~ k * x
        D(y) ~ m * x
    ]
    ODESystem(eqs1, t, sts, pr; name=name)   
end

function second(; name)
    pr = @parameters l n
    sts = @variables x(t) y(t)
    
    eqs2 = [
        D(x) ~ l * y
        D(y) ~ n * y
    ]
    ODESystem(eqs2, t, sts, pr; name=name)  
end

@named sys1 = first()
@named sys2 = second()

connected = compose(ODESystem([sys1.x ~ sys2.x, sys1.y ~ sys2.y], t; name = :connected), sys1, sys2)
simplified_sys = structural_simplify(connected)

```

This code give me error, but adding extra equations has no effect

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/2/62e00556c83e123a28ae54cd375fb1d791c07d0d.png)

How can I realise this logic

---

<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:** [July 7, 2023, 5:14am UTC](https://discourse.julialang.org/t/splited-ode-system-in-modelingtoolkit/101258/2 "2023-07-07T05:14:33Z")

</div>

ModelingToolkit doesn’t support SplitODEProblem right now, though we are looking into some auto-splitting function building. For now, directly write the SplitODEProblem.

---

<div class="post-metadata">

**Author:** ![mxp](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@mxp](https://discourse.julialang.org/u/mxp)\
**Post date:** [June 10, 2026, 9:13pm UTC](https://discourse.julialang.org/t/splited-ode-system-in-modelingtoolkit/101258/3 "2026-06-10T21:13:10Z")

</div>

Is it still the case that ModelingToolkit doesn’t support SplitODEProblem?

And if it doesn’t, could you say more about “directly writing the SplitODEProblem”?

---

<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:** [June 11, 2026, 12:51am UTC](https://discourse.julialang.org/t/splited-ode-system-in-modelingtoolkit/101258/4 "2026-06-11T00:51:08Z")

</div>

It’s still the case, but yeah now that you remind me…

---

<div class="post-metadata">

**Author:** ![mxp](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@mxp](https://discourse.julialang.org/u/mxp)\
**Post date:** [June 15, 2026, 10:45pm UTC](https://discourse.julialang.org/t/splited-ode-system-in-modelingtoolkit/101258/5 "2026-06-15T22:45:06Z")

</div>

Ok thanks for the update: I created a github issue for it [Add support for SplitODEProblem · Issue #4630 · SciML/ModelingToolkit.jl · GitHub](https://github.com/SciML/ModelingToolkit.jl/issues/4630)

But yeah, if you can say more about directly writing it, that would be helpful in the mean time.
