# When is strip\_solution useful?

**URL:** <https://discourse.julialang.org/t/when-is-strip-solution-useful/119517>\
**Category:** Modelling & Simulations\
**Tags:** differentialequation\
**Created:** [September 17, 2024, 7:37pm UTC](https://discourse.julialang.org/t/when-is-strip-solution-useful/119517 "2024-09-17T19:37:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pulk\_jain](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pulk_jain/32/204900_2.png) [@pulk\_jain](https://discourse.julialang.org/u/pulk_jain)\
**Post date:** [September 17, 2024, 7:37pm UTC](https://discourse.julialang.org/t/when-is-strip-solution-useful/119517/1 "2024-09-17T19:37:50Z")

</div>

I was just curious about the use case for `strip_solution`.  
I noticed that my files were too big when saving whole ode solutions using jld2 and whenever I loaded back the file using `jldopen`, the REPL was riddled with reconstructing things. Sometimes I could access individual fields like sol.u but not sol itself. So, I ended up creating a struct with just retcode, u and t fields and saving that.

What other information does strip\_solution retain which might be useful for any later post processing? Is it better to just create a struct which saves the relevant information?

---

<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:** [September 17, 2024, 8:16pm UTC](https://discourse.julialang.org/t/when-is-strip-solution-useful/119517/2 "2024-09-17T20:16:45Z")

</div>

> [@pulk\_jain](#):
>
> What other information does strip\_solution retain which might be useful for any later post processing? Is it better to just create a struct which saves the relevant information?

It should be effectively the same as doing that, since it removes all function information and only retains the algorithm information required for interpolation.

---

<div class="post-metadata">

**Author:** ![pulk\_jain](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pulk_jain/32/204900_2.png) [@pulk\_jain](https://discourse.julialang.org/u/pulk_jain)\
**Post date:** [September 17, 2024, 9:00pm UTC](https://discourse.julialang.org/t/when-is-strip-solution-useful/119517/3 "2024-09-17T21:00:20Z")

</div>

If the interpolation information is stored, does that mean that I can still call sol(t) on stripped solution where t is not part of the sampled points?

Edit: Turns out I cannot do that. Then how is the “algorithm information required for interpolation” used?

---

<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:** [September 18, 2024, 2:26am UTC](https://discourse.julialang.org/t/when-is-strip-solution-useful/119517/4 "2024-09-18T02:26:34Z")

</div>

You should be able to? @jClugstor you didn’t accidentally strip the algorithm as well?

---

<div class="post-metadata">

**Author:** ![jClugstor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jclugstor/32/32689_2.png) [@jClugstor](https://discourse.julialang.org/u/jClugstor)\
**Post date:** [September 18, 2024, 3:38am UTC](https://discourse.julialang.org/t/when-is-strip-solution-useful/119517/5 "2024-09-18T03:38:33Z")

</div>

Yeah `alg` gets set to `nothing`, so does prob. It’s in the [issue description](https://github.com/SciML/SciMLBase.jl/issues/629) to strip `alg` since it has function information.

I think the issue here is actually that `prob` is set to nothing and the interpolation tries to use `sol.prob.p` [here](https://github.com/SciML/SciMLBase.jl/blob/012ff4eb2ea9e3a57c11cafb3c987218f763c5f9/src/solutions/ode_solutions.jl#L230). Solution might be to set every field in `prob` that can have functions to `nothing`, but keep `prob.p`?

---

<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:** [September 18, 2024, 7:23am UTC](https://discourse.julialang.org/t/when-is-strip-solution-useful/119517/6 "2024-09-18T07:23:32Z")

</div>

> [@jClugstor](#):
>
> Yeah `alg` gets set to `nothing`, so does prob. It’s in the [issue description](https://github.com/SciML/SciMLBase.jl/issues/629) to strip `alg` since it has function information.

That should probably be optional. Most `alg`s do not have any function information, and none would be involved in the reconstruction at least.

> [@jClugstor](#):
>
> I think the issue here is actually that `prob` is set to nothing and the interpolation tries to use `sol.prob.p` [here](https://github.com/SciML/SciMLBase.jl/blob/012ff4eb2ea9e3a57c11cafb3c987218f763c5f9/src/solutions/ode_solutions.jl#L230). Solution might be to set every field in `prob` that can have functions to `nothing`, but keep `prob.p`?

The `p` isn’t used, even in the interpolation, if `f` isn’t used (i.e. if not lazy).

---

<div class="post-metadata">

**Author:** ![jClugstor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jclugstor/32/32689_2.png) [@jClugstor](https://discourse.julialang.org/u/jClugstor)\
**Post date:** [September 18, 2024, 2:21pm UTC](https://discourse.julialang.org/t/when-is-strip-solution-useful/119517/7 "2024-09-18T14:21:38Z")

</div>

It still seems to use `prob.p` as input to `sol.interp`, whether the interpolation is lazy or not, here’s an [issue](https://github.com/SciML/SciMLBase.jl/issues/789)
