-
-
Notifications
You must be signed in to change notification settings - Fork 39
Closed
Description
When the equation is setup like so:
Dt(u(x,t)) + u(x,t)*Dx(u(x,t)) + α*Dx2(u(x,t)) + β*Dx3(u(x,t)) + γ*Dx4(u(x,t)) ~ 0an InvalidSystemException is thrown:
ERROR: InvalidSystemException: The derivative variable must be isolated to the left-hand side of the equation like `Differential(t)(u₂(t)) ~ ...`.
Got 0 ~ 137.50000000000009u₃(t) - (96.87499999999991u₂(t)) - (33.3333333333334u₄(t)) - (7.2916666666667105u₅(t)) - Differential(t)(u₂(t)) - (u₂(t)*(3.750000000000008u₃(t) + 0.20833333333333368u₅(t) + 0.2499999999999997(sech(5.0 + t)^2)*(3tanh(5.0 + t) - 1)*(7.5 + 7.5tanh(5.0 + t)) - (2.7083333333333344u₂(t)) - (1.250000000000007u₄(t)))) - (19.583333333333307(sech(5.0 + t)^2)*(3tanh(5.0 + t) - 1)*(7.5 + 7.5tanh(5.0 + t))). The current work around is re-writing the equation as:
Dt(u(x,t)) ~ -u(x,t)*Dx(u(x,t)) - α*Dx2(u(x,t)) - β*Dx3(u(x,t)) - γ*Dx4(u(x,t))Here is the full script to reproduce:
using ModelingToolkit,DiffEqOperators,LinearAlgebra,OrdinaryDiffEq
@parameters x, t
@variables u(..)
Dt = Differential(t)
Dx = Differential(x)
Dx2 = Differential(x)^2
Dx3 = Differential(x)^3
Dx4 = Differential(x)^4
α = 1
β = 4
γ = 1
eq = Dt(u(x,t)) + u(x,t)*Dx(u(x,t)) + α*Dx2(u(x,t)) + β*Dx3(u(x,t)) + γ*Dx4(u(x,t)) ~ 0
du(x,t;z = -x/2+t) = 15/2*(tanh(z) + 1)*(3*tanh(z) - 1)*sech(z)^2
bcs = [u(x,0) ~ u_analytic(x,0),
Dx(u(-10,t)) ~ du(-10,t),
Dx(u(10,t)) ~ du(10,t)]
# Space and time domains
domains = [x ∈ IntervalDomain(-10.0,10.0),
t ∈ IntervalDomain(0.0,0.5)]
# Discretization
dx = 0.4; dt = 0.2
discretization = MOLFiniteDifference([x=>dx],t;centered_order=4)
pdesys = PDESystem(eq,bcs,domains,[x,t],[u(x,t)])
prob = discretize(pdesys,discretization) # <-- fails here. Metadata
Metadata
Assignees
Labels
No labels