'update_varmap!' Not defined in MethodOfLines

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:

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?

The update_varmap! function is defined in the PDEBase package.

The call that causes the error is made from here.

However, MehodOfLines doesn’t seem to import the update_varmap! from PDEBase, as you can see here. 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 for MethodOfLines requesting a fix for the bug - or to make a very simple pull request fixing the import of the missing function.

2 Likes