# MTK - solve: weird error message

**URL:** https://discourse.julialang.org/t/mtk-solve-weird-error-message/131638
**Category:** Modelling & Simulations
**Tags:** ordinarydiffeq
**Created:** [August 16, 2025, 2:27pm UTC](https://discourse.julialang.org/t/mtk-solve-weird-error-message/131638 "2025-08-16T14:27:22Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)
#### Post date: [August 16, 2025, 2:27pm UTC](https://discourse.julialang.org/t/mtk-solve-weird-error-message/131638/1 "2025-08-16T14:27:22Z")

</div>

I’m on Julia v1.11.6 on Windows 11 64bit, using MTK v10.19.0, OrdinaryDiffEq v6.101.0. I try to use Clapeyron v0.6.15 with the code.

My code worked without a flaw (except some warnings related to arrays and Clapeyron) in the past (ca. 1 month ago).

Here are some snippets from the execution:

```julia
# -- original model
@mtkcompile sep = Separator()

```

leads to some warnings + the output:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/5/a559dd97191c4850888f45a17f4f2bdfec8fbf0b.png)

Next, setting up the problem:

```julia
julia> tspan = (0, 230)

julia> # Solve problem
julia> prob = ODEProblem(sep, [], tspan, saveat=1)
tspan = (0, 230)

# Solve problem
julia> prob = ODEProblem(sep, [], tspan, saveat=1)
ODEProblem with uType Vector{Float64} and tType Int64. In-place: true
Initialization status: FULLY_DETERMINED
Non-trivial mass matrix: false
timespan: (0, 230)
u0: 2-element Vector{Float64}:
 160.0
   0.2

```

Then I try to solve the problem:

```julia
julia> sol = solve(prob)
index reduction resulted in an empty model.

Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] index_reduction(model::MultiFluid{EmpiricAncillary, AsymmetricMixing, EmpiricDeparture}, bools::BitVector)
    @ Clapeyron C:\Users\Bernt\.julia\packages\Clapeyron\Jd4CF\src\utils\index_reduction.jl:33
  [3] index_reduction(model::MultiFluid{EmpiricAncillary, AsymmetricMixing, EmpiricDeparture}, z...

```

Any idea what the problem is? Has Clapeyron changed?? Or something to do with MTK or OrdinaryDiffEq?

---

<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: [August 16, 2025, 4:51pm UTC](https://discourse.julialang.org/t/mtk-solve-weird-error-message/131638/2 "2025-08-16T16:51:33Z")

</div>

The error message is coming from Clapeyron so you may want to ask them what changed.

---

<div class="post-metadata">

### Author: ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)
#### Post date: [August 16, 2025, 5:08pm UTC](https://discourse.julialang.org/t/mtk-solve-weird-error-message/131638/3 "2025-08-16T17:08:32Z")

</div>

Thanks for quick response. That narrows in my debugging. I saw the JuliaCon 2025 presentation of what is new in MTK, and didn’t quite get whether v10.x had introduced the new array structure.

---

<div class="post-metadata">

### Author: ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)
#### Post date: [August 16, 2025, 5:54pm UTC](https://discourse.julialang.org/t/mtk-solve-weird-error-message/131638/4 "2025-08-16T17:54:24Z")

</div>

Weird. The code works for `tspan = (0,200)`; in the past, it worked for `tspan = (0,230)`.

My guess is that some of the values computed in `Clapeyron.jl` have changed slightly (minor updates) so that some values become negative or NaN or something for t\>200.

The weird thing is that usually, the solvers then give a more understandable crash report then of “index reduction resulted in an empty model”.

---

<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: [August 16, 2025, 6:23pm UTC](https://discourse.julialang.org/t/mtk-solve-weird-error-message/131638/5 "2025-08-16T18:23:09Z")

</div>

Well it’s Clapeyron.jl throwing the error, so we don’t know what it means, what it stands for, or how to improve the error message. You have to talk to them. The “index reduction” is unrelated to DAE index reduction.

---

<div class="post-metadata">

### Author: ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)
#### Post date: [August 24, 2025, 4:22am UTC](https://discourse.julialang.org/t/mtk-solve-weird-error-message/131638/6 "2025-08-24T04:22:39Z")

</div>

> [@BLI](#):
>
> Any idea what the problem is? Has Clapeyron changed?? Or something to do with MTK or OrdinaryDiffEq

The index reduction kicks in when there is an approximately zero value in one of the components mole amount. if there is an empty model, probably a vector with all zeros was used as input for a Clapeyron function.

Edit: The error is probably triggered because at one point, a composition becomes negative. reproducer:

```julia
using Clapeyron
model = PR(["methane","ethane"])
Clapeyron.index_reduction(model,[1.0,-1e-15])

```

---

<div class="post-metadata">

### Author: ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)
#### Post date: [August 24, 2025, 7:22am UTC](https://discourse.julialang.org/t/mtk-solve-weird-error-message/131638/7 "2025-08-24T07:22:49Z")

</div>

Thanks – I suspected something like that could cause the computation to get into problems: I had a fixed volume, and gradually increased the amount of one component in the mixture.

What confused me was the phrase “index reduction”, which I thought was related to ModelingToolkit in the setting I used Julia. But I realize other tools (Clapeyron in this case) may also do index reduction with a different meaning.

---

<div class="post-metadata">

### Author: ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)
#### Post date: [August 24, 2025, 7:28am UTC](https://discourse.julialang.org/t/mtk-solve-weird-error-message/131638/8 "2025-08-24T07:28:05Z")

</div>

i just added a better error message in this case:

```julia-auto
julia> Clapeyron.index_reduction(model,[1.0,-1e-15])
ERROR: Clapeyron.index_reduction(model,z): input composition [1.0, -1.0e-15] has significant negative values.

```
