# Solving wave PDE with ModelingToolkit.jl and method of lines

**URL:** <https://discourse.julialang.org/t/solving-wave-pde-with-modelingtoolkit-jl-and-method-of-lines/90750>\
**Category:** Modelling & Simulations\
**Tags:** question\
**Created:** [November 24, 2022, 2:36pm UTC](https://discourse.julialang.org/t/solving-wave-pde-with-modelingtoolkit-jl-and-method-of-lines/90750 "2022-11-24T14:36:19Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![fabiopierella](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fabiopierella/32/26642_2.png) [@fabiopierella](https://discourse.julialang.org/u/fabiopierella)\
**Post date:** [December 2, 2022, 3:06pm UTC](https://discourse.julialang.org/t/solving-wave-pde-with-modelingtoolkit-jl-and-method-of-lines/90750/21 "2022-12-02T15:06:10Z")

</div>

Thanks Chris - I have tried to do it but I got a bit stuck.

It seems that to initialize the `ilu` one should know the coefficient matrix `A`, but how do we get that in our problem? Can it be extracted somehow from the output of the `discretize` command?

```julia
prob = discretize(pdesys, discretization)

using IncompleteLU, LinearAlgebra 

LU = ilu(A, τ = 0.1)
sol = solve(prob, Rodas5P(linsolve = IterativeSolversJL_GMRES(), precs=LU));

```

---

<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:** [December 2, 2022, 3:13pm UTC](https://discourse.julialang.org/t/solving-wave-pde-with-modelingtoolkit-jl-and-method-of-lines/90750/22 "2022-12-02T15:13:09Z")

</div>

You don’t need to initialize it, and you don’t want to do it like that because then it’s not state-dependent. Follow how it’s done in [Solving Large Stiff Equations · DifferentialEquations.jl](https://docs.sciml.ai/DiffEqDocs/stable/tutorials/advanced_ode_example/)

[Previous page](https://discourse.julialang.org/t/solving-wave-pde-with-modelingtoolkit-jl-and-method-of-lines/90750.md?page=1)
