# Help modeling advection-diffusion equation with ModelingToolkit.jl

**URL:** <https://discourse.julialang.org/t/help-modeling-advection-diffusion-equation-with-modelingtoolkit-jl/105028>\
**Category:** Modelling & Simulations\
**Tags:** diffeq, modelingtoolkit\
**Created:** [October 16, 2023, 5:07pm UTC](https://discourse.julialang.org/t/help-modeling-advection-diffusion-equation-with-modelingtoolkit-jl/105028 "2023-10-16T17:07:30Z")\
**Posts on this page:** 8\
**Page:** 2

<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:** [October 18, 2023, 8:20am UTC](https://discourse.julialang.org/t/help-modeling-advection-diffusion-equation-with-modelingtoolkit-jl/105028/21 "2023-10-18T08:20:37Z")

</div>

> [@juliohm](#):
>
> Can you share some recommendation on a good solver for this family of equations?

ROCK2 is a good one. Though I’m just going to fix the algorithm defaulter so that `solve(prob)` works here. That’s the best case scenario.

---

<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:** [October 18, 2023, 8:21am UTC](https://discourse.julialang.org/t/help-modeling-advection-diffusion-equation-with-modelingtoolkit-jl/105028/22 "2023-10-18T08:21:08Z")

</div>

> [@juliohm](#):
>
> I think some of them are documented here along the corresponding MWE.

@xtalax can you highlight what areas this is hitting? I can help with the error hinting.

> [@juliohm](#):
>
> You mean that using `t \in (0, 1)` is unsupported? The code worked fine for me without the `Interval` constructor. It is a nice feature for those interested in “rectangular” domains made of Cartesian products of intervals.

It’s supposed to be 😅 . I mean it’s kind of okay for the interval case, but it breaks the uniformity.

---

<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:** [October 18, 2023, 8:24am UTC](https://discourse.julialang.org/t/help-modeling-advection-diffusion-equation-with-modelingtoolkit-jl/105028/23 "2023-10-18T08:24:34Z")

</div>

> [@juliohm](#):
>
> Did you consider writing an intro book on the diffeq ecosystem to non-diffeq people?

Too much to do. I won’t have time for writing a book. There’s enough tutorials and documentation that it’s a book to write every week 😅.

> [@juliohm](#):
>
> Which parts of the software already converged in terms of design?

The solvers. And well most of ModelingToolkit has converged, but as you can see from many other posts, it’s still in its last year of having major updates. MethodOfLines.jl in particular is the PDE feature of MTK, and it’s on the far edge of SciML right now. It’s exciting and it works, and from the Discourse we can see it’s had a lot of adoption even in its early stages, but it’s not robust yet. It’ll probably take another year for the PDE tools to really be complete. They are complete enough that it seems everyone can see the utility, but still incomplete enough that they aren’t “fully automated” with all of the nice error handling that we have everywhere else.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [October 18, 2023, 10:32am UTC](https://discourse.julialang.org/t/help-modeling-advection-diffusion-equation-with-modelingtoolkit-jl/105028/24 "2023-10-18T10:32:08Z")

</div>

> [@ChrisRackauckas](#):
>
> It’s supposed to be 😅 . I mean it’s kind of okay for the interval case, but it breaks the uniformity.

Makes sense. I think exporting `Interval` by default should make it more uniform and consistent.

> [@ChrisRackauckas](#):
>
> Too much to do. I won’t have time for writing a book. There’s enough tutorials and documentation that it’s a book to write every week 😅.

In our case, we are pointing new GeoStats.jl’s users to the textbook. There they can learn the “correct” usage of the framework with more elaborated explanations, and have a glimpse of the bigger picture. It is a huge effort indeed, but after it is done, it can save the maintainers a lot of time. We are converting all the doc pages of our modules to simple lists of docstrings with minimum additional information.

Basically,

- Book =\> Explains “correct” usage and how things are connected conceptually
- Docs =\> Additional options for advanced users, a lookup table of docstrings

> [@ChrisRackauckas](#):
>
> It’ll probably take another year for the PDE tools to really be complete.

Fair enough. Looking forward to trying it more in this current project. Will share any issues we encounter along the way.

---

<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:** [October 18, 2023, 10:12pm UTC](https://discourse.julialang.org/t/help-modeling-advection-diffusion-equation-with-modelingtoolkit-jl/105028/25 "2023-10-18T22:12:05Z")

</div>

> [@juliohm](#):
>
> In our case, we are pointing new GeoStats.jl’s users to the textbook. There they can learn the “correct” usage of the framework with more elaborated explanations, and have a glimpse of the bigger picture. It is a huge effort indeed, but after it is done, it can save the maintainers a lot of time. We are converting all the doc pages of our modules to simple lists of docstrings with minimum additional information.
> 
> Basically,
> 
> - Book =\> Explains “correct” usage and how things are connected conceptually
> - Docs =\> Additional options for advanced users, a lookup table of docstrings

I don’t disagree, I’ve just got a few jobs already 😅, and more docs never hurts. But it’s an open market, good books are needed.

> [@juliohm](#):
>
> Makes sense. I think exporting `Interval` by default should make it more uniform and consistent.

We need to redo the domains stuff in general. It’s hitting some constraints as we’re generalizing.

---

<div class="post-metadata">

**Author:** ![xtalax](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xtalax/32/35293_2.png) [@xtalax](https://discourse.julialang.org/u/xtalax)\
**Post date:** [October 20, 2023, 2:58pm UTC](https://discourse.julialang.org/t/help-modeling-advection-diffusion-equation-with-modelingtoolkit-jl/105028/26 "2023-10-20T14:58:54Z")

</div>

I think the MWE is failing due to lack of bcs, @juliohm did you see the solution interface page showing how to manipulate the solution? I agree that the docs could be improved.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [October 20, 2023, 3:09pm UTC](https://discourse.julialang.org/t/help-modeling-advection-diffusion-equation-with-modelingtoolkit-jl/105028/27 "2023-10-20T15:09:38Z")

</div>

I have a working example now. The problem with the docs remains.

---

<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:** [April 7, 2024, 1:36pm UTC](https://discourse.julialang.org/t/help-modeling-advection-diffusion-equation-with-modelingtoolkit-jl/105028/28 "2024-04-07T13:36:10Z")

</div>

The docs were completely revamped with the upgrade to ModelingToolkit v9. This should be good now.

[Previous page](https://discourse.julialang.org/t/help-modeling-advection-diffusion-equation-with-modelingtoolkit-jl/105028.md?page=1)
