Description
When using a Chebyshev (non-uniform) grid with UpwindScheme(), discretize fails with a SymbolicUtils.RuleRewriteError for PDESystems that have parameterized advection terms like v * Dx(u).
Uniform grids with UpwindScheme() work fine for the same systems.
Error
SymbolicUtils.RuleRewriteError: Failed to apply rule
~(~a) * ($(Differential(x) ^ d))(u) * ~(~b) => upwind_difference(...)
on expression v*Differential(x, 1)(u(t, x))
MWE
using MethodOfLines, DomainSets, OrdinaryDiffEq, ModelingToolkit
@parameters x t v
@variables u(..)
Dx = Differential(x)
Dt = Differential(t)
eq = Dt(u(t, x)) ~ -v * Dx(u(t, x))
bcs = [u(0, x) ~ sin(2π * x), u(t, 0) ~ 0.0]
domains = [t ∈ Interval(0.0, 1.0), x ∈ Interval(0.0, 1.0)]
@named pdesys = PDESystem(eq, bcs, domains, [t, x], [u(t, x)], [v => 0.5])
# Uniform grid — works fine
disc_uniform = MOLFiniteDifference([x => 100], t, advection_scheme = UpwindScheme())
prob = discretize(pdesys, disc_uniform) # OK
# Chebyshev grid — fails
gridnu = chebyspace(100, domains[2])
disc_cheby = MOLFiniteDifference([gridnu], t, advection_scheme = UpwindScheme())
prob = discretize(pdesys, disc_cheby) # ERROR: RuleRewriteError
Parameter-free systems (e.g. -u(t,x) * Dx(u(t,x))) work with both grid types.
Versions
- MethodOfLines v0.11.11
- ModelingToolkit v11.17.0
- PDEBase v0.1.22
- SymbolicUtils v4.20.2
Impact
Affects all PDESystemLibrary systems with parameters when using Chebyshev discretizations in benchmarks.
Description
When using a Chebyshev (non-uniform) grid with
UpwindScheme(),discretizefails with aSymbolicUtils.RuleRewriteErrorfor PDESystems that have parameterized advection terms likev * Dx(u).Uniform grids with
UpwindScheme()work fine for the same systems.Error
MWE
Parameter-free systems (e.g.
-u(t,x) * Dx(u(t,x))) work with both grid types.Versions
Impact
Affects all PDESystemLibrary systems with parameters when using Chebyshev discretizations in benchmarks.