MethodOfLines.jl
MethodOfLines.jl copied to clipboard
Combining ODE and PDE (part 2)
Hello,
Continuing from #83, and starting with this test:
https://github.com/SciML/MethodOfLines.jl/blob/17f4cbf786d733d9b487efe3b708ae77771d180e/test/pde_systems/MOL_1D_Linear_Diffusion.jl#L742-L789
I change the equation Dt(u(t,x)) ~ Dxx(u(t,x))
to be Dt(u(t,x)) ~ Dxx(u(t,x)) + v(t)
:
using ModelingToolkit, MethodOfLines, OrdinaryDiffEq, DomainSets
@parameters t x
@variables u(..) v(..)
Dt = Differential(t)
Dx = Differential(x)
Dxx = Dx^2
# 1D PDE and boundary conditions
eqs = [Dt(u(t,x)) ~ Dxx(u(t,x)) + v(t), # This is the only line that is significantly changed from the test.
Dt(v(t)) ~ -v(t)]
bcs = [u(0,x) ~ sin(x),
v(0) ~ 1,
u(t,0) ~ 0,
Dx(u(t,1)) ~ exp(-t) * cos(1)]
domains = [t ∈ Interval(0.0,1.0),
x ∈ Interval(0.0,1.0)]
@named pdesys = PDESystem(eqs,bcs,domains,[t,x],[u(t,x),v(t)])
discretization = MOLFiniteDifference([x=>0.01],t)
prob = discretize(pdesys,discretization)
I was expecting that this would add a value to that equation that varied in t
but was constant across all x
. Instead, I get the following error: ERROR: ArgumentError: reducing over an empty collection is not allowed
.
Is this a bug, or is it the expected behavior? Thanks for your help!
I know where this error comes from, I expected that this should already be supported. I will take a closer look at fixing this soon.
Thanks for checking!
Thanks!