# Issue with PDEBase or PDEsystems!

**URL:** <https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174>\
**Category:** General Usage\
**Created:** [November 2, 2024, 12:42pm UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174 "2024-11-02T12:42:34Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naceur\_Bouziani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/naceur_bouziani/32/35768_2.png) [@Naceur\_Bouziani](https://discourse.julialang.org/u/Naceur_Bouziani)\
**Post date:** [November 2, 2024, 12:42pm UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/1 "2024-11-02T12:42:34Z")

</div>

Hello everyone !

I’m trying to solve a 3 coupled and non linear PDE equations as a first work later Iwill see how to use Catalyst to add sources and sinks processes. for now its just the transport of coupled PDE of gases.

I established my equations everything went well formula after formula till setting up the equations using examples provided in MethodeOlines docs  
the error happens after invoking discretization as follow

_# PDE system_

_@named pdesys = PDESystem(eq, bcs, domains, [t, x], [u(t, x), v(t, x),w(t,x)])_

_# Method of lines discretization_

_dx = 0.001_

_order = 4_

_discretization = MOLFiniteDifference([x =\> dx], t, approx\_order=order, grid\_align=center\_align)_

_# Convert the PDE problem into an ODE problem_

_prob = discretize(pdesys, discretization)_

Here is the error displayed

Activating project at `~/Documents/JULIA-2-GAS`  
ERROR: UndefVarError: `similarterm` not defined in `PDEBase`  
Suggestion: check for spelling errors or missing imports.  
Stacktrace:  
[1] ex2term(term::SymbolicUtils.BasicSymbolic{Real}, v::PDEBase.VariableMap)  
@ PDEBase ~/.julia/packages/PDEBase/EWM3U/src/symbolic\_utils.jl:276  
[2] create\_aux\_variable!(eqs::Vector{…}, bcs::Vector{…}, boundarymap::Dict{…}, v::PDEBase.VariableMap, term::SymbolicUtils.BasicSymbolic{…})  
@ MethodOfLines ~/.julia/packages/MethodOfLines/NV0bv/src/system\_parsing/pde\_system\_transformation.jl:207  
[3] transform\_pde\_system!(v::PDEBase.VariableMap, boundarymap::Dict{…}, sys::PDESystem, disc::MOLFiniteDifference{…})  
@ MethodOfLines ~/.julia/packages/MethodOfLines/NV0bv/src/system\_parsing/pde\_system\_transformation.jl:27  
[4] symbolic\_discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{…})  
@ PDEBase ~/.julia/packages/PDEBase/EWM3U/src/symbolic\_discretize.jl:31  
[5] discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{…}; analytic::Nothing, kwargs::@Kwargs{})  
@ PDEBase ~/.julia/packages/PDEBase/EWM3U/src/discretization\_state.jl:57  
[6] discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{…})  
@ PDEBase ~/.julia/packages/PDEBase/EWM3U/src/discretization\_state.jl:54  
[7] top-level scope  
@ ~/Documents/JULIA-2-GAS/3-Diff-EQS.jl:348  
Some type information was truncated. Use `show(err)` to see complete types.

Naceur

---

<div class="post-metadata">

