Hi all! I’m working with ModellingToolkit and DiffEqOperators to solve a set of PDEs. In particular, I wanted to test out a 1D Kuramoto-Sivashinsky type of equation with periodic boundary conditions, but I’m having some issues with the boundary conditions:
@parameters x t
@variables u(..)
Dt = Differential(t)
Dx = Differential(x)
Dxx = Differential(x)^2
Dxxxx = Differential(x)^4
∇(u) = Dx(u)
∇²(u) = Dxx(u)
∇⁴(u) = Dxxxx(u)
# 2D PDE and boundary conditions
eqs = Dt(u(x,t)) ~ - u(x,t) * ∇(u(x,t)) - ∇²(u(x,t)) - ∇⁴(u(x,t))
T = 1.0
xmin = 0.0
xmax = 1.0
μ0 = 0.3; σ0 = 0.05
f0 = x -> 0.6*exp(-(x - μ0)^2 / (2 * σ0^2))
bcs = [u(x,0.0) ~ f0(x),
u(xmin,t) ~ u(xmax,t)]
# Space and time domains
domains = [t ∈ IntervalDomain(0.0, T),
x ∈ IntervalDomain(xmin, xmax)]
# PDE system
pdesys = PDESystem(eqs, bcs, domains, [x,t], [u(x,t)])
# Method of lines discretization
N = 32
Δx = 1.0/(N+1)
discretization = MOLFiniteDifference([x => Δx], t; centered_order = 4)
# Convert the PDE problem into an ODE problem
prob = discretize(pdesys, discretization)
# Solving the problem
sol = solve(prob, Rodas4(autodiff=false); abstol=1e-6, reltol=1e-6)
But I got the error ERROR: InvalidSystemException: The system is unbalanced. There are 34 highest order derivative variables and 33 equations.
after running the discretize
function.
A different set of BCs, such as:
bcs = [u(x,0.0) ~ f0(x),
u(xmin,t) ~ 0,
u(xmax,t) ~ 0]
seems to be working fine. I wonder whether it’s the way I specified the periodic BCs was wrong. Any help is appreciated!