# 'update\_varmap!' Not defined in MethodOfLines

**URL:** <https://discourse.julialang.org/t/update-varmap-not-defined-in-methodoflines/102063>\
**Category:** Modelling & Simulations\
**Tags:** modelingtoolkit\
**Created:** [July 25, 2023, 9:21am UTC](https://discourse.julialang.org/t/update-varmap-not-defined-in-methodoflines/102063 "2023-07-25T09:21:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WillSimpkins](https://avatars.discourse-cdn.com/v4/letter/w/ecccb3/32.png) [@WillSimpkins](https://discourse.julialang.org/u/WillSimpkins)\
**Post date:** [July 25, 2023, 9:21am UTC](https://discourse.julialang.org/t/update-varmap-not-defined-in-methodoflines/102063/1 "2023-07-25T09:21:45Z")

</div>

I am modelling a PDE describing the deformations of a beam, this has the form of a second order PDE in time along with an integral condition on the beam’s strain. I am attempting to discretise this using ModelingToolkit and the MethodOfLines packages. The following is the code I am using:

```julia
using Plots, MethodOfLines, DomainSets, ModelingToolkit

@variables u(..) f(..)

@parameters t θ λ P

dθ = Differential(θ)
dθθ = Differential(θ)^2
dθθθθ = Differential(θ)^4
dt = Differential(t)
dtt = Differential(t)^2

function δ(θ)
    return 1/1000*sqrt(2π) * exp(-θ^2/(2*1000^2)) 
end

Iθ = Integral(θ in DomainSets.ClosedInterval(-1.0,1.0))

eq = [
    dtt(u(t,θ)) ~ -dθθθθ(u(t,θ)) + λ^2 * dθ(f(t,θ) - u(t,θ) +0.5*dθ(u(t,θ))^2*dθ(u(t,θ)))+λ^2 * (f(t,θ) - u(t,θ) +0.5*dθ(u(t,θ))^2)+P*δ(θ), 0 ~ Iθ(f(t,θ))
]

bcs = [
    u(t,-1.0) ~ 0.0, u(t,1.0) ~ 0.0,  
    dθ(dθ(u(t,-1.0))) ~ 0.0, dθ(dθ(u(t,1.0))) ~ 0.0,
    dθ(f(t,-1.0)) - dθ(u(t,-1.0)) ~ 0.0, dθ(f(t,1.0)) - dθ(u(t,1.0)) ~ 0.0,
    u(0.0,θ) ~ 0.0, dt(u(0.0,θ)) ~ 0.0
    ]

domains = [t ∈ (0.0,50.0),
           θ ∈ (-1.0,1.0)]

@named pde_sys = PDESystem(eq, bcs, domains, [t,θ], [u(t,θ),f(t,θ)])

discretisation = MOLFiniteDifference([θ => 100],t)

prob = MethodOfLines.discretize(pde_sys, discretisation)

```

But this is giving the error:

ERROR: UndefVarError: `update_varmap!` not defined

I have looked through the docs for MethodOfLines and cannot find where this function should be defined?

---

<div class="post-metadata">

**Author:** ![algunion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/algunion/32/51630_2.png) [@algunion](https://discourse.julialang.org/u/algunion)\
**Post date:** [July 25, 2023, 11:35pm UTC](https://discourse.julialang.org/t/update-varmap-not-defined-in-methodoflines/102063/2 "2023-07-25T23:35:53Z")

</div>

The `update_varmap!` function is defined in the [`PDEBase`](https://github.com/SciML/PDEBase.jl/blob/e0f1e09578955841953c0daa0a6e4c900a8000ce/src/variable_map.jl#L49C17-L49C17) package.

The call that causes the error is made from [here](https://github.com/SciML/MethodOfLines.jl/blob/c360747593802e9091efcf7fe484f3a98edf5571/src/system_parsing/pde_system_transformation.jl#L207C30-L207C30).

However, `MehodOfLines` doesn’t seem to import the `update_varmap!` from `PDEBase`, as you can see [here](https://github.com/SciML/MethodOfLines.jl/blob/c360747593802e9091efcf7fe484f3a98edf5571/src/MethodOfLines.jl#L19). They have the statement `using PDEBase` in `MethodOfLines`, but `PDEBase` does not export `update_varmap!` function.

This seems to be a classical _not covered by tests_ issue - and one (or more) of these packages got updated, and things got messed up.

The solution is to create an [issue](https://github.com/SciML/MethodOfLines.jl/issues) for `MethodOfLines` requesting a fix for the bug - or to make a very simple pull request fixing the import of the missing function.