**Author:** ![Naceur\_Bouziani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/naceur_bouziani/32/35768_2.png) [@Naceur\_Bouziani](https://discourse.julialang.org/u/Naceur_Bouziani)\
**Post date:** [November 2, 2024, 3:06pm UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/2 "2024-11-02T15:06:17Z")

</div>

In one of the equations I have Dx(g(x)\*f(x)+h(x)\*Dx(w(t,x))

w(t,x) is one of the variables to be found

I will try to develop this using mathematica and put the equation in developed form and see if it works

since I cant interpret this error !  
I will be back to you with this attempt  
Naceur

---

<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:** [November 2, 2024, 7:02pm UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/3 "2024-11-02T19:02:21Z")

</div>

Sounds like you have an older version of PDEBase?

---

<div class="post-metadata">

**Author:** ![Naceur\_Bouziani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/naceur_bouziani/32/35768_2.png) [@Naceur\_Bouziani](https://discourse.julialang.org/u/Naceur_Bouziani)\
**Post date:** [November 3, 2024, 5:47pm UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/4 "2024-11-03T17:47:20Z")

</div>

Hi Chris,

Long time no see! 😊

I’ve started coding again and decided to skip Mathematica this time—too prone to errors and delays. Symbolics.jl has been great for handling derivations and expression expansions.

I’m using PDEBase v0.1.15, but I ran into an issue in `PDEBase.jl/src/symbolic_utils.jl` from lines 270 to 277.

I have no idea how to fix this, any help from you guys will make me smile again

Also, I noticed that GitHub shows v0.1.10 as the latest release, even though v0.1.15 installs automatically. Any idea why?

Thanks!

---

<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:** [November 3, 2024, 6:46pm UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/5 "2024-11-03T18:46:22Z")

</div>

Tagbot has issues but you seem to have latest.

What’s the reproducer?

---

<div class="post-metadata">

**Author:** ![Naceur\_Bouziani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/naceur_bouziani/32/35768_2.png) [@Naceur\_Bouziani](https://discourse.julialang.org/u/Naceur_Bouziani)\
**Post date:** [November 3, 2024, 9:49pm UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/6 "2024-11-03T21:49:11Z")

</div>

Hey Chris,

I’m not quite sure what you meant by “producer.” If you meant which line in my code is causing the error, it’s the last line in this portion of code:

```julia
discretization = MOLFiniteDifference([x => dx], t, approx_order=order, grid_align=center_align)
# Convert the PDE problem into an ODE problem

prob = discretize(pdesys, discretization)

```

My Julia setup seems pretty messy right now 😢. I noticed the file in question, `PDEBase.jl/src/symbolic_utils.jl`, is actually located in two places:

1. `.julia/packages/PDEBase/EWM3U/src/symbolic_utils.jl`
2. `.julia/packages/PDEBase/WnliA/src/symbolic_utils.jl`

What’s odd is that these files aren’t identical. For example, in the first one, there’s a portion of code like this:

```julia
function ex2term(term, v)
    iscall(term) || return term
    termdvs = collect(get_depvars(term, v.depvar_ops))
    symdvs = filter(u -> all(x -> !(safe_unwrap(x) isa Number), arguments(u)), termdvs)
    exdv = last(sort(symdvs, by=u -> length(arguments(u))))
    name = Symbol("⟦" * string(term) * "⟧")
    return setname(similarterm(typeof(exdv), rename(operation(exdv), name), arguments(exdv), symtype(exdv), metadata(exdv)), name)
end

```

And in the second:

```julia
function ex2term(term, v)
    iscall(term) || return term
    termdvs = collect(get_depvars(term, v.depvar_ops))
    symdvs = filter(u -> all(x -> !(safe_unwrap(x) isa Number), arguments(u)), termdvs)
    exdv = last(sort(symdvs, by=u -> length(arguments(u))))
    name = Symbol("⟦" * string(term) * "⟧")
    return setname(similarterm(exdv, rename(operation(exdv), name), arguments(exdv), symtype(exdv), metadata(exdv)), name)
end

```

The difference is in the syntax near `similarterm`—the first file uses `similarterm(typeof(exdv), ...)`.

I didn’t check both files line by line,

but my error persists.  
here it is

> Activating project at `~/Documents/JULIA-2-GAS`  
> ERROR: UndefVarError: `similarterm` not defined in `PDEBase`  
> Suggestion: check for spelling errors or missing imports.  
> Stacktrace:  
> [1] ex2term(term::SymbolicUtils.BasicSymbolic{Real}, v::VariableMap)  
> @ PDEBase ~/.julia/packages/PDEBase/EWM3U/src/symbolic\_utils.jl:277  
> [2] create\_aux\_variable!(eqs::Vector{…}, bcs::Vector{…}, boundarymap::Dict{…}, v::VariableMap, term::SymbolicUtils.BasicSymbolic{…})  
> @ MethodOfLines ~/.julia/packages/MethodOfLines/NV0bv/src/system\_parsing/pde\_system\_transformation.jl:207  
> [3] transform\_pde\_system!(v::VariableMap, boundarymap::Dict{…}, sys::PDESystem, disc::MOLFiniteDifference{…})  
> @ MethodOfLines ~/.julia/packages/MethodOfLines/NV0bv/src/system\_parsing/pde\_system\_transformation.jl:27  
> [4] symbolic\_discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{…})  
> @ PDEBase ~/.julia/packages/PDEBase/EWM3U/src/symbolic\_discretize.jl:31  
> [5] discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{…}; analytic::Nothing, kwargs::@Kwargs{})  
> @ PDEBase ~/.julia/packages/PDEBase/EWM3U/src/discretization\_state.jl:57  
> [6] discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{…})  
> @ PDEBase ~/.julia/packages/PDEBase/EWM3U/src/discretization\_state.jl:54  
> [7] top-level scope  
> @ ~/Documents/JULIA-2-GAS/3-Diff-EQS.jl:374  
> Some type information was truncated. Use `show(err)` to see complete types.

Any idea what’s going on?

---

<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:** [November 5, 2024, 8:53am UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/7 "2024-11-05T08:53:51Z")

</div>

Share `]st`?

---

<div class="post-metadata">

**Author:** ![Naceur\_Bouziani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/naceur_bouziani/32/35768_2.png) [@Naceur\_Bouziani](https://discourse.julialang.org/u/Naceur_Bouziani)\
**Post date:** [November 5, 2024, 9:49am UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/8 "2024-11-05T09:49:58Z")

</div>

Here it is in the directory where I’m working

> (JULIA-2-GAS) pkg\> st  
> Status `~/Documents/JULIA-2-GAS/Project.toml`  
> [6e4b80f9] BenchmarkTools v1.5.0  
> [5b8099bc] DomainSets v0.7.14  
> [23fbe1c1] Latexify v0.16.5  
> [94925ecb] MethodOfLines v0.11.6  
> [961ee093] ModelingToolkit v9.49.0  
> [1dea7af3] OrdinaryDiffEq v6.89.0  
> [f0f68f2c] PlotlyJS v0.18.14  
> [d1185830] SymbolicUtils v3.7.2  
> [0c5d862f] Symbolics v6.18.3

---

<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:** [November 5, 2024, 10:04am UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/9 "2024-11-05T10:04:31Z")

</div>

It looks like it was a bad update, or rather when updating to SymbolicUtils v3 we missed to update one function.

> <https://github.com/SciML/PDEBase.jl/pull/34>
>
> Looks like there was a similarterm that was missed in the update.

---

<div class="post-metadata">

**Author:** ![Naceur\_Bouziani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/naceur_bouziani/32/35768_2.png) [@Naceur\_Bouziani](https://discourse.julialang.org/u/Naceur_Bouziani)\
**Post date:** [November 5, 2024, 10:05am UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/10 "2024-11-05T10:05:18Z")

</div>

The problem is with this

UndefVarError: ` **similarterm** ` not defined in `PDEBase`  
Suggestion: check for spelling errors or missing imports.

**similarterm** seems to be a function in Julia

yesterday I attempted to trace each file calling the other, but I did not succeed to solve the problem, here are the files I visited to see where is the problem

ERROR: UndefVarError: `similarterm` not defined in `PDEBase`  
Suggestion: check for spelling errors or missing imports.  
Stacktrace:  
[1] ex2term(term::SymbolicUtils.BasicSymbolic{Real}, v::PDEBase.VariableMap)  
@ PDEBase ~/.julia/packages/PDEBase/EWM3U/src/symbolic\_utils.jl:276  
[2] create\_aux\_variable!(eqs::Vector{…}, bcs::Vector{…}, boundarymap::Dict{…}, v::PDEBase.VariableMap, term::SymbolicUtils.BasicSymbolic{…})  
@ MethodOfLines ~/.julia/packages/MethodOfLines/NV0bv/src/system\_parsing/pde\_system\_transformation.jl:207  
[3] transform\_pde\_system!(v::PDEBase.VariableMap, boundarymap::Dict{…}, sys::PDESystem, disc::MOLFiniteDifference{…})  
@ MethodOfLines ~/.julia/packages/MethodOfLines/NV0bv/src/system\_parsing/pde\_system\_transformation.jl:27  
[4] symbolic\_discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{…})  
@ PDEBase ~/.julia/packages/PDEBase/EWM3U/src/symbolic\_discretize.jl:31  
[5] discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{…}; analytic::Nothing, kwargs::@Kwargs{})  
@ PDEBase ~/.julia/packages/PDEBase/EWM3U/src/discretization\_state.jl:57  
[6] discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{…})  
@ PDEBase ~/.julia/packages/PDEBase/EWM3U/src/discretization\_state.jl:54  
[7] top-level scope  
@ ~/Documents/JULIA-2-GAS/3-Diff-EQS.jl:374  
Some type information was truncated. Use `show(err)` to see complete types.

