# Vibe-coded modelingtoolkit code generation for PDEs

**URL:** https://discourse.julialang.org/t/vibe-coded-modelingtoolkit-code-generation-for-pdes/136701
**Category:** Modelling & Simulations
**Tags:** pde, modelingtoolkit
**Created:** [April 13, 2026, 4:55pm UTC](https://discourse.julialang.org/t/vibe-coded-modelingtoolkit-code-generation-for-pdes/136701 "2026-04-13T16:55:53Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ctessum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctessum/32/19444_2.png) [@ctessum](https://discourse.julialang.org/u/ctessum)
#### Post date: [April 13, 2026, 4:55pm UTC](https://discourse.julialang.org/t/vibe-coded-modelingtoolkit-code-generation-for-pdes/136701/1 "2026-04-13T16:55:53Z")

</div>

The current released version of ModelingToolkit.jl + MethodOfLines.jl doesn’t really work when the number of variables x the number of grid points is more than ~1,000.

In case it is of interest, I’ve created some vibe-coded edits to make it work for larger grids.

The general idea is that 1) discretization creates array operations using ArrayOp, 2) array-based equations are replaced by representative scalar equations, 3) the scalar equations go through tearing etc, and 4) the equations are converted back to array form for code generation.

I don’t think this correctly produces mass matrices; that would probably have to be a separate effort.

I think it does do sparse jacobians, but probably not in a way that would work at the scale this is intended for.

It currently is not able to work with parallel processing as far as I am aware, that would probably require changes to the code generation side.

To test:

```julia-auto
[sources]
MethodOfLines = {rev = "array-discretization-phase1", url = "https://github.com/ctessum-claude/MethodOfLines.jl.git"}
ModelingToolkit = {rev = "arrayop-block-tearing", url = "https://github.com/ctessum-claude/ModelingToolkit.jl.git"}
ModelingToolkitBase = {rev = "arrayop-block-tearing", subdir = "lib/ModelingToolkitBase", url = "https://github.com/ctessum-claude/ModelingToolkit.jl.git"}
ModelingToolkitTearing = {rev = "arrayop-block-tearing", subdir = "lib/ModelingToolkitTearing", url = "https://github.com/ctessum-claude/StateSelection.jl.git"}
StateSelection = {rev = "arrayop-block-tearing", url = "https://github.com/ctessum-claude/StateSelection.jl.git"}

```