here is line 374 in my code  
prob = discretize(pdesys, discretization)

I can send you the code I’m writing because maybe I’m not doing thing as it should much more earlier in the code

---

<div class="post-metadata">

**Author:** ![Naceur\_Bouziani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/naceur_bouziani/32/35768_2.png) [@Naceur\_Bouziani](https://discourse.julialang.org/u/Naceur_Bouziani)\
**Post date:** [November 5, 2024, 10:08am UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/11 "2024-11-05T10:08:50Z")

</div>

Great Chris 🙂 I will wait to see the fix and give it a new try

---

<div class="post-metadata">

**Author:** ![Naceur\_Bouziani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/naceur_bouziani/32/35768_2.png) [@Naceur\_Bouziani](https://discourse.julialang.org/u/Naceur_Bouziani)\
**Post date:** [November 8, 2024, 1:47pm UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/12 "2024-11-08T13:47:17Z")

</div>

Hi

It seems to work  
but I’m running in a new problem.  
The solve of the problem is running now it’s almost 50hours for just those 3 PDE equations. Yes they are coupled Yes they are non linear (not high non linearity)  
just physics of diffusion and advection that do not over pass exponent 2 we can encounter sqrt() also between the variables in coefficient of the physics I’m modeling.

The problem is that  
sol = solve(prob, Rodas5P(), saveat=0.01)  
keep working 50 hours without end !  
but I’m sure that will over pass my memory access if thing continue like that

I can see the memory rising and that will finish by reaching all my available memory which is around 60GB (32 RAM and my swap 30 GB)

solve() did not claim anything and keep calculating

and I do not know whit it is happening

So I went on julia to see how I can make calculation using parallel or gpu that could accelerate the calculations (knowing that I’m using MethodOfLines for discretisation  
I did not find suitable and easy way to do that

I found this [https://www.youtube.com/watch?v=vPsfZUqI4\_0](https://www.youtube.com/watch?v=vPsfZUqI4_0)

But I need first advise before diving and changing everything

Thank you for reading my problem and commenting

Naceur

---

<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:** [November 8, 2024, 4:37pm UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/13 "2024-11-08T16:37:37Z")

</div>

> [@Naceur\_Bouziani](#):
>
> sol = solve(prob, Rodas5P(), saveat=0.01

You want to use `FBDF` or something of the sort instead. And set sparse. Or `FBDF(linsolve = LinearSolve.KrylovJL_GMRES())` for example.

---

<div class="post-metadata">

**Author:** ![Naceur\_Bouziani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/naceur_bouziani/32/35768_2.png) [@Naceur\_Bouziani](https://discourse.julialang.org/u/Naceur_Bouziani)\
**Post date:** [November 9, 2024, 2:16pm UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174/14 "2024-11-09T14:16:40Z")

</div>

Hi Chris,

I’ll give this a try! I converted the problem to LaTeX, and the result was pretty overwhelming—those physics coefficients showed massive non-linearity, and I’m not sure how to approach linearizing it.

If we can solve this in Julia, it’ll be a big win!  
I’m sending you the notebook
